Overview
Nutrition works by matching your search term to the best generic food in the USDA FoodData Central SR Legacy database and returning its per-100-gram nutrition panel, layered with derived intelligence the raw USDA data does not carry - calories per gram, the percentage of calories from protein, fat and carbohydrate, and protein per 100 calories. Paid plans unlock the full micronutrient panel (sodium, potassium, cholesterol, the individual fats, minerals and vitamins), the percent Daily Value each nutrient supplies the way a Nutrition Facts label reads, plain-language dietary flags like high protein and low sodium, and can scale the whole panel to any serving weight in grams. Data comes from the public-domain USDA food composition dataset.
Endpoint
One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.
curl "https://api.apiverve.com/v1/nutrition?food=banana&grams=118" \
-H "x-api-key: your_api_key_here"const res = await fetch('https://api.apiverve.com/v1/nutrition?food=banana&grams=118', {
headers: { 'x-api-key': 'your_api_key_here' },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data } = await res.json();
console.log(data);import requests
res = requests.get(
"https://api.apiverve.com/v1/nutrition?food=banana&grams=118",
headers={"x-api-key": "your_api_key_here"},
timeout=15,
)
res.raise_for_status()
print(res.json()["data"])package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.apiverve.com/v1/nutrition?food=banana&grams=118", nil)
req.Header.Set("x-api-key", "your_api_key_here")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.
Authentication
Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.
A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.
Parameters
Sent in the query string. Premium parameters are accepted on every plan but only take effect on plans that include them.
| Parameter | Type | Description |
|---|---|---|
foodRequired | string | Name of the food to look up (e.g. banana, chicken breast, olive oil) length 1–100 |
gramsOptionalPremium | number | Serving weight in grams to scale the nutrition panel to. Defaults to a per-100-gram basis. range 1–10000 |
Response
Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.
{
"status": "ok",
"error": null,
"data": {
"food": "Bananas, raw",
"fdcId": 173944,
"category": "Fruits and Fruit Juices",
"basis": "per 100g",
"servingSizes": [
{
"label": "1 NLEA serving",
"grams": 126
},
{
"label": "1 extra large (9\" or longer)",
"grams": 152
},
{
"label": "1 large (8\" to 8-7/8\" long)",
"grams": 136
}
],
"nutrition": {
"calories": 89,
"protein": 1.09,
"totalFat": 0.33,
"carbohydrates": 22.8,
"fiber": 2.6,
"sugars": 12.2
},
"micronutrients": {
"sodium": 1,
"potassium": 358,
"cholesterol": 0,
"saturatedFat": 0.112,
"transFat": 0,
"monounsaturatedFat": 0.032,
"polyunsaturatedFat": 0.073,
"calcium": 5,
"iron": 0.26,
"magnesium": 27,
"phosphorus": 22,
"zinc": 0.15,
"vitaminC": 8.7,
"vitaminA": 3,
"vitaminD": 0,
"vitaminE": 0.1,
"vitaminK": 0.5,
"thiamin": 0.031,
"riboflavin": 0.073,
"niacin": 0.665,
"vitaminB6": 0.367,
"folate": 20,
"vitaminB12": 0,
"water": 74.9
},
"analytics": {
"caloriesPerGram": 0.89,
"proteinCaloriePercent": 4.4,
"fatCaloriePercent": 3,
"carbCaloriePercent": 92.6,
"proteinPer100Calories": 1.22
},
"dailyValues": {
"protein": 2.2,
"totalFat": 0.4,
"saturatedFat": 0.6,
"cholesterol": 0,
"sodium": 0,
"carbohydrates": 8.3,
"fiber": 9.3,
"potassium": 7.6,
"calcium": 0.4,
"iron": 1.4,
"magnesium": 6.4,
"phosphorus": 1.8,
"zinc": 1.4,
"vitaminC": 9.7,
"vitaminA": 0.3,
"vitaminD": 0,
"vitaminE": 0.7,
"vitaminK": 0.4,
"thiamin": 2.6,
"riboflavin": 5.6,
"niacin": 4.2,
"vitaminB6": 21.6,
"folate": 5,
"vitaminB12": 0
},
"dietaryFlags": {
"highProtein": false,
"goodSourceOfProtein": false,
"highFiber": false,
"goodSourceOfFiber": false,
"lowSodium": true,
"lowFat": true,
"lowSaturatedFat": true,
"lowCholesterol": true,
"lowCalorie": false
}
}
}Response fields
Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.
| Field | Type | Example | Description |
|---|---|---|---|
food | string | "Bananas, raw" | Matched food name from the USDA database |
fdcId | number | 173944 | USDA FoodData Central unique identifier for the food |
category | string | "Fruits and Fruit Juices" | USDA food category the item belongs to |
basis | string | "per 100g" | Basis the nutrition values are reported on (per 100g, or the requested serving) |
servingSizes | array[3] | Common household serving sizes reported for the food | |
label | string | "1 NLEA serving" | Description of the serving size (e.g. 1 cup, sliced) |
grams | number | 126 | Weight of the serving in grams |
nutrition | object | {...} | Headline calories and macronutrients |
calories | number | 89 | Energy in kilocalories |
protein | number | 1.09 | Protein in grams |
totalFat | number | 0.33 | Total fat in grams |
carbohydrates | number | 22.8 | Total carbohydrates in grams |
fiber | number | 2.6 | Dietary fiber in grams |
sugars | number | 12.2 | Total sugars in grams |
micronutrients | object | {...} | Full micronutrient panel |
sodiumPremium | number | 1 | Sodium in milligrams |
potassiumPremium | number | 358 | Potassium in milligrams |
cholesterolPremium | number | 0 | Cholesterol in milligrams |
saturatedFatPremium | number | 0.112 | Saturated fat in grams |
transFatPremium | number | 0 | Trans fat in grams |
monounsaturatedFatPremium | number | 0.032 | Monounsaturated fat in grams |
polyunsaturatedFatPremium | number | 0.073 | Polyunsaturated fat in grams |
calciumPremium | number | 5 | Calcium in milligrams |
ironPremium | number | 0.26 | Iron in milligrams |
magnesiumPremium | number | 27 | Magnesium in milligrams |
phosphorusPremium | number | 22 | Phosphorus in milligrams |
zincPremium | number | 0.15 | Zinc in milligrams |
vitaminCPremium | number | 8.7 | Vitamin C in milligrams |
vitaminAPremium | number | 3 | Vitamin A in micrograms |
vitaminDPremium | number | 0 | Vitamin D in micrograms |
vitaminEPremium | number | 0.1 | Vitamin E in milligrams |
vitaminKPremium | number | 0.5 | Vitamin K in micrograms |
thiaminPremium | number | 0.031 | Thiamin (B1) in milligrams |
riboflavinPremium | number | 0.073 | Riboflavin (B2) in milligrams |
niacinPremium | number | 0.665 | Niacin (B3) in milligrams |
vitaminB6Premium | number | 0.367 | Vitamin B6 in milligrams |
folatePremium | number | 20 | Folate in micrograms |
vitaminB12Premium | number | 0 | Vitamin B12 in micrograms |
waterPremium | number | 74.9 | Water content in grams |
analytics | object | {...} | Derived nutrition intelligence |
caloriesPerGramPremium | number | 0.89 | Energy density in calories per gram |
proteinCaloriePercentPremium | number | 4.4 | Share of calories from protein (percent) |
fatCaloriePercentPremium | number | 3 | Share of calories from fat (percent) |
carbCaloriePercentPremium | number | 92.6 | Share of calories from carbohydrate (percent) |
proteinPer100CaloriesPremium | number | 1.22 | Grams of protein per 100 calories |
dailyValues | object | {...} | Percent of the FDA Daily Value each nutrient supplies on the reported basis |
proteinPremium | number | 2.2 | Protein as a percent of the Daily Value |
totalFatPremium | number | 0.4 | Total fat as a percent of the Daily Value |
saturatedFatPremium | number | 0.6 | Saturated fat as a percent of the Daily Value |
cholesterolPremium | number | 0 | Cholesterol as a percent of the Daily Value |
sodiumPremium | number | 0 | Sodium as a percent of the Daily Value |
carbohydratesPremium | number | 8.3 | Total carbohydrates as a percent of the Daily Value |
fiberPremium | number | 9.3 | Dietary fiber as a percent of the Daily Value |
potassiumPremium | number | 7.6 | Potassium as a percent of the Daily Value |
calciumPremium | number | 0.4 | Calcium as a percent of the Daily Value |
ironPremium | number | 1.4 | Iron as a percent of the Daily Value |
magnesiumPremium | number | 6.4 | Magnesium as a percent of the Daily Value |
phosphorusPremium | number | 1.8 | Phosphorus as a percent of the Daily Value |
zincPremium | number | 1.4 | Zinc as a percent of the Daily Value |
vitaminCPremium | number | 9.7 | Vitamin C as a percent of the Daily Value |
vitaminAPremium | number | 0.3 | Vitamin A as a percent of the Daily Value |
vitaminDPremium | number | 0 | Vitamin D as a percent of the Daily Value |
vitaminEPremium | number | 0.7 | Vitamin E as a percent of the Daily Value |
vitaminKPremium | number | 0.4 | Vitamin K as a percent of the Daily Value |
thiaminPremium | number | 2.6 | Thiamin (B1) as a percent of the Daily Value |
riboflavinPremium | number | 5.6 | Riboflavin (B2) as a percent of the Daily Value |
niacinPremium | number | 4.2 | Niacin (B3) as a percent of the Daily Value |
vitaminB6Premium | number | 21.6 | Vitamin B6 as a percent of the Daily Value |
folatePremium | number | 5 | Folate as a percent of the Daily Value |
vitaminB12Premium | number | 0 | Vitamin B12 as a percent of the Daily Value |
dietaryFlags | object | {...} | Plain-language dietary attributes derived from FDA nutrient-content-claim thresholds |
highProteinPremium | boolean | false | True when protein is at least 20% of the Daily Value per 100g |
goodSourceOfProteinPremium | boolean | false | True when protein is 10-19% of the Daily Value per 100g |
highFiberPremium | boolean | false | True when fiber is at least 20% of the Daily Value per 100g |
goodSourceOfFiberPremium | boolean | false | True when fiber is 10-19% of the Daily Value per 100g |
lowSodiumPremium | boolean | true | True when sodium is 140mg or less per 100g |
lowFatPremium | boolean | true | True when total fat is 3g or less per 100g |
lowSaturatedFatPremium | boolean | true | True when saturated fat is 1g or less per 100g |
lowCholesterolPremium | boolean | true | True when cholesterol is 20mg or less per 100g |
lowCaloriePremium | boolean | false | True when energy is 40 kcal or less per 100g |
Errors
Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.
| Status | Meaning | What to do |
|---|---|---|
400 | Input was rejected | Read error; it names the parameter. |
401 | Key missing or invalid | Check the header name and the key value. |
403 | Key valid, but not permitted | A key restriction or IP allow-list; see key scoping. |
429 | Rate limited, or out of credits | Read error to tell them apart; see rate limits. |
Other ways to use Nutrition
Set up Nutrition on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.
Related
More in Food: