{"openapi":"3.0.3","info":{"title":"Offline Natural-Language Nutrition, Macros & Calories Burned API","version":"1.0.57","description":"Sub-millisecond offline 294-food USDA v2 meal nutrition estimator (11 nutrients plus caffeine, alcohol, glycemic load, satiety score, cooking-state scaling, allergens, dietary tags, recipe servings, custom foods, and DL-1 typo recovery), Mifflin-St Jeor BMR/TDEE macro & hydration coaching, and Compendium MET calories-burned & exercise metadata calculation."},"servers":[{"url":"https://api.tinplate.dev","description":"Production Edge Gateway"}],"components":{"schemas":{"NutritionEstimateResponseData":{"type":"object","properties":{"estimated":{"type":"boolean"},"serving_size_g":{"type":"number"},"calories":{"type":"number"},"protein_g":{"type":"number"},"carbohydrates_total_g":{"type":"number"},"fat_total_g":{"type":"number"},"fat_saturated_g":{"type":"number"},"fiber_g":{"type":"number"},"sugar_g":{"type":"number"},"sodium_mg":{"type":"number"},"potassium_mg":{"type":"number"},"cholesterol_mg":{"type":"number"},"caffeine_mg":{"type":"number"},"alcohol_g":{"type":"number"},"glycemic_load":{"type":"string","enum":["low","medium","high"]},"satiety_score":{"type":"integer","minimum":0,"maximum":100},"allergens":{"type":"array","items":{"type":"string"}},"dietary_tags":{"type":"array","items":{"type":"string"}},"servings":{"type":"integer"},"per_serving":{"type":"object","properties":{"serving_size_g":{"type":"number"},"calories":{"type":"number"},"protein_g":{"type":"number"},"carbohydrates_total_g":{"type":"number"},"fat_total_g":{"type":"number"},"fat_saturated_g":{"type":"number"},"fiber_g":{"type":"number"},"sugar_g":{"type":"number"},"sodium_mg":{"type":"number"},"potassium_mg":{"type":"number"},"cholesterol_mg":{"type":"number"},"caffeine_mg":{"type":"number"},"alcohol_g":{"type":"number"}},"required":["serving_size_g","calories","protein_g","carbohydrates_total_g","fat_total_g","fat_saturated_g","fiber_g","sugar_g","sodium_mg","potassium_mg","cholesterol_mg"]},"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"serving_size_g":{"type":"number"},"calories":{"type":"number"},"protein_g":{"type":"number"},"carbohydrates_total_g":{"type":"number"},"fat_total_g":{"type":"number"},"fat_saturated_g":{"type":"number"},"fiber_g":{"type":"number"},"sugar_g":{"type":"number"},"sodium_mg":{"type":"number"},"potassium_mg":{"type":"number"},"cholesterol_mg":{"type":"number"},"caffeine_mg":{"type":"number"},"alcohol_g":{"type":"number"},"cooking_state":{"type":"string"},"allergens":{"type":"array","items":{"type":"string"}}},"required":["label","name","serving_size_g","calories","protein_g","carbohydrates_total_g","fat_total_g","fat_saturated_g","fiber_g","sugar_g","sodium_mg","potassium_mg","cholesterol_mg"]}},"unmatched_segments":{"type":"array","items":{"type":"string"}}},"required":["estimated","serving_size_g","calories","protein_g","carbohydrates_total_g","fat_total_g","fat_saturated_g","fiber_g","sugar_g","sodium_mg","potassium_mg","cholesterol_mg","caffeine_mg","alcohol_g","items","unmatched_segments"]},"NutritionEstimateRequest":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":2048,"example":"200g chicken breast with 150g white rice and 1 avocado","description":"Natural-language food or multi-item meal description with optional weights (g, kg, oz, lb, ml), cooking states (raw, cooked, grilled, fried, breaded, boiled, baked, steamed), recipe serving splits, or quantities (cups, slices, scoops, eggs)."},"servings":{"type":"integer","minimum":1,"maximum":100,"example":4,"description":"Optional explicit recipe serving count for computing per_serving macro splits alongside total meal values."},"custom_foods":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"aliases":{"type":"array","items":{"type":"string","minLength":1,"maxLength":80},"maxItems":12},"kcal_per_unit":{"type":"number","minimum":0,"maximum":5000},"protein_per_unit":{"type":"number","minimum":0,"maximum":500},"carbs_per_unit":{"type":"number","minimum":0,"maximum":500,"default":0},"fat_per_unit":{"type":"number","minimum":0,"maximum":500,"default":0},"saturated_fat_per_unit":{"type":"number","minimum":0,"maximum":200,"default":0},"fiber_per_unit":{"type":"number","minimum":0,"maximum":200,"default":0},"sugar_per_unit":{"type":"number","minimum":0,"maximum":500,"default":0},"sodium_mg_per_unit":{"type":"number","minimum":0,"maximum":20000,"default":0},"potassium_mg_per_unit":{"type":"number","minimum":0,"maximum":20000,"default":0},"cholesterol_mg_per_unit":{"type":"number","minimum":0,"maximum":5000,"default":0},"grams_per_unit":{"type":"number","minimum":1,"maximum":5000,"default":100},"unit_label":{"type":"string","minLength":1,"maxLength":32,"default":"serving"},"caffeine_mg_per_unit":{"type":"number","minimum":0,"maximum":2000},"alcohol_g_per_unit":{"type":"number","minimum":0,"maximum":200},"allergens":{"type":"array","items":{"type":"string","enum":["eggs","dairy","gluten","fish","shellfish","nuts","peanuts","soy","sesame"]},"maxItems":9},"vegan":{"type":"boolean"},"vegetarian":{"type":"boolean"},"gluten_free":{"type":"boolean"},"dairy_free":{"type":"boolean"}},"required":["name","kcal_per_unit","protein_per_unit"],"additionalProperties":false},"maxItems":50,"description":"Optional per-request custom or branded foods merged ahead of the built-in 294-food USDA v2 database."}},"required":["text"],"additionalProperties":false},"CaloriesBurnedResponseData":{"type":"object","properties":{"matched":{"type":"boolean"},"name":{"type":"string","nullable":true},"met":{"type":"number","nullable":true},"weight_kg":{"type":"number"},"duration_minutes":{"type":"number"},"calories_per_hour":{"type":"number"},"total_calories":{"type":"number"},"exercise":{"type":"object","nullable":true,"properties":{"name":{"type":"string"},"type":{"type":"string"},"muscle":{"type":"string"},"equipment":{"type":"string"},"difficulty":{"type":"string"},"instructions":{"type":"string"}},"required":["name","type","muscle","equipment","difficulty","instructions"]}},"required":["matched","name","met","weight_kg","duration_minutes","calories_per_hour","total_calories","exercise"]},"CaloriesBurnedRequest":{"type":"object","properties":{"activity":{"type":"string","minLength":1,"maxLength":120,"example":"running","description":"Physical activity or exercise name (e.g. 'running', 'cycling', 'swimming', 'yoga', 'bench press', 'boxing', 'hiit')."},"duration_minutes":{"type":"number","minimum":1,"maximum":720,"default":60,"example":30,"description":"Duration of the activity in minutes (1–720, default 60)."},"weight_kg":{"type":"number","minimum":30,"maximum":250,"default":70,"example":75,"description":"Bodyweight in kilograms (30–250, default 70)."}},"required":["activity"],"additionalProperties":false},"NutritionTargetsResponseData":{"type":"object","properties":{"bmr":{"type":"integer"},"tdee":{"type":"integer"},"target_calories":{"type":"integer"},"goal":{"type":"string","enum":["cut","maintain","bulk","keto","high_protein"]},"activity_level":{"type":"string","enum":["sedentary","light","moderate","active","very_active"]},"protein_g":{"type":"integer"},"carbs_g":{"type":"integer"},"fat_g":{"type":"integer"},"fiber_g":{"type":"integer"},"water_target_ml":{"type":"integer"},"macro_split_pct":{"type":"object","properties":{"protein":{"type":"number"},"carbs":{"type":"number"},"fat":{"type":"number"}},"required":["protein","carbs","fat"]}},"required":["target_calories","goal","protein_g","carbs_g","fat_g","fiber_g","water_target_ml","macro_split_pct"]},"NutritionTargetsRequest":{"type":"object","properties":{"weight_kg":{"type":"number","minimum":25,"maximum":300,"example":78,"description":"Bodyweight in kilograms (25–300). Required unless target_calories is supplied."},"height_cm":{"type":"number","minimum":105,"maximum":250,"example":180,"description":"Height in centimeters (105–250) for Mifflin-St Jeor BMR/TDEE computation."},"age_years":{"type":"integer","minimum":12,"maximum":110,"example":28,"description":"Age in years (12–110) for Mifflin-St Jeor BMR/TDEE computation."},"sex":{"type":"string","enum":["male","female"],"example":"male","description":"Biological sex used for the Mifflin-St Jeor BMR offset ('male' or 'female')."},"activity_level":{"type":"string","enum":["sedentary","light","moderate","active","very_active"],"example":"moderate","description":"Daily physical activity multiplier tier (default 'moderate')."},"goal":{"type":"string","enum":["cut","maintain","bulk","keto","high_protein"],"default":"maintain","example":"cut","description":"Target macro split preset ('cut', 'maintain', 'bulk', 'keto', 'high_protein')."},"target_calories":{"type":"number","minimum":1000,"maximum":8000,"example":2400,"description":"Optional direct daily calorie override (1000–8000 kcal) bypassing TDEE scaling."}},"additionalProperties":false},"ResponseMeta":{"type":"object","required":["request_id"],"properties":{"request_id":{"type":"string","format":"uuid"},"ms":{"type":"integer","minimum":0},"version":{"type":"string","example":"1.0.57"},"ignored_fields":{"type":"array","items":{"type":"string"}}}},"ErrorEnvelope":{"type":"object","required":["ok","error","meta"],"properties":{"ok":{"type":"boolean","enum":[false]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","example":"invalid_input"},"message":{"type":"string","example":"Request body failed validation"}}},"meta":{"$ref":"#/components/schemas/ResponseMeta"}}}}},"paths":{"/v1/nutrition/estimate":{"post":{"tags":["44_NUTRITION_MACROS"],"summary":"Estimate 11 USDA nutrients plus caffeine, alcohol, glycemic load, satiety score, allergens, dietary tags, and recipe per-serving macros from natural-language meal descriptions offline","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NutritionEstimateRequest"},"example":{"text":"200g chicken breast with 150g white rice and 1 avocado"}}}},"responses":{"200":{"description":"Full 11-nutrient totals, caffeine/alcohol, glycemic load, satiety score, allergens, dietary tags, per-item breakdown, and unmatched segments","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/NutritionEstimateResponseData"},"meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["ok","data","meta"]}}}},"400":{"description":"Invalid input or malformed JSON request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing or invalid authentication credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request payload exceeds subscribed plan byte cap","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/nutrition/calories-burned":{"post":{"tags":["44_NUTRITION_MACROS"],"summary":"Calculate calories burned per hour and total calories for physical activities using Compendium MET values plus exercise muscle and equipment metadata","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaloriesBurnedRequest"},"example":{"activity":"running","duration_minutes":30,"weight_kg":75}}}},"responses":{"200":{"description":"MET calories-burned estimate and optional exercise metadata","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CaloriesBurnedResponseData"},"meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["ok","data","meta"]}}}},"400":{"description":"Invalid input or malformed JSON request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing or invalid authentication credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request payload exceeds subscribed plan byte cap","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/nutrition/targets":{"post":{"tags":["44_NUTRITION_MACROS"],"summary":"Calculate Mifflin-St Jeor BMR & TDEE, goal-preset daily macro targets (cut, maintain, bulk, keto, high_protein), fiber target, and bodyweight hydration target offline","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NutritionTargetsRequest"},"example":{"weight_kg":78,"height_cm":180,"age_years":28,"sex":"male","activity_level":"moderate","goal":"cut"}}}},"responses":{"200":{"description":"BMR, TDEE, daily calorie/macro split, fiber target, and hydration target","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/NutritionTargetsResponseData"},"meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["ok","data","meta"]}}}},"400":{"description":"Invalid input or malformed JSON request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing or invalid authentication credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request payload exceeds subscribed plan byte cap","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}}}}