{"openapi":"3.1.0","info":{"title":"Mealary API","version":"1.0.0","description":"Nutrition analysis and FDA Nutrition Facts label generation, computed from USDA FoodData Central. Deterministic FDA 21 CFR 101.9 rounding; every value cites a USDA source.","contact":{"name":"Mealary","url":"https://mealary.com/docs/api"}},"servers":[{"url":"https://mealary.com/api/v1"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"paths":{"/analyze":{"post":{"summary":"Analyze a recipe","operationId":"analyzeRecipe","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Recipe"}}}},"responses":{"200":{"description":"Per-serving nutrition facts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Analysis"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing/invalid API key"},"429":{"description":"Rate limit or monthly quota exceeded"}}}},"/label":{"post":{"summary":"Generate an FDA Nutrition Facts label (SVG)","operationId":"generateLabel","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabelRequest"}}}},"responses":{"200":{"description":"SVG label (image/svg+xml) or JSON with an svg field. Free/sandbox keys are watermarked."},"400":{"description":"Invalid request"}}}},"/foods/search":{"get":{"summary":"Search USDA foods","operationId":"searchFoods","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":10}}],"responses":{"200":{"description":"Matching foods"}}}},"/foods/{fdcId}":{"get":{"summary":"Get a USDA food's nutrient profile","operationId":"getFood","parameters":[{"name":"fdcId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Per-100g nutrients"},"404":{"description":"Not found"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key as a bearer token."},"apiKeyHeader":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Recipe":{"type":"object","required":["ingredients"],"properties":{"ingredients":{"type":"array","items":{"type":"string"},"example":["2 cups all-purpose flour","1 cup sugar","2 large eggs"]},"servings":{"type":"integer","default":1,"example":12},"servingLabel":{"type":"string","example":"1 muffin (60g)"},"title":{"type":"string"}}},"LabelRequest":{"allOf":[{"$ref":"#/components/schemas/Recipe"},{"type":"object","properties":{"format":{"type":"string","enum":["svg","json"],"default":"svg"},"width":{"type":"integer"}}}]},"Analysis":{"type":"object","properties":{"servings":{"type":"integer"},"nutrition_facts":{"type":"object","description":"FDA-rounded per-serving values keyed by nutrient."},"allergens":{"type":"array","items":{"type":"string"}},"contains_statement":{"type":"string"},"ingredient_statement":{"type":"string"},"sources":{"type":"array","items":{"type":"object","properties":{"fdcId":{"type":"integer"},"description":{"type":"string"}}}},"warnings":{"type":"array","items":{"type":"string"}},"request_id":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"docs":{"type":"string"},"request_id":{"type":"string"}}}}}}}}