Please enable JavaScript to signup for an api.data.gov API key.
United States Department of Agriculture
Agricultural Research Service

USDA Food Composition Databases
Loading signup form...

NDB API


Announcement

Version 2 of the foods report is now available. See the documentation for details.

Overview

Our API provides REST access to the USDA Food Composition Databases. It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites.

To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on the NDB home page. This documentation provides the detailed definitions and descriptions you need for understanding the data elements referenced in the API documentation. Additionally, you should have some idea of how the NDB online web application works as the API is based on this application. Check here for more information about that.


What's Available

The API provides two kinds of reports: Food Reports which list nutrient values for a specified food and Nutrient Reports which provide lists of foods and their nutrient values for a specified set of nutrients. An example of a Food Report from the web application is this one for chedder cheese while an example of a Nutrient Report is this one for protein.

Both reports require the use of unique keys for foods, nutrients and food groups. The unique key for a food is called its NDB Number (ndbno). The unique key for a nutrient is its nutrient nunber (nutrient_no). To assist you in discovering and retrieving these unique ids, two other types of requests allow you to retrieve lists of nutrients, foods or foods groups and to perform free-text searches for foods.


Gaining Access

Anyone may access and use the API. However, a data.gov API key must be incorporated into each API request. Sign up now if you do not have a key.


Rate Limits

We currently limit the number of API requests to a default rate of 1,000 requests per hour per IP address and feel that is adequate for most applications. Exceeding this limit will cause your API key to be temporarily blocked for one hour. More detailed information on rate limits may be found at api.data.gov. Please contact us if you still feel you need a higher request rate setting.


Licensing

USDA food composition data is in the public domain, there is no copyright and no permission is needed for its use. We would appreciate it if you would list us as the source of the data and when possible we would like to see the product which uses the data or be notified of its use. The suggested citations are:



Note: Release numbers and years change as new versions are released. For more information, please visit the NDL FAQ


Examples and Further Details

Select the links below for more detailed information on how to formulate API requests and understand responses.