Direct API access with cURL examples and API key authentication
sk_live_ or sk_test_)All requests require an API key in the X-API-Key header:
curl -X POST https://app.avocavo.app/api/v2/nutrition/ingredient \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_test_YOUR_API_KEY_HERE" \
-d '{"ingredient": "1 cup brown rice"}'If you signed up with email/password (not OAuth):
NPM CLI Package:
Python Package:
Node.js/JavaScript:
⚠️ avocavo login and av.login() only work with OAuth (Google/GitHub) accounts
https://app.avocavo.app/api/v2/nutrition/
All endpoints use v2 (not v1). All requests are POST with JSON body.
POST /api/v2/nutrition/ingredient
curl -X POST https://app.avocavo.app/api/v2/nutrition/ingredient \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_test_YOUR_API_KEY" \
-d '{
"ingredient": "1 cup brown rice"
}'{
"success": true,
"ingredient": "1 cup brown rice",
"nutrition": {
"calories": 218.4,
"protein": 4.52,
"total_fat": 1.62,
"saturated_fat": 0.33,
"carbohydrates": 45.84,
"fiber": 3.51,
"sugar": 0.0,
"calcium": 19.5,
"iron": 1.03,
"sodium": 1.95,
"vitamin_a": null,
"vitamin_c": null
// ... 23 more nutrients
},
"metadata": {
"usda_match": {
"fdc_id": 168875,
"description": "Rice, brown, medium-grain, cooked"
},
"usda_link": "https://fdc.nal.usda.gov/fdc-app.html#/food-details/168875/nutrients",
"match_quality": "good",
"confidence": 0.611,
"processing_time_ms": 2.5
},
"parsing": {
"estimated_grams": 195.0,
"ingredient_name": "cooked brown rice"
}
}POST /api/v2/nutrition/batch
curl -X POST https://app.avocavo.app/api/v2/nutrition/batch \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_test_YOUR_API_KEY" \
-d '{
"ingredients": [
{"ingredient": "1 cup quinoa"},
{"ingredient": "4 oz grilled salmon"}
]
}'{
"success": true,
"batch_size": 2,
"results": [
{
"success": true,
"ingredient": "1 cup quinoa",
"nutrition": { "calories": 222.0, "protein": 8.14, ... },
"metadata": {
"usda_match": { "fdc_id": 168917, "description": "Quinoa, cooked" },
"usda_link": "https://fdc.nal.usda.gov/fdc-app.html#/food-details/168917"
}
},
{
"success": true,
"ingredient": "4 oz grilled salmon",
"nutrition": { "calories": 391.23, "protein": 68.74, ... },
"metadata": {
"usda_match": { "fdc_id": 169813, "description": "Salmon, red (sockeye), filets with skin, smoked" },
"usda_link": "https://fdc.nal.usda.gov/fdc-app.html#/food-details/169813"
}
}
],
"summary": {
"successful": 2,
"failed": 0,
"success_rate": 100.0,
"total_processing_time_ms": 7856.43
}
}POST /api/v2/nutrition/recipe
curl -X POST https://app.avocavo.app/api/v2/nutrition/recipe \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_test_YOUR_API_KEY" \
-d '{
"ingredients": [
"2 cups all-purpose flour",
"1 cup milk"
],
"servings": 8
}'{
"success": true,
"recipe": {
"servings": 8.0,
"total_ingredients": 2
},
"nutrition": {
"total": {
"calories": 1058.84,
"protein": 33.51,
"carbohydrates": 202.49,
// ... all nutrients for entire recipe
},
"per_serving": {
"calories": 132.35,
"protein": 4.19,
"carbohydrates": 25.31,
// ... per-serving breakdown
},
"ingredients": [
{
"ingredient": "2 cups all-purpose flour",
"nutrition": { "calories": 910.0, "protein": 25.82, ... },
"metadata": {
"usda_match": { "fdc_id": 168936, "description": "Wheat flour, white, all-purpose, enriched, unbleached" }
}
},
// ... other ingredients
]
}
}POST /api/v2/upc/ingredient
Search 4.4M+ products by UPC/barcode from USDA Branded Foods and Open Food Facts databases.
curl -X POST https://app.avocavo.app/api/v2/upc/ingredient \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_test_YOUR_API_KEY" \
-d '{"upc": "041196912395"}'{
"success": true,
"upc": "049000006346",
"product": {
"name": "Coca cola can cokes LG",
"brand": "The Coca-Cola Company-0049000000016",
"data_sources": ["usda_branded", "open_food_facts"],
"fdc_id": 354198,
"ingredients": "INGREDIENTS: CARBONATED WATER, HIGH FRUCTOSE CORN SYRUP...",
"categories": []
},
"nutrition": {
"coverage": "comprehensive",
"source": "open_food_facts",
"data": {
"calories": 39.4,
"protein": 0,
"fat": 0,
"carbohydrates": 11.0,
"sodium": 12700,
"serving_size": "100g serving",
"serving_size_grams": 100,
"per_100g": {
"calories": 39.4,
"protein": 0.0,
"fat": 0.0,
"carbohydrates": 11.0,
"sodium": 12.7
}
},
"note": "Raw nutrition values as stored in database - serving sizes vary by product"
},
"response_time_ms": 77
}POST /api/v2/upc/batch
Search multiple UPCs/barcodes in a single request for efficient batch processing.
curl -X POST https://app.avocavo.app/api/v2/upc/batch \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_test_YOUR_API_KEY" \
-d '{
"upcs": ["041196912395", "123456789012", "999999999999"]
}'{
"success": true,
"summary": {
"total": 3,
"found": 2,
"errors": 0
},
"results": [
{
"success": true,
"upc": "041196912395",
"product": {
"product_name": "Peanut Butter Crunch",
"brand": "LEWIS BAKE SHOP",
"sources": ["usda_branded", "open_food_facts"]
}
},
{
"success": true,
"upc": "123456789012",
"product": {
"product_name": "Test Product",
"brand": "Test Brand",
"sources": ["open_food_facts"]
}
},
{
"success": false,
"upc": "999999999999",
"error": "Product not found"
}
],
"processing_time_ms": 1146
}null = no USDA data available (not zero)
When a nutrient shows null, it means the USDA database doesn't have that information for this food, not that the food contains zero of that nutrient.
Every response includes:
| Plan | Monthly Calls | Batch Size | Rate Limit |
|---|---|---|---|
| Free | 500 calls | 3 ingredients | 60/minute |
| Starter ($9/mo) | 5K calls | 10 ingredients | 300/minute |
| Pro ($29/mo) | 25K calls | 25 ingredients | 600/minute |
{
"success": false,
"error": "invalid_api_key",
"message": "The provided API key is not valid"
}