Free Nutrition API for Developers: How to Build Apps with Nutrola's Food Data
A developer guide to building nutrition-aware applications with Nutrola's free nutrition API. Covers endpoints, authentication, code examples in Python, JavaScript, and cURL, rate limits, and comparisons with Nutritionix, Edamam, and USDA APIs.
Building a nutrition-aware application used to require assembling your own food database from scratch, licensing expensive datasets, or scraping unreliable sources. Today, nutrition APIs provide structured, programmatic access to comprehensive food databases with macronutrient, micronutrient, and serving-size data delivered as clean JSON. This guide walks developers through the landscape of nutrition APIs, with a focus on how to get started with Nutrola's free tier and how it compares to alternatives.
Whether you are building a meal planning app, a fitness tracker, a research tool, a recipe analyzer, or an AI assistant that answers nutrition questions, this guide gives you the technical details to choose an API and start making requests in minutes.
Nutrition API Landscape Overview
Before diving into implementation, here is a comparison of the major nutrition APIs available to developers in 2026.
| API | Free Tier | Rate Limit (Free) | Foods in Database | Barcode Scanning | Food Recognition (AI) | Pricing (Paid) |
|---|---|---|---|---|---|---|
| Nutrola API | Yes | 500 requests/day | 900,000+ | Yes | Yes (add-on) | From $29/month |
| USDA FoodData Central | Yes (fully free) | 1,000/hour per key | 370,000+ | No | No | Free |
| Nutritionix API | Yes (limited) | 50 requests/day | 1,000,000+ | Yes | No | From $299/month |
| Edamam API | Yes | 100 requests/day | 900,000+ | No | No | From $19/month |
| FatSecret Platform API | Yes | 5,000 requests/day | 500,000+ | Yes | No | Free (with attribution) |
| Open Food Facts API | Yes (fully free) | Reasonable use | 3,000,000+ | Yes | No | Free |
| Spoonacular | Yes | 150 requests/day | 500,000+ | No | No | From $29/month |
Getting Started with the Nutrola API
Step 1: Create a Developer Account
Visit the Nutrola Developer Portal at developers.nutrola.com to create a free account. After email verification, you will receive an API key on your dashboard. The free tier includes 500 requests per day, access to the full food database, and text-based food search. AI food recognition endpoints are available on paid tiers.
Step 2: Authentication
All API requests require your API key in the request header. The key is passed via the X-Api-Key header.
X-Api-Key: your_api_key_here
The API uses HTTPS exclusively. All requests to HTTP endpoints will receive a 301 redirect to HTTPS. Do not embed your API key in client-side code; always proxy requests through your backend server.
Step 3: Base URL
All endpoints are served from:
https://api.nutrola.com/v1/
Responses are in JSON format with UTF-8 encoding. The API follows RESTful conventions with standard HTTP status codes.
Core Endpoints
Search Foods
Search the food database by text query. Returns matching foods with nutritional data.
Endpoint: GET /v1/foods/search
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | Search term (e.g., "grilled chicken breast") |
| limit | integer | No | Results per page (default: 10, max: 50) |
| offset | integer | No | Pagination offset (default: 0) |
| type | string | No | Filter by type: "common", "branded", "restaurant" |
| language | string | No | Language code (default: "en"). Supports: en, es, de, fr, pt, ja, ko, zh |
Example Request (cURL):
curl -X GET "https://api.nutrola.com/v1/foods/search?query=grilled+chicken+breast&limit=5" \
-H "X-Api-Key: your_api_key_here"
Example Request (Python):
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://api.nutrola.com/v1"
response = requests.get(
f"{BASE_URL}/foods/search",
headers={"X-Api-Key": API_KEY},
params={
"query": "grilled chicken breast",
"limit": 5
}
)
data = response.json()
for food in data["foods"]:
print(f"{food['name']}: {food['calories']} kcal per {food['serving_size']}{food['serving_unit']}")
Example Request (JavaScript / Node.js):
const API_KEY = "your_api_key_here";
const BASE_URL = "https://api.nutrola.com/v1";
async function searchFoods(query) {
const url = new URL(`${BASE_URL}/foods/search`);
url.searchParams.append("query", query);
url.searchParams.append("limit", "5");
const response = await fetch(url, {
headers: { "X-Api-Key": API_KEY }
});
const data = await response.json();
return data.foods;
}
searchFoods("grilled chicken breast").then(foods => {
foods.forEach(food => {
console.log(`${food.name}: ${food.calories} kcal per ${food.serving_size}${food.serving_unit}`);
});
});
Example Response:
{
"foods": [
{
"id": "nf_001234",
"name": "Chicken Breast, Grilled, Skinless",
"type": "common",
"calories": 165,
"protein_g": 31.0,
"carbohydrates_g": 0.0,
"fat_g": 3.6,
"fiber_g": 0.0,
"sugar_g": 0.0,
"sodium_mg": 74,
"serving_size": 100,
"serving_unit": "g",
"serving_description": "100 grams",
"alt_servings": [
{
"description": "1 medium breast (196g)",
"multiplier": 1.96
},
{
"description": "1 oz (28g)",
"multiplier": 0.28
}
],
"source": "USDA SR Legacy",
"updated": "2026-01-15"
}
],
"total_results": 47,
"offset": 0,
"limit": 5
}
Get Food by ID
Retrieve detailed nutritional data for a specific food item by its Nutrola ID.
Endpoint: GET /v1/foods/{food_id}
Example (cURL):
curl -X GET "https://api.nutrola.com/v1/foods/nf_001234" \
-H "X-Api-Key: your_api_key_here"
Response includes full macro and micronutrient profile (30+ nutrients), all available serving sizes, ingredient list (for branded and restaurant items), allergen flags, dietary tags (vegan, gluten-free, halal, kosher), and source attribution.
Get Food by Barcode
Look up a packaged food product by its UPC or EAN barcode.
Endpoint: GET /v1/foods/barcode/{code}
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | UPC (12-digit) or EAN (13-digit) barcode |
Example (Python):
response = requests.get(
f"{BASE_URL}/foods/barcode/041331092609",
headers={"X-Api-Key": API_KEY}
)
food = response.json()
print(f"{food['name']}: {food['calories']} kcal per {food['serving_description']}")
Analyze Natural Language Input
Parse a natural-language food description and return structured nutritional data. This endpoint handles quantities, units, preparation methods, and multiple items in a single string.
Endpoint: POST /v1/foods/analyze
Request Body:
{
"query": "2 scrambled eggs with a slice of whole wheat toast and half an avocado",
"language": "en"
}
Example (Python):
response = requests.post(
f"{BASE_URL}/foods/analyze",
headers={
"X-Api-Key": API_KEY,
"Content-Type": "application/json"
},
json={
"query": "2 scrambled eggs with a slice of whole wheat toast and half an avocado"
}
)
result = response.json()
for item in result["items"]:
print(f"{item['quantity']} {item['unit']} {item['name']}: {item['calories']} kcal")
print(f"Total: {result['total']['calories']} kcal")
Example Response:
{
"items": [
{
"name": "Scrambled Eggs",
"quantity": 2,
"unit": "large",
"calories": 182,
"protein_g": 12.2,
"carbohydrates_g": 2.4,
"fat_g": 13.6,
"food_id": "nf_002891"
},
{
"name": "Whole Wheat Toast",
"quantity": 1,
"unit": "slice",
"calories": 81,
"protein_g": 3.9,
"carbohydrates_g": 13.8,
"fat_g": 1.1,
"food_id": "nf_003401"
},
{
"name": "Avocado",
"quantity": 0.5,
"unit": "medium",
"calories": 120,
"protein_g": 1.5,
"carbohydrates_g": 6.4,
"fat_g": 11.0,
"food_id": "nf_000892"
}
],
"total": {
"calories": 383,
"protein_g": 17.6,
"carbohydrates_g": 22.6,
"fat_g": 25.7
}
}
AI Food Recognition (Paid Tier)
Submit a food photograph for AI-powered recognition and nutritional analysis.
Endpoint: POST /v1/foods/recognize
Request: Multipart form data with the image file, or a JSON body with a base64-encoded image.
Example (Python):
with open("meal_photo.jpg", "rb") as f:
response = requests.post(
f"{BASE_URL}/foods/recognize",
headers={"X-Api-Key": API_KEY},
files={"image": ("meal.jpg", f, "image/jpeg")}
)
result = response.json()
for item in result["detected_items"]:
print(f"{item['name']} ({item['confidence']:.1%}): {item['calories']} kcal")
Response includes detected food items with confidence scores, bounding box coordinates, estimated portion sizes, nutritional breakdown per item, and total meal nutritional summary.
Rate Limits and Error Handling
Rate Limits by Tier
| Tier | Daily Requests | Requests/Second | AI Recognition | Price |
|---|---|---|---|---|
| Free | 500 | 5 | Not included | $0 |
| Starter | 5,000 | 10 | 100/day | $29/month |
| Pro | 50,000 | 25 | 1,000/day | $99/month |
| Enterprise | Custom | Custom | Custom | Contact sales |
Rate Limit Headers
Every response includes rate limit headers:
X-RateLimit-Limit: 500
X-RateLimit-Remaining: 487
X-RateLimit-Reset: 1710374400
Error Responses
The API uses standard HTTP status codes with descriptive error bodies.
{
"error": {
"code": "rate_limit_exceeded",
"message": "Daily request limit of 500 exceeded. Resets at 00:00 UTC.",
"status": 429
}
}
| Status Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad request (invalid parameters) |
| 401 | Unauthorized (invalid or missing API key) |
| 404 | Food not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
Implement exponential backoff for 429 and 500 responses. A simple strategy is to wait 1 second after the first failure, 2 seconds after the second, 4 after the third, up to a maximum of 60 seconds.
Use Cases and Implementation Patterns
Meal Planning Applications
Build a meal planner that hits target macros by searching foods, calculating nutritional totals, and iterating until the meal plan meets the user's goals.
def find_foods_for_target(target_protein, target_calories):
"""Find protein-rich foods within calorie budget."""
response = requests.get(
f"{BASE_URL}/foods/search",
headers={"X-Api-Key": API_KEY},
params={
"query": "high protein",
"limit": 20,
"type": "common"
}
)
foods = response.json()["foods"]
# Filter by protein-to-calorie ratio
efficient_foods = [
f for f in foods
if f["protein_g"] / max(f["calories"], 1) > 0.15
]
return sorted(efficient_foods, key=lambda f: f["protein_g"], reverse=True)
Fitness App Integration
Pair with activity data to show users their calorie balance. Use the natural language endpoint for quick logging.
async function logMealFromText(description) {
const response = await fetch(`${BASE_URL}/foods/analyze`, {
method: "POST",
headers: {
"X-Api-Key": API_KEY,
"Content-Type": "application/json"
},
body: JSON.stringify({ query: description })
});
const data = await response.json();
// Store in your database
await db.meals.insert({
user_id: currentUser.id,
items: data.items,
total_calories: data.total.calories,
total_protein: data.total.protein_g,
timestamp: new Date()
});
return data;
}
Recipe Nutrition Calculator
Calculate the nutritional content of a recipe by looking up each ingredient and summing the values.
def analyze_recipe(ingredients):
"""
ingredients: list of strings like ["200g chicken breast", "1 cup brown rice", "2 tbsp olive oil"]
"""
recipe_nutrition = {"calories": 0, "protein_g": 0, "carbohydrates_g": 0, "fat_g": 0}
for ingredient in ingredients:
response = requests.post(
f"{BASE_URL}/foods/analyze",
headers={
"X-Api-Key": API_KEY,
"Content-Type": "application/json"
},
json={"query": ingredient}
)
data = response.json()
for item in data["items"]:
recipe_nutrition["calories"] += item["calories"]
recipe_nutrition["protein_g"] += item["protein_g"]
recipe_nutrition["carbohydrates_g"] += item["carbohydrates_g"]
recipe_nutrition["fat_g"] += item["fat_g"]
return recipe_nutrition
# Example usage
recipe = analyze_recipe([
"200g chicken breast",
"1 cup brown rice cooked",
"2 tablespoons olive oil",
"1 cup steamed broccoli"
])
print(f"Recipe total: {recipe['calories']} kcal, {recipe['protein_g']}g protein")
Research and Data Analysis
For academic research, use the API to build nutrition profiles for study populations or validate dietary assessment tools.
import pandas as pd
def build_nutrition_profile(food_log_df):
"""
food_log_df: DataFrame with columns ['food_description', 'date']
Returns DataFrame with full nutritional breakdown per entry.
"""
results = []
for _, row in food_log_df.iterrows():
response = requests.post(
f"{BASE_URL}/foods/analyze",
headers={
"X-Api-Key": API_KEY,
"Content-Type": "application/json"
},
json={"query": row["food_description"]}
)
data = response.json()
results.append({
"date": row["date"],
"description": row["food_description"],
"calories": data["total"]["calories"],
"protein_g": data["total"]["protein_g"],
"carbs_g": data["total"]["carbohydrates_g"],
"fat_g": data["total"]["fat_g"]
})
return pd.DataFrame(results)
Comparison with Alternative APIs
USDA FoodData Central API
The USDA API is completely free with no paid tiers, making it the default choice for academic and government projects. It covers approximately 370,000 foods across Foundation, SR Legacy, Survey (FNDDS), and Branded databases. Strengths include being the gold standard for US food composition data, the authority that other databases reference. Limitations include no natural language parsing (you must match food names to their specific database keys), no barcode lookup, no AI recognition, and the branded food data can be inconsistent because it relies on manufacturer submissions. The API documentation is functional but not developer-friendly by modern standards.
Best for: Academic research, government projects, applications that need authoritative reference data and have developer resources to handle the matching complexity.
Nutritionix API
Nutritionix has one of the largest food databases with strong coverage of restaurant and branded foods. Its natural language endpoint is mature and handles complex queries well. However, the free tier is extremely limited at 50 requests per day, and the paid plans start at $299 per month, which puts it out of reach for many independent developers and small startups. The API is well-documented and supports both text and barcode lookup.
Best for: Well-funded applications that need extensive restaurant food data and can afford the pricing.
Edamam API
Edamam offers nutrition analysis, recipe analysis, and food database APIs. The free tier provides 100 requests per day, which is workable for prototyping. Edamam's strength is its recipe analysis capability, which can parse a full recipe's ingredient list and return per-serving nutritional data. The database covers approximately 900,000 foods. Limitations include occasional inconsistencies in serving size data and a less intuitive developer experience compared to newer APIs.
Best for: Recipe-focused applications, meal planning tools that need recipe-level analysis.
FatSecret Platform API
FatSecret offers a generous free tier with 5,000 requests per day, making it attractive for bootstrapped projects. The trade-off is that you must display FatSecret branding and attribution in your application. The database covers approximately 500,000 foods with decent international coverage. The API supports OAuth 1.0 authentication, which is older and more complex to implement than API key or OAuth 2.0 approaches.
Best for: Budget-constrained projects that can accommodate attribution requirements and OAuth 1.0.
Open Food Facts API
Open Food Facts is a community-driven, open-source food database with over 3 million products, primarily packaged goods with barcode data. It is completely free and open (Open Database License). The API is straightforward for barcode lookups but less structured for nutritional search queries. Data quality varies because contributions are crowdsourced, though a community review process catches many errors.
Best for: Packaged food barcode scanning, projects that align with open-source principles, international packaged food coverage.
API Comparison Summary
| Feature | Nutrola | USDA | Nutritionix | Edamam | FatSecret | Open Food Facts |
|---|---|---|---|---|---|---|
| Free tier daily limit | 500 | 1,000/hr | 50 | 100 | 5,000 | Unlimited |
| Natural language parsing | Yes | No | Yes | Yes | No | No |
| AI food recognition | Yes (paid) | No | No | No | No | No |
| Barcode lookup | Yes | No | Yes | No | Yes | Yes |
| Multi-language support | 8 languages | English | English | English | 16 languages | 40+ languages |
| Recipe analysis | Via NLP | No | Yes | Yes | No | No |
| Micronutrient depth | 30+ nutrients | 60+ nutrients | 20+ nutrients | 25+ nutrients | 15+ nutrients | Varies |
| Authentication | API Key | API Key | API Key | App ID + Key | OAuth 1.0 | None (optional) |
Best Practices for Building Nutrition Apps
Cache aggressively
Nutritional data for common foods does not change frequently. Cache food search results and nutritional lookups on your backend for 24 to 72 hours to reduce API calls and improve response times.
Handle missing data gracefully
Not every food entry has complete micronutrient data. Design your UI to indicate when data is unavailable rather than displaying zeros, which users may misinterpret as "this food contains zero iron."
Validate user input before API calls
Trim whitespace, normalize units, and spell-check food names before sending them to the API. A well-formed query produces much better results than a typo-filled one.
Use the natural language endpoint when possible
Instead of building your own food name parser, use the /foods/analyze endpoint. It handles quantities ("2 cups"), preparation methods ("grilled"), and compound descriptions ("whole wheat toast with butter") better than most custom implementations.
Respect rate limits
Implement proper backoff logic. Batch operations where possible. Use webhooks or queues for high-volume operations rather than synchronous API calls.
Attribute data sources
Good practice (and sometimes a legal requirement depending on the API) is to attribute the data source. Display "Nutritional data provided by Nutrola" or the equivalent for whichever API you use.
Frequently Asked Questions
Is the Nutrola API really free?
Yes. The free tier provides 500 API requests per day at no cost, with no credit card required. This is sufficient for prototyping, small applications, and personal projects. The free tier includes text search, food lookup by ID, barcode scanning, and natural language analysis. AI food recognition from images is available on paid tiers starting at $29 per month.
What data format does the API return?
All responses are in JSON format with UTF-8 encoding. Nutritional values use standard units: kilocalories for energy, grams for macronutrients and fiber, milligrams for sodium and most minerals, and micrograms for vitamins where applicable.
Can I use the Nutrola API in a commercial application?
Yes. Both the free and paid tiers permit commercial use. The free tier requires Nutrola attribution in your application. Paid tiers include white-label options where no attribution is required.
How often is the food database updated?
The Nutrola food database is updated continuously for branded and restaurant foods, with USDA reference data synchronized within 30 days of USDA releases. Major database refreshes occur monthly, while individual food entries may be updated daily based on manufacturer changes, user-reported corrections, and new product launches.
Does the API support international foods?
Yes. The database covers foods from over 50 countries, with search available in 8 languages (English, Spanish, German, French, Portuguese, Japanese, Korean, and Chinese). International food coverage is a core priority for Nutrola, and the database includes regional dishes, local branded products, and cuisine-specific preparations that are often missing from US-centric databases.
Can I use the API for a mobile app?
Yes, but do not embed your API key directly in mobile client code, as it can be extracted from the app binary. Instead, set up a lightweight backend server that proxies requests to the Nutrola API and handles authentication. This also gives you a layer for caching and request management.
Is there a webhook or streaming option?
Currently, the API operates on a request-response model. Webhook support for asynchronous food recognition results (for large batch processing) is on the roadmap for 2026. For batch operations today, use the /v1/foods/analyze/batch endpoint, which accepts up to 20 items in a single request.
Conclusion
Nutrition APIs have made it practical for developers to build food-aware applications without the enormous overhead of maintaining a proprietary food database. Nutrola's API provides a generous free tier, comprehensive food coverage across international cuisines, natural language understanding, and optional AI food recognition, making it a strong choice for projects ranging from weekend prototypes to production applications.
The best API for your project depends on your specific needs: USDA for authoritative reference data, Nutritionix for deep restaurant coverage, Open Food Facts for open-source barcode data, or Nutrola for a balance of features, accuracy, and developer experience. In many cases, combining multiple APIs gives you the best coverage. Start with the free tier, validate it against your use case, and scale from there.
Ready to Transform Your Nutrition Tracking?
Join thousands who have transformed their health journey with Nutrola!