ChowAPI is now in open beta — sign up and start building today.
c
ChowAPI
Blog
guideusdareference

USDA FoodData Central API: The Complete Developer Guide

ChowAPI Team·

USDA FoodData Central API: The Complete Developer Guide

If you are building anything that involves food nutrition data — a calorie tracker, a recipe app, a meal planner — you will likely encounter the USDA FoodData Central database. It is the most authoritative source of nutrition data in the United States, and its API is free to use.

This guide covers everything you need to know about the FDC API: what it offers, how it works, its data model, and tips for working with it effectively.

What Is USDA FoodData Central?

FoodData Central (FDC) is a unified food composition database maintained by the U.S. Department of Agriculture. It replaced the older USDA National Nutrient Database (NDB) in 2019 and consolidates multiple data sources into one system.

The database contains over 400,000 food entries with detailed nutrient profiles. It is public domain, meaning you can use the data in commercial applications without licensing fees.

The API is available at https://api.nal.usda.gov/fdc/v1/ and requires a free API key from fdc.nal.usda.gov.

API Endpoints

The FDC API provides four main endpoints:

Food Search - GET /v1/foods/search

Search for foods by keyword. Returns a paginated list of results with basic nutrient data.

curl "https://api.nal.usda.gov/fdc/v1/foods/search?query=cheddar+cheese&api_key=YOUR_KEY"

Food Details - GET /v1/food/{fdcId}

Get the full nutrient profile for a single food by its FDC ID.

curl "https://api.nal.usda.gov/fdc/v1/food/170379?api_key=YOUR_KEY"

Multiple Foods - POST /v1/foods

Retrieve details for multiple foods in a single request by passing an array of FDC IDs.

Foods List - GET /v1/foods/list

A paginated list of all foods in the database, useful for bulk data syncing.

Data Types: Foundation vs Branded vs Survey

Understanding the FDC data types is important because they have different characteristics:

Foundation Foods (~8,000 entries) are generic, whole foods like "chicken breast, raw" or "apple, fuji, with skin." These have the most complete nutrient profiles, often with 150+ nutrients per food, sampled and analyzed in USDA labs. This is the gold standard for nutrition data.

Branded Foods (~380,000 entries) come from the Global Branded Food Products Database (GFPD). These are specific commercial products like "Cheerios, General Mills" with nutrition data pulled from product labels. Coverage is broad but nutrient profiles typically reflect what appears on the Nutrition Facts panel (15-20 nutrients).

Survey Foods (FNDDS, ~8,000 entries) are foods as consumed, designed for dietary surveys. These represent prepared foods with specific cooking methods, e.g. "chicken breast, grilled, no skin." Useful for research but often overlaps with Foundation Foods for app development.

SR Legacy (~7,000 entries) is the old Standard Reference dataset, frozen in 2018. Still available but no longer updated. Use Foundation Foods instead.

Working with the Response Format

The FDC API returns nutrient data as nested arrays of objects with numeric IDs. Here's what to expect and how to work with it:

Nutrient extraction requires iterating through the foodNutrients array and matching on nutrient.number or nutrient.name. For example, protein is nutrient number 203, total fat is 204, carbohydrates is 205. A single food detail response can be 50KB+ of JSON.

Tip: Build a mapping table of the nutrient IDs you care about early on. Most consumer apps only need 15-30 of the 150+ available nutrients.

Units and serving sizes vary by data type. Foundation Foods report nutrients per 100g. Branded Foods sometimes use different reference amounts. You'll want to normalize to a consistent base (typically per-100g) in your data layer.

Search is keyword-based. The API matches on exact keywords, so misspellings won't return results. If your app has user-facing search, consider adding a fuzzy matching layer on your end.

Rate limits exist but are not precisely documented. The API can be slower during peak hours. For production apps with high throughput needs, consider caching responses or syncing data locally.

Tips for Building with the USDA API

  1. Cache aggressively. Food nutrition data changes infrequently. Cache responses for at least 24 hours.
  2. Use the bulk endpoints. If you need multiple foods, use POST /v1/foods instead of making individual requests.
  3. Filter by data type. Use the dataType parameter to limit results to Foundation or Branded foods depending on your use case.
  4. Build a nutrient map. Create a lookup from nutrient number to a human-readable name. This makes your code much easier to maintain.
  5. Handle missing data. Not every food has every nutrient. Default to null rather than zero when a nutrient is missing.

When You Want a Higher-Level API

If you want fuzzy search, barcode lookup, serving sizes, SDKs, and a flat response format without building that infrastructure yourself, ChowAPI provides those features on top of USDA data (and other sources like Open Food Facts and restaurant chains).

Here is the same cheddar cheese search with ChowAPI:

curl "https://api.chowapi.dev/v1/search?q=cheddar+cheese" \
  -H "Authorization: Bearer chow_live_your_key"

The response includes a nutrients object with named fields (calories, protein, fat, carbs) instead of nested arrays with numeric IDs.

Key features ChowAPI adds:

  • Fuzzy, typo-tolerant search — "chiken brest" finds chicken breast
  • Barcode lookupGET /v1/barcode/{upc} returns the product directly
  • Flat response format — nutrients are named fields, no nested arrays to parse
  • TypeScript and Python SDKsnpm install chowapi or pip install chowapi
  • MCP server for AInpx chowapi-mcp connects Claude and other LLMs to live nutrition data
  • Data quality scoring — every food has a data_quality score so you know how complete each entry is

When to Use USDA Direct vs a Wrapper

The USDA API is a great fit when:

  • You need bulk data downloads (full database exports available in CSV and JSON)
  • You are doing academic research and need to cite USDA directly
  • You need access to 150+ nutrients or experimental food composition data
  • Budget is zero and you need the most authoritative source

A higher-level API like ChowAPI fits when:

  • You are building a consumer app and need fast, user-friendly lookups
  • Your users search by typing food names (and typos are inevitable)
  • You need barcode scanning
  • You want SDKs and a flat response format
  • You are integrating with AI models

Get Started

The USDA FoodData Central API is an excellent public resource. If you want to build directly on it, start at fdc.nal.usda.gov.

If you want a production-ready layer on top, sign up for ChowAPI. Credit packs start at $5 for 5,000 calls. Full access to 780K+ foods with 34 nutrients per item.