Foods API
Search the food database and your personal foods; nutrients per portion. 2 ops: search_foods, get_food.
Search the food database and your personal foods; nutrients per portion.
Search foods · POST /api/v1/search_foods · scope foods:read or GET …?input=
Find canonical foods by name in USDA FoodData Central (Foundation, SR Legacy and FNDDS mixed dishes) plus packaged products in the barcode index. Returns foods best first with a 0–1 match score, nutrients per 100 g (integers: energy in millikilocalories, macros and most minerals in milligrams, some vitamins in micrograms), the default serving with kcal and grams for display, household portions ("1 cup, sliced" = 165 g) and canonical ingredient ids; and products (brand, name, gtin). Use it to pick the food id before get_food, or to answer "how many calories in…". Free; no sign-in needed. log_meal matches foods itself: you do not need this to log.
curl -X POST https://getgutlog.com/api/v1/search_foods \ -H "Authorization: Bearer gutlog_…" \ -H "Content-Type: application/json" \ -d '{"query":"greek yogurt"}'npx @meterapp/gutlog search_foods --json '{"query":"greek yogurt"}'{
"type": "object",
"properties": {
"query": {
"type": "string",
"minLength": 1,
"maxLength": 200,
"description": "What to look for, e.g. \"banana\", \"chicken breast roasted\", \"cheerios\"."
},
"limit": {
"default": 8,
"description": "Foods to return (default 8).",
"type": "integer",
"minimum": 1,
"maximum": 25
},
"include_products": {
"default": true,
"description": "Also search packaged products in the barcode index.",
"type": "boolean"
}
},
"required": [
"query"
]
}Get a food · POST /api/v1/get_food · scope foods:read or GET …?input=
One canonical food by id (from search_foods, e.g. usda:171705) or by its page slug: name, category, source and citation, every nutrient per 100 g, all household portions, ingredient ids and its public page. Pass grams or a portion label to also get the nutrients for that amount (integers in stored units, plus a display version in kcal and grams). Free; no sign-in needed.
curl -X POST https://getgutlog.com/api/v1/get_food \ -H "Authorization: Bearer gutlog_…"npx @meterapp/gutlog get_food{
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "Canonical food id from search_foods (e.g. usda:171287 or seed:banana-raw)."
},
"slug": {
"description": "The food's page slug, e.g. bananas-raw (getgutlog.com/foods/<slug>).",
"type": "string",
"pattern": "^[a-z0-9-]{1,100}$"
},
"grams": {
"description": "An amount in grams to compute nutrients for.",
"type": "number",
"exclusiveMinimum": 0,
"maximum": 10000
},
"portion": {
"description": "A portion label from the food's portions, e.g. \"1 cup, sliced\".",
"type": "string",
"minLength": 1,
"maxLength": 120
},
"quantity": {
"default": 1,
"description": "How many of the portion (default 1).",
"type": "number",
"exclusiveMinimum": 0,
"maximum": 100
}
}
}