Nutritionix

App · 8 actions

Look up nutrition in Nutritionix's food database: turn a meal or a workout described in plain words into calories and nutrients, search foods, read a product's label by barcode, and find restaurants nearby.

Actions

ActionWhat it does
Estimate calories burnedTurn plain words such as 'ran 3 miles' or '30 minutes yoga' into each exercise's duration and calories burned.
Find restaurant locationsList the restaurant locations Nutritionix knows nearest a point, with each one's brand, address and distance.
Get branded foodGet a restaurant item's or grocery product's full nutrition label by its Nutritionix item id, as 'Search foods' returns it.
Get nutrition from a descriptionTurn plain words such as '2 eggs and a slice of toast' into each food's calories and nutrients, with the meal's totals.
List nutrientsList every nutrient Nutritionix reports, with the number (attr_id) that names it in a food's full nutrients, its unit and its daily value.
List restaurant brandsList the restaurant brands Nutritionix has menus for, with each one's brand id, optionally only those whose name contains some words.
Look up food by barcodeGet a grocery product's full nutrition label by the number under its barcode (UPC or EAN).
Search foodsFind common foods, restaurant items and grocery products by name, optionally only from some brands or within a nutrient limit (such as under 500 calories).

Estimate calories burned

Turn plain words such as 'ran 3 miles' or '30 minutes yoga' into each exercise's duration and calories burned. Gender, weight, height and age make the estimate closer.

Inputs

What was donequerytextRequired
The exercise in plain words, with how long or how far, such as 'ran 3 miles' or '30 minutes yoga'.
Gendergendertext
The person's gender, for a closer estimate.One of: female, male.
Weight (kg)weight_kgnumber
The person's weight in kilograms, for a closer estimate.From 1 to 500.
Height (cm)height_cmnumber
The person's height in centimetres, for a closer estimate.From 30 to 300.
Ageagenumber
The person's age in years, for a closer estimate.From 1 to 130.

Outputs

countnumber
How many exercises were recognised
exerciseslist
Each exercise recognised
matchedtrue/false
False when Nutritionix recognised nothing in the words
total_caloriesnumber
Calories burned by everything recognised
total_duration_minnumber
Minutes of everything recognised
Example output
{
  "count": 1,
  "exercises": [
    {
      "benefits": null,
      "compendium_code": 18310,
      "description": null,
      "duration_min": 60,
      "met": 6,
      "name": "swimming",
      "nf_calories": 420,
      "photo": {
        "highres": "https://d2xdmhkmkbyw75.cloudfront.net/exercise//63_highres.jpg",
        "is_user_uploaded": false,
        "thumb": "https://d2xdmhkmkbyw75.cloudfront.net/exercise//63_thumb.jpg"
      },
      "tag_id": 63,
      "user_input": "swam"
    }
  ],
  "matched": true,
  "total_calories": 420,
  "total_duration_min": 60
}

Find restaurant locations

List the restaurant locations Nutritionix knows nearest a point, with each one's brand, address and distance.

Inputs

LatitudelatitudenumberRequired
The point's latitude, such as 38.8981.From -90 to 90.
LongitudelongitudenumberRequired
The point's longitude, such as -77.0294.From -180 to 180.
How manylimitnumber
The most locations to return, 1 to 50.From 1 to 50.

Outputs

countnumber
How many
locationslist
The nearest locations
Example output
{
  "count": 1,
  "locations": [
    {
      "address": "1301 Pennsylvania Ave NW",
      "address2": null,
      "brand_id": "513fbc1283aa2dc80c00001f",
      "city": "Washington",
      "country": "US",
      "distance_km": 0.25,
      "id": 1157461,
      "lat": 38.8964,
      "lng": -77.0306,
      "name": "Starbucks",
      "phone": "+12026381320",
      "state": "DC",
      "website": "https://www.starbucks.com",
      "zip": "20004"
    }
  ]
}

Get branded food

Get a restaurant item's or grocery product's full nutrition label by its Nutritionix item id, as 'Search foods' returns it.

Inputs

Item IDnix_item_idtextRequired
The food's Nutritionix item id (nix_item_id), from 'Search foods' or an earlier step.
Include servings per containerservings_per_containertrue/false
Also return how many servings the package holds.

Outputs

foodobject
The food's nutrition label
foodslist
Every food Nutritionix returned
Example output
{
  "food": {
    "alt_measures": null,
    "brand_name": "Coke",
    "brick_code": null,
    "class_code": null,
    "food_name": "Diet Cola",
    "full_nutrients": [
      {
        "attr_id": 203,
        "value": 0
      },
      {
        "attr_id": 204,
        "value": 0
      },
      {
        "attr_id": 205,
        "value": 0
      },
      {
        "attr_id": 208,
        "value": 0
      },
      {
        "attr_id": 307,
        "value": 70
      }
    ],
    "lat": null,
    "lng": null,
    "metadata": {},
    "ndb_no": null,
    "nf_calories": 0,
    "nf_cholesterol": null,
    "nf_dietary_fiber": null,
    "nf_ingredient_statement": "Carbonated Water, Caramel Color, Aspartame, Phosphoric Acid, Potassium Benzoate (to Protect Taste), Natural Flavors, Citric Acid, Caffeine.",
    "nf_metric_qty": 591,
    "nf_metric_uom": "ml",
    "nf_p": null,
    "nf_potassium": null,
    "nf_protein": 0,
    "nf_saturated_fat": null,
    "nf_sodium": 70,
    "nf_sugars": null,
    "nf_total_carbohydrate": 0,
    "nf_total_fat": 0,
    "nix_brand_id": "51db3801176fe9790a89ae0b",
    "nix_brand_name": "Coke",
    "nix_item_id": "51d2fae7cc9bff111580d8d8",
    "nix_item_name": "Diet Cola",
    "note": null,
    "photo": {
      "highres": null,
      "is_user_uploaded": false,
      "thumb": "https://nutritionix-api.s3.amazonaws.com/5b5c17c429f162275dc922b0.jpeg"
    },
    "serving_qty": 1,
    "serving_unit": "bottle",
    "serving_weight_grams": 226,
    "source": 8,
    "tag_id": null,
    "tags": null,
    "updated_at": "2022-06-22T03:14:26+00:00"
  },
  "foods": [
    {
      "alt_measures": null,
      "brand_name": "Coke",
      "brick_code": null,
      "class_code": null,
      "food_name": "Diet Cola",
      "full_nutrients": [
        {
          "attr_id": 203,
          "value": 0
        },
        {
          "attr_id": 204,
          "value": 0
        },
        {
          "attr_id": 205,
          "value": 0
        },
        {
          "attr_id": 208,
          "value": 0
        },
        {
          "attr_id": 307,
          "value": 70
        }
      ],
      "lat": null,
      "lng": null,
      "metadata": {},
      "ndb_no": null,
      "nf_calories": 0,
      "nf_cholesterol": null,
      "nf_dietary_fiber": null,
      "nf_ingredient_statement": "Carbonated Water, Caramel Color, Aspartame, Phosphoric Acid, Potassium Benzoate (to Protect Taste), Natural Flavors, Citric Acid, Caffeine.",
      "nf_metric_qty": 591,
      "nf_metric_uom": "ml",
      "nf_p": null,
      "nf_potassium": null,
      "nf_protein": 0,
      "nf_saturated_fat": null,
      "nf_sodium": 70,
      "nf_sugars": null,
      "nf_total_carbohydrate": 0,
      "nf_total_fat": 0,
      "nix_brand_id": "51db3801176fe9790a89ae0b",
      "nix_brand_name": "Coke",
      "nix_item_id": "51d2fae7cc9bff111580d8d8",
      "nix_item_name": "Diet Cola",
      "note": null,
      "photo": {
        "highres": null,
        "is_user_uploaded": false,
        "thumb": "https://nutritionix-api.s3.amazonaws.com/5b5c17c429f162275dc922b0.jpeg"
      },
      "serving_qty": 1,
      "serving_unit": "bottle",
      "serving_weight_grams": 226,
      "source": 8,
      "tag_id": null,
      "tags": null,
      "updated_at": "2022-06-22T03:14:26+00:00"
    }
  ]
}

Get nutrition from a description

Turn plain words such as '2 eggs and a slice of toast' into each food's calories and nutrients, with the meal's totals.

Inputs

What was eatenquerytextRequired
The foods in plain words, with amounts if known, such as '1 cup oatmeal and 2 boiled eggs' or 'a Big Mac'.
Servings it makesnum_servingsnumber
For a recipe: how many servings the foods make. Each food's nutrients are divided by it. Leave empty for 1.At least 1.
When eatenconsumed_atdate and time
When the food was eaten. Leave empty to let Nutritionix work it out from the words (such as 'for breakfast') or use now.
Time zonetimezonetext
The eater's time zone, used to read words like 'yesterday' or 'for lunch', such as US/Pacific or Europe/London. Defaults to US/Eastern.
One food per lineline_delimitedtrue/false
Read each line as exactly one food.
Allow raw foodsuse_raw_foodstrue/false
Match uncooked versions of foods, such as raw chicken.
Allow brand namesuse_branded_foodstrue/false
Recognise branded foods named in the words, such as a Big Mac.
Include recipe ingredientsinclude_subrecipetrue/false
For a dish with a known recipe, also return its ingredients.
Include ingredient listingredient_statementtrue/false
Also return each food's ingredient statement where Nutritionix has one.

Outputs

countnumber
How many foods were recognised
foodslist
Each food recognised, with its nutrients
matchedtrue/false
False when Nutritionix recognised nothing in the words
total_caloriesnumber
Calories of everything recognised
total_carbohydrate_gnumber
Carbohydrate of everything recognised, in grams
total_fat_gnumber
Fat of everything recognised, in grams
total_protein_gnumber
Protein of everything recognised, in grams
total_sodium_mgnumber
Sodium of everything recognised, in milligrams
total_sugars_gnumber
Sugars of everything recognised, in grams
Example output
{
  "count": 1,
  "foods": [
    {
      "alt_measures": [
        {
          "measure": "cup",
          "qty": 1,
          "seq": 1,
          "serving_weight": 151
        },
        {
          "measure": "grapes",
          "qty": 10,
          "seq": 2,
          "serving_weight": 49
        }
      ],
      "brand_name": null,
      "brick_code": null,
      "class_code": null,
      "consumed_at": "2023-09-22T18:24:59+00:00",
      "food_name": "grape",
      "full_nutrients": [
        {
          "attr_id": 203,
          "value": 0.3528
        },
        {
          "attr_id": 204,
          "value": 0.0784
        },
        {
          "attr_id": 205,
          "value": 8.869
        },
        {
          "attr_id": 208,
          "value": 33.81
        }
      ],
      "lat": null,
      "lng": null,
      "meal_type": 3,
      "metadata": {
        "is_raw_food": false
      },
      "ndb_no": 9132,
      "nf_calories": 33.81,
      "nf_cholesterol": 0,
      "nf_dietary_fiber": 0.44,
      "nf_p": 9.8,
      "nf_potassium": 93.59,
      "nf_protein": 0.35,
      "nf_saturated_fat": 0.03,
      "nf_sodium": 0.98,
      "nf_sugars": 7.59,
      "nf_total_carbohydrate": 8.87,
      "nf_total_fat": 0.08,
      "nix_brand_id": null,
      "nix_brand_name": null,
      "nix_item_id": null,
      "nix_item_name": null,
      "photo": {
        "highres": "https://nix-tag-images.s3.amazonaws.com/586_highres.jpg",
        "is_user_uploaded": false,
        "thumb": "https://nix-tag-images.s3.amazonaws.com/586_thumb.jpg"
      },
      "serving_qty": 10,
      "serving_unit": "grapes",
      "serving_weight_grams": 49,
      "source": 1,
      "sub_recipe": null,
      "tag_id": null,
      "tags": {
        "food_group": 3,
        "item": "grape",
        "measure": null,
        "quantity": "10.0",
        "tag_id": 586
      },
      "upc": null
    }
  ],
  "matched": true,
  "total_calories": 33.81,
  "total_carbohydrate_g": 8.87,
  "total_fat_g": 0.08,
  "total_protein_g": 0.35,
  "total_sodium_mg": 0.98,
  "total_sugars_g": 7.59
}

List nutrients

List every nutrient Nutritionix reports, with the number (attr_id) that names it in a food's full nutrients, its unit and its daily value.

Inputs

None.

Outputs

countnumber
How many
nutrientslist
The nutrients
Example output
{
  "count": 1,
  "nutrients": [
    {
      "api_name": "nf_calories",
      "attr_id": 208,
      "fda_daily_value": 2000,
      "name": "nf_calories",
      "unit": "kcal",
      "usda_nutr_desc": "Energy",
      "usda_sr_order": 300,
      "usda_tag": "ENERC_KCAL"
    }
  ]
}

List restaurant brands

List the restaurant brands Nutritionix has menus for, with each one's brand id, optionally only those whose name contains some words.

Inputs

Name containsname_containstext
Only brands whose name contains this, such as 'pizza'.

Outputs

brandslist
The brands, A to Z
countnumber
How many
Example output
{
  "brands": [
    {
      "id": "22389211a72974d25c294e35",
      "name": "Chili's"
    }
  ],
  "count": 1
}

Look up food by barcode

Get a grocery product's full nutrition label by the number under its barcode (UPC or EAN).

Inputs

Barcode numberupctextRequired
The digits under the product's barcode, such as 049000000450.
Include servings per containerservings_per_containertrue/false
Also return how many servings the package holds.

Outputs

foodobject
The food's nutrition label
foodslist
Every food Nutritionix returned
Example output
{
  "food": {
    "alt_measures": null,
    "brand_name": "Coke",
    "brick_code": null,
    "class_code": null,
    "food_name": "Diet Cola",
    "full_nutrients": [
      {
        "attr_id": 203,
        "value": 0
      },
      {
        "attr_id": 204,
        "value": 0
      },
      {
        "attr_id": 205,
        "value": 0
      },
      {
        "attr_id": 208,
        "value": 0
      },
      {
        "attr_id": 307,
        "value": 70
      }
    ],
    "lat": null,
    "lng": null,
    "metadata": {},
    "ndb_no": null,
    "nf_calories": 0,
    "nf_cholesterol": null,
    "nf_dietary_fiber": null,
    "nf_ingredient_statement": "Carbonated Water, Caramel Color, Aspartame, Phosphoric Acid, Potassium Benzoate (to Protect Taste), Natural Flavors, Citric Acid, Caffeine.",
    "nf_metric_qty": 591,
    "nf_metric_uom": "ml",
    "nf_p": null,
    "nf_potassium": null,
    "nf_protein": 0,
    "nf_saturated_fat": null,
    "nf_sodium": 70,
    "nf_sugars": null,
    "nf_total_carbohydrate": 0,
    "nf_total_fat": 0,
    "nix_brand_id": "51db3801176fe9790a89ae0b",
    "nix_brand_name": "Coke",
    "nix_item_id": "51d2fae7cc9bff111580d8d8",
    "nix_item_name": "Diet Cola",
    "note": null,
    "photo": {
      "highres": null,
      "is_user_uploaded": false,
      "thumb": "https://nutritionix-api.s3.amazonaws.com/5b5c17c429f162275dc922b0.jpeg"
    },
    "serving_qty": 1,
    "serving_unit": "bottle",
    "serving_weight_grams": 226,
    "source": 8,
    "tag_id": null,
    "tags": null,
    "updated_at": "2022-06-22T03:14:26+00:00"
  },
  "foods": [
    {
      "alt_measures": null,
      "brand_name": "Coke",
      "brick_code": null,
      "class_code": null,
      "food_name": "Diet Cola",
      "full_nutrients": [
        {
          "attr_id": 203,
          "value": 0
        },
        {
          "attr_id": 204,
          "value": 0
        },
        {
          "attr_id": 205,
          "value": 0
        },
        {
          "attr_id": 208,
          "value": 0
        },
        {
          "attr_id": 307,
          "value": 70
        }
      ],
      "lat": null,
      "lng": null,
      "metadata": {},
      "ndb_no": null,
      "nf_calories": 0,
      "nf_cholesterol": null,
      "nf_dietary_fiber": null,
      "nf_ingredient_statement": "Carbonated Water, Caramel Color, Aspartame, Phosphoric Acid, Potassium Benzoate (to Protect Taste), Natural Flavors, Citric Acid, Caffeine.",
      "nf_metric_qty": 591,
      "nf_metric_uom": "ml",
      "nf_p": null,
      "nf_potassium": null,
      "nf_protein": 0,
      "nf_saturated_fat": null,
      "nf_sodium": 70,
      "nf_sugars": null,
      "nf_total_carbohydrate": 0,
      "nf_total_fat": 0,
      "nix_brand_id": "51db3801176fe9790a89ae0b",
      "nix_brand_name": "Coke",
      "nix_item_id": "51d2fae7cc9bff111580d8d8",
      "nix_item_name": "Diet Cola",
      "note": null,
      "photo": {
        "highres": null,
        "is_user_uploaded": false,
        "thumb": "https://nutritionix-api.s3.amazonaws.com/5b5c17c429f162275dc922b0.jpeg"
      },
      "serving_qty": 1,
      "serving_unit": "bottle",
      "serving_weight_grams": 226,
      "source": 8,
      "tag_id": null,
      "tags": null,
      "updated_at": "2022-06-22T03:14:26+00:00"
    }
  ]
}

Search foods

Find common foods, restaurant items and grocery products by name, optionally only from some brands or within a nutrient limit (such as under 500 calories). Use a branded result's item id with 'Get branded food' for its full label.

Inputs

Search forquerytextRequired
A food or product name, or the start of one, such as 'chicken'.
Include common foodsinclude_commontrue/false
Include everyday foods without a brand. On unless turned off.
Include branded foodsinclude_brandedtrue/false
Include restaurant items and grocery products. On unless turned off.
Branded food typebranded_typetext
Only restaurant foods, or only grocery products. Leave empty for both.One of: 1 (Restaurant foods), 2 (Grocery products).
Restaurant brandsbrand_idslist
Only branded foods from these brands.
Match item names onlybranded_food_name_onlytrue/false
Match branded foods by their item name only, not their brand name.
Language and countrylocaletext
Search common foods in this language. Defaults to English (United States).One of: en_US (English (United States)), en_GB (English (United Kingdom)), de_DE (German (Germany)), fr_FR (French (France)), es_ES (Spanish (Spain)), es_MX (Spanish (Mexico)), it_IT (Italian (Italy)), nl_NL (Dutch (Netherlands)), pt_PT (Portuguese (Portugal)), pt_BR (Portuguese (Brazil)), and 6 more.
Limit by nutrientnutrienttext
Only foods whose amount of this nutrient is within the limits given.
At leastat_leastnumber
The nutrient's lowest amount per serving, in its unit.At least 0.
At mostat_mostnumber
The nutrient's highest amount per serving, in its unit.At least 0.

Outputs

brandedlist
Restaurant items and grocery products that match
branded_countnumber
How many branded foods
commonlist
Common foods that match
common_countnumber
How many common foods
Example output
{
  "branded": [
    {
      "brand_name": "Original Tommy's Hamburgers",
      "brand_name_item_name": "Original Tommy's Hamburgers Double Hamburger",
      "brand_type": 1,
      "food_name": "Double Hamburger",
      "locale": "en_US",
      "nf_calories": 650,
      "nix_brand_id": "513fbc1283aa2dc80c000273",
      "nix_item_id": "513fc9ca673c4fbc260046ed",
      "photo": {
        "highres": null,
        "is_user_uploaded": false,
        "thumb": "https://d2eawub7utcl6.cloudfront.net/images/nix-apple-grey.png"
      },
      "region": 1,
      "serving_qty": 333,
      "serving_unit": "grams"
    }
  ],
  "branded_count": 1,
  "common": [
    {
      "common_type": null,
      "food_name": "hamburger soup",
      "locale": "en_US",
      "photo": {
        "highres": null,
        "is_user_uploaded": false,
        "thumb": "https://d2eawub7utcl6.cloudfront.net/images/nix-apple-grey.png"
      },
      "serving_qty": 1,
      "serving_unit": "bowl (2 cups)",
      "tag_id": "4818",
      "tag_name": "cheeseburger soup"
    }
  ],
  "common_count": 1
}

On this page