canonical: https://jentic.com/apis/nutritionix.com/nutritionix

# Nutritionix API

The Nutritionix API exposes a verified nutrition database covering common foods, branded packaged products, and restaurant menu items, with detailed macro and micronutrient breakdowns. Its standout feature is natural-language parsing - a developer can send a phrase like '2 eggs and a slice of toast' and receive structured nutrient data back, alongside the same treatment for exercise calorie estimation. It also exposes instant search for foods, lookup by item or UPC, and a directory of restaurant locations and brands. The surface is small at seven endpoints, which makes it well suited to nutrition logging, fitness coaching, and meal-planning agents.

## For AI agents

Turn natural-language food and exercise descriptions into structured nutrition and calorie data, plus search a verified database of common, branded, and restaurant foods.

## Scope

Does not handle meal-plan generation, grocery delivery, or fitness device sync - use for nutrition lookup and natural-language meal and exercise parsing only.

## Capabilities

- Parse natural-language meal descriptions into per-food macro and micronutrient values
- Estimate calories burned for natural-language exercise descriptions using user weight and duration
- Run instant typeahead-style search across common, branded, and restaurant foods
- Look up a specific food item by Nutritionix ID or UPC barcode
- Retrieve the master list of nutrient codes used across responses
- Find restaurant locations near a coordinate or postcode for menu-aware recommendations

## Use cases

### Natural-Language Food Logging

Power a nutrition-tracking app or chatbot that accepts free-text meal entries - for example 'a banana and a cup of oat milk' - and returns calories, macronutrients, and serving information per food. Nutritionix handles the tokenisation, quantity parsing, and nutrient lookup against its verified database, so the developer does not need a custom NLP pipeline. Setup is typically under a day with the natural-language endpoint and an x-app-id/x-app-key pair.

Example prompt: Send POST /natural/nutrients with the query 'two scrambled eggs and avocado toast' and return total calories and protein.

### Exercise Calorie Estimation

Estimate calories burned for free-text exercise descriptions like '30 minutes of cycling' using weight, age, and gender to scale results. This is well suited to fitness journaling apps, coaching agents, and wearable companion experiences that need a quick estimate without bundling a metabolic-equation library. The endpoint accepts the same conversational style as the food parser, keeping the integration consistent.

Example prompt: Send POST /natural/exercise with 'ran 5 km in 28 minutes' and a weight of 75 kg, then return the estimated calories burned.

### Restaurant Menu Lookups

Build a recommendation flow that helps users pick lower-calorie items at chain restaurants by searching foods filtered to a specific brand and pulling locations nearby. Nutritionix indexes thousands of branded restaurant items, so an agent can answer 'what are the lightest menu items at Sweetgreen?' with structured nutrient data rather than scraped HTML.

Example prompt: Call GET /search/instant with 'sweetgreen kale caesar', then GET /search/item to retrieve the full nutrient profile for the top match.

### Agent-Driven Nutrition Coaching

Let an AI agent answer 'how many calories were in what I just ate?' by chaining the natural-nutrients endpoint with item lookups, all behind a single intent. Through Jentic, the agent searches by intent and gets only the operations it needs, with API credentials handled by the platform.

Example prompt: Search Jentic for 'log a meal in natural language', load the operation, and return total kilojoules for the user's lunch description.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /natural/nutrients | Parse a natural-language meal into nutrients |
| POST | /natural/exercise | Estimate calories burned from a natural-language exercise |
| GET | /search/instant | Instant food search across common and branded items |
| GET | /search/item | Look up an item by Nutritionix ID or UPC |
| GET | /locations | Search restaurant locations near a coordinate |
| GET | /brands/{brandId} | Retrieve brand details by ID |

## Key resources

- **Natural-Language Parsing** — Convert free-text meal and exercise descriptions to structured nutrient and calorie data.
- **Search** — Instant typeahead search and direct item/UPC lookup across common, branded, and restaurant foods.
- **Locations and Brands** — Find restaurant locations near a point and retrieve branded directory entries.
- **Nutrient Reference** — Master list of nutrient codes for parsing responses.

## Why Jentic

- **Setup:** Wiring Nutritionix by hand means sending two headers on every call, x-app-id and x-app-key, against trackapi.nutritionix.com and handling the request plumbing yourself. Through Jentic you install once, import Nutritionix from the API Directory, store both credentials once, and your agent calls it.
- **Permission scoping:** Nutritionix drives its core lookups through the request body and query, so scope the agent to the operations it needs, such as natural-language nutrient parsing or instant search, and leave the rest out. You choose the operations it may call, so it only reaches the endpoints you list.
- **Credential handling:** Your Nutritionix x-app-id and x-app-key are stored once, encrypted, by your own Jentic One instance and injected at execution time. They never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'log a meal in natural language' or 'estimate calories burned', and Jentic returns the matching Nutritionix operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Edamam Nutrition API** — Recipe and food nutrition analysis with detailed diet labels - competing nutrition data source.
- **Spoonacular Food API** — Food, recipe, and meal-planning API with broader recipe coverage than Nutritionix.
- **OpenAI API** — Pair with a chat-completion model to extract intent before calling Nutritionix natural-nutrients.

## FAQ

### What authentication does the Nutritionix API use?

The API requires two API key headers: x-app-id and x-app-key, issued from the Nutritionix developer dashboard. There is no OAuth flow - both values are sent on every call. Through Jentic, both keys live in the encrypted vault and are injected at execution time so the agent never holds them directly.

### Can I parse a free-text meal into nutrients?

Yes. Send the text in the 'query' field of POST /natural/nutrients and the API returns one foods entry per recognised item with calories, macronutrients, and serving information. The same pattern applies to POST /natural/exercise for workout descriptions.

### What are the rate limits for the Nutritionix API?

The OpenAPI spec does not embed explicit limits. Free developer keys are throttled to a low daily call ceiling and the team's published policy is to upgrade to a paid plan for higher throughput. Treat HTTP 429 as a signal to back off.

### How do I look up a barcode through Jentic?

Run pip install jentic, then search for 'look up a food by UPC'. Jentic returns GET /search/item with its input schema; pass the upc parameter and execute. The x-app-id and x-app-key headers are attached automatically from your stored credentials in your Jentic One instance.

### Does the API include exercise tracking?

Yes - POST /natural/exercise estimates calories burned from a free-text description such as 'biked for 45 minutes', adjusted by user weight, age, height, and gender supplied in the request body.

### Can I limit what my agent is allowed to do with the Nutritionix API?

Yes. Because Jentic One is self-hosted, you set the rules, and only the Nutritionix operations you list are exposed to the agent. You can allow just natural-language nutrient parsing (POST /natural/nutrients) and instant search (GET /search/instant) while leaving out exercise estimation, item and UPC lookup, restaurant locations, or brand details. The agent reaches only the endpoints you permit, and your stored x-app-id and x-app-key are injected at execution time rather than handed to the agent.
