FitAPI — The Most Detailed Food & Exercise Database API
Ask your AI agent about any food, nutrient, exercise, or barcode — and get precise, science-grade data instead of LLM guesses.
"How much omega-3 is in salmon?" — FitAPI returns the exact value from curated scientific databases, not an approximation from training data.
Setup — API key required
Before making any API calls, you need an API key. If the user hasn't configured one yet, guide them through setup:
- 1. Sign up at https://fitapi.fitnessrec.com — free account, no credit card needed
- Get the API key from the dashboard at https://fitapi.fitnessrec.com/dashboard
- Configure this skill with the API key
All requests are authenticated via the Authorization: Bearer {apiKey} header. If you get a 401 error, the key is missing or invalid — tell the user to check their key in the dashboard.
| Plan | Requests/day | Price |
|---|
| Free | 10 | $0 forever |
| Paid |
500 | $9.99/year |
| Enterprise | 40,000 | $49.99/month |
All plans include every endpoint and all 47 languages.
Full interactive API docs (Swagger UI): https://fitapi.fitnessrec.com/api/docs
How to use this API — pick the right tool
You have 9 tools. Do NOT just use search_foods for everything. Each tool serves a specific purpose:
| User intent | Tool to use | Why |
|---|
| "What's in chicken breast?" / "Calories in rice" | INLINECODE3 | Name-based lookup, returns full 180 nutrients per 100g + portions |
| "Foods highest in iron" / "High protein low carb" |
filter_foods | Sort/rank by actual nutrient values — search can't do this |
| "Scan this barcode" / exact UPC/EAN number |
lookup_barcode | Direct barcode → product lookup |
| "Find me a protein bar" / branded product name |
search_barcode | Search 3M+ branded products by name |
| "How to do a deadlift?" / exercise lookup |
search_exercises | Returns instructions, tips, muscle targeting, equipment |
| "Recipe for pad thai" / dish lookup |
search_dishes | 80k+ recipes with ingredients matched to nutrition DB |
| "How much protein do I need?" / daily targets |
nutrition_needs | Personalized macro/micronutrient targets from body stats |
Recommended workflows (chain these for better answers)
1. Meal planning — "Plan a high-protein lunch under 500 calories"
- 1.
nutrition_needs — get the user's daily targets (if body stats are known) - INLINECODE11 — find foods matching criteria: INLINECODE12
- Present options with portions and macros
2. Recipe nutrition breakdown — "How many calories in caesar salad?"
- 1.
search_dishes — find the recipe, get normalized_ingredients with matched food IDs and gram amounts - Each ingredient includes
matched_id — use get_food to retrieve full nutrient detail for any ingredient you need to examine - The dish itself already includes aggregated
nutrients per 100g
3. Diet comparison — "Which has more omega-3, salmon or mackerel?"
- 1.
search_foods for each food (returns full 180 nutrients including omega-3 as nutrient ID 4444) - Compare the
nutrients.4444.value fields directly
4. Nutrient gap analysis — "Am I getting enough iron?"
- 1.
nutrition_needs — get daily iron requirement (nutrient 1089) - INLINECODE23 for the user's logged foods — sum up iron from each
- Compare total vs. requirement
5. Barcode scanning — "What is this product?"
- 1.
lookup_barcode with the UPC/EAN number for direct match - If no match, fall back to
search_barcode with the product name
6. Exercise programming — "Chest exercises with dumbbells"
- 1.
search_exercises with INLINECODE27 - Results include muscle activation percentages (
MuscleDistribution) — use these to build balanced routines that cover all muscle groups
Important: search_foods already returns complete data
INLINECODE29 returns all 180 nutrients, portions, and metadata per food. You do NOT need to call get_food after search — the data is identical. Use get_food only when you already have a food ID (e.g., from a recipe's normalized_ingredients).
What you get
- - 16,000+ foods with 180 nutrients each — every vitamin, mineral, amino acid, fatty acid — curated from 5 international databases (USDA, NUTTAB, CNF2015, MEXT, FRIDA)
- 3 million+ branded products — scan or search any barcode (UPC/EAN) for nutrition facts
- 80,000+ local recipes from 48 languages — with ingredients matched to the nutrition database for accurate macros
- 5,000+ exercises — step-by-step instructions, tips, main/granular/synergist muscles, equipment, and muscle activation percentages
- Smart filtering — "foods highest in iron", "high protein low fat seafood", "most omega-3" — sorted by actual nutrient values, not keyword matching
- Personalized daily needs — calculate exact macro/micronutrient targets based on body stats and goals
- 48 languages — food names, exercise instructions, and recipe data translated natively
Why not just ask the LLM?
LLMs estimate. FitAPI knows. When you ask "how much protein in chicken breast", an LLM guesses ~31g from training data. FitAPI returns 22.5g per 100g from the USDA database — the actual measured value. For serious nutrition tracking, the difference matters.
Tools
search_foods
Search foods by name. Returns nutrient data per 100g and portion sizes.
CODEBLOCK0
Request:
CODEBLOCK1
- -
q (required): Search query in English - INLINECODE34 : Language code for translated names (en, tr, de, fr, es, it, pt, nl, ru, ja, ko, zh, ar, hi, pl, sv, da, fi, cs, ro, hu, bg, el, hr, sr, sk, sl, bs, sq, et, lt, lv, is, nn, vi, th, id, ms, fil, uk, fa, he, bn, ka, az, mn, ur, af)
- INLINECODE35 : 1-100, default 20
Response: Array of foods with id, desc (name), nutrients map (ID -> {name, unit, value per 100g}), portions map.
filter_foods
Filter and sort foods by nutrient values. Use for "which food has the most X" or "foods high in X" queries. ALWAYS include sort.
CODEBLOCK2
Request:
CODEBLOCK3
- -
filter (required): MeiliSearch filter expression. Operators: =, !=, >, >=, <, <=, TO, AND, OR, NOT - INLINECODE41 (required):
nutrientId:desc or INLINECODE43 - INLINECODE44 : Optional text search to narrow results
- INLINECODE45 : Language code
- INLINECODE46 : 1-100, default 20
Example queries:
- - Highest protein: INLINECODE47
- Most omega-3: INLINECODE48
- Most omega-6: INLINECODE49
- Low calorie + high fiber: INLINECODE50
- High iron: INLINECODE51
- High protein seafood: INLINECODE52
Nutrient IDs:
| Category | IDs |
|---|
| Macros | 1008=calories(kcal), 1003=protein(g), 1004=fat(g), 1005=carbs(g), 1079=fiber(g), 2000=sugars(g), 1051=water(g) |
| Minerals |
1087=calcium(mg), 1089=iron(mg), 1090=magnesium(mg), 1091=phosphorus(mg), 1092=potassium(mg), 1093=sodium(mg), 1095=zinc(mg), 1098=copper(mg), 1101=manganese(mg), 1103=selenium(ug) |
| Vitamins | 1162=vitC(mg), 1165=B1(mg), 1166=B2(mg), 1167=B3(mg), 1175=B6(mg), 1177=folate(ug), 1178=B12(ug), 1106=vitA(ug), 1109=vitE(mg), 1114=vitD(ug), 1183=vitK(ug) |
| Lipids | 1253=cholesterol(mg), 1258=saturated(g), 1292=monounsat(g), 1293=polyunsat(g), 1257=trans(g), 4444=omega3(g), 5555=omega6(g) |
| Amino acids | 1210=tryptophan(g), 1212=isoleucine(g), 1213=leucine(g), 1214=lysine(g), 1219=valine(g) |
Food categories (ctg): 1=dairy, 2=spices, 3=baby foods, 4=fats/oils, 5=poultry, 6=soups/sauces, 7=sausages, 8=cereals, 9=fruits, 10=pork, 11=vegetables, 12=nuts/seeds, 13=beef, 14=beverages, 15=seafood, 16=legumes, 17=lamb/game, 18=baked, 19=sweets, 20=grains, 21=fast food, 22=meals, 25=snacks, 26=branded
get_food
Get a single food by ID with full nutrient data (120+ nutrients).
CODEBLOCK4
Request (optional body):
CODEBLOCK5
search_exercises
Search 5,000+ exercises with step-by-step instructions, tips, main/granular/synergist muscle targeting, equipment, and muscle activation percentages.
CODEBLOCK6
Request:
CODEBLOCK7
- -
q (required): Search query - INLINECODE54 : Language code for translated instructions/tips
- INLINECODE55 : 1-100, default 20
- INLINECODE56 : strengthtraining, strengthtraining.functional, stretching
- INLINECODE57 : abs, arms, back, calves, cardio, chest, feet, forearms, glutes, legs, neck, plyometrics, shoulders, stretching, weightlifting, yoga
- INLINECODE58 : Assisted, Band, Barbell, Battling Rope, Body weight, Bosu ball, Cable, Dumbbell, EZ Barbell, Hammer, Kettlebell, Leverage machine, Medicine Ball, Olympic barbell, Power Sled, Resistance Band, Roll, Rollball, Rope, Sled machine, Smith machine, Stability ball, Stick, Suspension, Trap bar, Vibrate Plate, Weighted, Wheel roller
- INLINECODE59 : Pectoralis Major Sternal Head, Deltoid Anterior, Biceps Brachii, Triceps Brachii, Latissimus Dorsi, Quadriceps, Hamstrings, Gluteus Maximus, Rectus Abdominis, Erector Spinae, etc.
Response: Array of exercises with exercise (name), info, instructions[], tips[], Target[], Synergist[], Equipment[], BodyPart[], MuscleDistribution (muscle -> 0.0-1.0).
get_exercise
Get a single exercise by ID.
CODEBLOCK8
search_dishes
Search 80,000+ international dishes/recipes with ingredients automatically matched to the food database for accurate nutrition.
CODEBLOCK9
Request:
CODEBLOCK10
Response: Dishes with desc, country, ingredient_count, normalized_ingredients[] (matched to food DB with scores), nutrients per 100g, portions.
search_barcode
Search branded food products by name.
CODEBLOCK11
Request:
CODEBLOCK12
Response: Branded products with desc, brandOwner, gtinUpc, marketCountry, nutrients, portions.
lookup_barcode
Look up a specific product by barcode number.
CODEBLOCK13
Example: INLINECODE81
nutrition_needs
Calculate personalized daily macro and micronutrient needs based on body measurements.
CODEBLOCK14
Request:
CODEBLOCK15
- -
weight: kg - INLINECODE83 : cm
- INLINECODE84 : years
- INLINECODE85 : m (male), f (female), p (pregnant), l (lactating)
- INLINECODE86 : 1=sedentary, 2=light, 3=moderate, 4=very active, 5=extra active
- INLINECODE87 : maintenance, deficit, surplus
- INLINECODE88 : kcal offset (for deficit/surplus)
- INLINECODE89 : percentage split (sum to 100)
Response: Map of nutrient ID -> daily need value, plus bmr, tdee, and macro breakdown.
Error Responses
CODEBLOCK16
| Status | Meaning |
|---|
| 401 | Invalid or missing API key |
| 429 |
Rate limit exceeded |
| 502 | Search service error |
Notes
- - All nutrient values are per 100g unless portions are specified
- Portions include weight in grams and description (e.g. "1 cup", "1 breast")
- Food search queries should be in English; set
locale to translate response names - Food database curated from USDA, NUTTAB (Australia), CNF2015 (Canada), MEXT (Japan), FRIDA (Denmark)
- 3 million+ branded food products with barcode lookup
- 80,000+ local recipes/dishes from 48 languages with ingredient matching
- Nutrient IDs follow USDA numbering with custom extensions (4444=omega-3, 5555=omega-6)
FitAPI — 最详细的食品与运动数据库API
向您的AI助手询问任何食品、营养素、运动或条形码信息——即可获得精确、科学级的数据,而非大语言模型的猜测。
三文鱼中含有多少欧米伽-3? — FitAPI从经过筛选的科学数据库中返回精确数值,而非训练数据的近似值。
设置 — 需要API密钥
在进行任何API调用之前,您需要一个API密钥。如果用户尚未配置,请引导他们完成设置:
- 1. 注册 访问 https://fitapi.fitnessrec.com — 免费账户,无需信用卡
- 获取API密钥 从控制面板 https://fitapi.fitnessrec.com/dashboard
- 配置此技能 使用API密钥
所有请求均通过 Authorization: Bearer {apiKey} 标头进行身份验证。如果收到 401 错误,说明密钥缺失或无效——请告知用户在控制面板中检查密钥。
500 | 9.99美元/年 |
| 企业 | 40,000 | 49.99美元/月 |
所有套餐均包含所有接口和全部47种语言。
完整交互式API文档(Swagger UI):https://fitapi.fitnessrec.com/api/docs
如何使用此API — 选择正确的工具
您有9个工具。不要对所有查询都使用 search_foods。 每个工具都有特定用途:
| 用户意图 | 使用的工具 | 原因 |
|---|
| 鸡胸肉含有什么? / 米饭的热量 | searchfoods | 基于名称的查询,返回每100克完整180种营养素+份量 |
| 含铁最高的食物 / 高蛋白低碳水 |
filterfoods | 按实际营养素值排序/排名——搜索无法做到 |
| 扫描此条形码 / 精确的UPC/EAN号码 | lookup_barcode | 直接条形码→产品查询 |
| 帮我找蛋白棒 / 品牌产品名称 | search_barcode | 按名称搜索300万+品牌产品 |
| 如何做硬拉? / 运动查询 | search_exercises | 返回说明、技巧、目标肌肉、器械 |
| 泰式炒面的食谱 / 菜品查询 | search_dishes | 8万+食谱,食材与营养数据库匹配 |
| 我需要多少蛋白质? / 每日目标 | nutrition_needs | 根据身体数据个性化计算宏量/微量营养素目标 |
推荐工作流程(串联使用以获得更好答案)
1. 膳食规划 — 规划一份500卡路里以下的高蛋白午餐
- 1. nutritionneeds — 获取用户的每日目标(如果已知身体数据)
- filterfoods — 查找符合标准的食物:filter=1003 > 25 AND 1008 < 200, sort=1003:desc
- 提供含份量和宏量营养素的选项
2. 食谱营养分解 — 凯撒沙拉有多少卡路里?
- 1. searchdishes — 查找食谱,获取包含匹配食物ID和克数的 normalizedingredients
- 每种食材包含 matchedid — 使用 getfood 检索任何需要检查的食材的完整营养素详情
- 菜品本身已包含每100克的汇总 nutrients
3. 饮食对比 — 三文鱼和鲭鱼哪个欧米伽-3更多?
- 1. 对每种食物使用 search_foods(返回完整180种营养素,欧米伽-3的营养素ID为 4444)
- 直接比较 nutrients.4444.value 字段
4. 营养素缺口分析 — 我摄入的铁足够吗?
- 1. nutritionneeds — 获取每日铁需求量(营养素 1089)
- searchfoods 查找用户记录的食物——汇总每种食物的铁含量
- 比较总量与需求量
5. 条形码扫描 — 这是什么产品?
- 1. 使用UPC/EAN号码的 lookupbarcode 进行直接匹配
- 如无匹配,回退使用产品名称的 searchbarcode
6. 运动编程 — 哑铃胸部训练
- 1. 使用 bodyparts: [chest], equipments: [Dumbbell] 的 searchexercises
- 结果包含肌肉激活百分比(MuscleDistribution)——利用这些数据构建覆盖所有肌群的均衡训练计划
重要提示:search_foods 已返回完整数据
searchfoods 返回每种食物的全部180种营养素、份量和元数据。搜索后无需再调用 getfood——数据完全相同。仅在已有食物ID时使用 getfood(例如来自食谱的 normalizedingredients)。
您将获得
- - 16,000+ 种食品,每种含180种营养素——每种维生素、矿物质、氨基酸、脂肪酸——来自5个国际数据库(USDA、NUTTAB、CNF2015、MEXT、FRIDA)
- 300万+ 品牌产品 — 扫描或搜索任何条形码(UPC/EAN)获取营养信息
- 80,000+ 本地食谱,来自48种语言——食材与营养数据库匹配,确保准确的宏量营养素
- 5,000+ 种运动 — 分步说明、技巧、主要/精细/协同肌肉、器械和肌肉激活百分比
- 智能筛选 — 含铁最高的食物、高蛋白低脂海鲜、最多欧米伽-3——按实际营养素值排序,而非关键词匹配
- 个性化每日需求 — 基于身体数据和目标计算精确的宏量/微量营养素目标
- 48种语言 — 食品名称、运动说明和食谱数据原生翻译
为什么不直接问大语言模型?
大语言模型估算。FitAPI确知。当您问鸡胸肉含多少蛋白质时,大语言模型从训练数据猜测约31克。FitAPI从USDA数据库返回每100克22.5克——实际测量值。对于严肃的营养追踪,差异至关重要。
工具
search_foods
按名称搜索食品。返回每100克和份量的营养素数据。
POST https://fitapi.fitnessrec.com/api/v1/foods/search
请求:
json
{q: chicken breast raw, locale: en, limit: 5}
- - q(必填):英文搜索查询
- locale:翻译名称的语言代码(en, tr, de, fr, es, it, pt, nl, ru, ja, ko, zh, ar, hi, pl, sv, da, fi, cs, ro, hu, bg, el, hr, sr, sk, sl, bs, sq, et, lt, lv, is, nn, vi, th, id, ms, fil, uk, fa, he, bn, ka, az, mn, ur, af)
- limit:1-100,默认20
响应: 食品数组,包含 id、desc(名称)、nutrients 映射(ID -> {name, unit, value per 100g})、portions 映射。
filter_foods
按营养素值筛选和排序食品。用于哪种食物含X最多或富含X的食物查询。始终包含排序。
POST https://fitapi.fitnessrec.com/api/v1/foods/filter
请求:
json
{filter: 1003 > 20 AND 1004 < 5, sort: 1003:desc, limit: 10}
- - filter(必填):MeiliSearch筛选表达式。运算符:=, !=, >, >=, <, <=, TO, AND, OR, NOT
- sort(必填):nutrientId:desc 或 nutrientId:asc
- q:可选文本搜索以缩小结果范围
- locale:语言代码
- limit:1-100,默认20
示例查询:
- - 最高蛋白质:filter=1003 > 0, sort=1003:desc
- 最多欧米伽-3:filter=4444 > 0, sort=4444:desc
- 最多欧米伽-6:filter=5555 > 0, sort=5555:desc
- 低热量+高纤维:filter=1008 < 100 AND 1079 > 5, sort=1079:desc
- 高铁:filter=1089 > 3, sort=1089:desc
- 高蛋白海鲜:filter=ctg = 15 AND 1003 > 20, sort=1003