Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Rate limit: 1,000 requests per hour per IP by default; exceeding it blocks the key for an hour (429). X-RateLimit-Limit and X-RateLimit-Remaining headers show usage.
- Data is public domain (CC0); USDA asks for citation of FoodData Central.
Endpoints
Search foods
- A read over POST (a GET form with query parameters also exists); dataType must be an array.
Get a food
Get several foods
- Unknown IDs are dropped silently; no matches is an empty list.
List foods
- A read over POST.