Nextrient API v1
Access USDA nutrition data for 8,000+ foods via a simple REST API.
Free
$0
- 500 calls / day
- No API key required. Rate limited by IP.
Pro
$19/mo
- 50,000 calls / day
- API key required. 50,000 calls/day.
Endpoint
There is a single lookup endpoint. The slug is the URL-friendly food name you see on each food page — for example, chicken-breast-meat-only-cooked-roasted.
GET /api/v1/food/{slug}Authentication
Free tier — no authentication needed. Requests are rate-limited by IP address.
Pro tier — include your API key as a request header:
X-API-Key: your_api_keyResponse
Successful responses return HTTP 200 with a data envelope containing the full food record.
{
"data": {
"fdcId": 171477,
"slug": "chicken-breast-meat-only-cooked-roasted",
"displayName": "Chicken Breast Meat Only (Cooked, Roasted)",
"category": "Poultry Products",
"dataType": "sr_legacy",
"nutrients": [
{ "nutrientId": 1008, "name": "Energy", "amount": 165, "unit": "KCAL" },
{ "nutrientId": 1003, "name": "Protein", "amount": 31.02, "unit": "G" }
],
"portions": [
{ "description": "1 cup, chopped or diced", "gramWeight": 140 }
]
}
}Quick Start
curl
curl https://nextrient.com/api/v1/food/chicken-breast-meat-only-cooked-roastedJavaScript
const response = await fetch(
'https://nextrient.com/api/v1/food/chicken-breast-meat-only-cooked-roasted'
)
const { data } = await response.json()
console.log(`${data.displayName}: ${data.nutrients[0].amount} kcal`)Python
import requests
response = requests.get(
'https://nextrient.com/api/v1/food/chicken-breast-meat-only-cooked-roasted'
)
data = response.json()['data']
print(f"{data['displayName']}: {data['nutrients'][0]['amount']} kcal")Rate Limiting
Every response includes headers so you can track your remaining quota without needing to count requests yourself:
X-RateLimit-Limit— your daily call allowanceX-RateLimit-Remaining— calls left todayX-RateLimit-Reset— Unix timestamp when the counter resets (UTC midnight)
Exceeding your limit returns HTTP 429 RATE_LIMITED. Counters reset at midnight UTC.
Error Responses
All errors use the same envelope: { "error": { "code": "...", "message": "..." } }
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_SLUG | Invalid characters in the food slug |
| 404 | NOT_FOUND | No food found matching that slug |
| 429 | RATE_LIMITED | Daily request limit exceeded |
| 500 | INTERNAL_ERROR | Unexpected server error |
Need more than 500 calls a day?
Pro keys are provisioned manually while the billing system is in development.
Get a Pro API Key