Overview

FoodData Central is the USDA's authoritative nutritional database API, giving access to detailed nutrient profiles for hundreds of thousands of foods including branded products, raw ingredients, and restaurant items. You need a free API key from the USDA's FoodData website to make requests. It is an excellent choice for building calorie trackers, meal planners, or diet analysis tools.

Beginner Tip

Register for a free API key at https://fdc.nal.usda.gov/api-key-signup.html — it is issued instantly and lets you make up to 3,600 requests per hour per IP address.

Available Data

The kind of data this API exposes, based on its documentation. We could not call the endpoint to confirm the exact field names.

recipe name and ingredients
nutritional values
calorie count
serving size
preparation time
country name and code

Example Response

Illustrative shape only — we were not able to call this endpoint (it requires credentials or exposes no public sample URL), so the fields below show the kind of data this API returns rather than a recorded response.

JSON Response · Illustrative
{
  "recipe": "Chicken Stir Fry",
  "calories": 380,
  "protein_g": 32,
  "carbs_g": 28,
  "fat_g": 14,
  "ingredients": [
    "chicken breast",
    "bell pepper",
    "soy sauce",
    "garlic"
  ],
  "prep_time_minutes": 20
}

Field Reference

fdcId Unique FoodData Central identifier for the food item.
description Human-readable name or description of the food.
dataType Category of the food entry (e.g., Branded, SR Legacy, Foundation).
foodNutrients List of nutrient objects each containing nutrient name, unit, and amount per 100g.
brandOwner Company that owns the branded food product (only present for Branded data type).
servingSize Standard serving size in grams or milliliters.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://api.nal.usda.gov/fdc/v1/foods/search?query=cheddar+cheese&api_key=YOUR_API_KEY";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

403 Forbidden Missing or invalid API key in the request.
Append ?api_key=YOUR_API_KEY to every request URL or pass it as the X-Api-Key header.
Too many results, wrong food type A broad search query like 'apple' returns thousands of entries from different data sources.
Use the dataType parameter to filter results: dataType=SR+Legacy for raw ingredients or dataType=Branded for packaged foods.
Nutrient not present in response Not every food entry contains every nutrient; some fields may be missing or null.
Always check that the nutrient array contains the nutrient ID you need before accessing its value.

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Health
Difficulty Intermediate
Listing details not endpoint-verified

Related Tags

Similar APIs

View All →