FDC

Returns a list of foods that matched search (query) keywords

Search for foods using keywords. Results can be filtered by dataType and there are options for result page sizes or sorting.

get/v1/foods/search

Request

  • Base URL: https://api.nal.usda.gov/fdc
  • URL: https://api.nal.usda.gov/fdc/v1/foods/search
  • Auth: API key in query parameter api_key

Query parameters

querystring required

One or more search terms. The string may include search operators

dataTypestring[]

Optional. Filter on a specific data type; specify one or more values in an array.

pageSizeinteger

Optional. Maximum number of results to return for the current page. Default is 50.

pageNumberinteger
Example:2

Optional. Page number to retrieve. The offset into the overall result set is expressed as (pageNumber * pageSize)

sortBy'dataType.keyword' | 'lowercaseDescription.keyword' | 'fdcId' | 'publishedDate'

Optional. Specify one of the possible values to sort by that field. Note, dataType.keyword will be dataType and lowercaseDescription.keyword will be description in future releases.

sortOrder'asc' | 'desc'

Optional. The sort direction for the results. Only applicable if sortBy is specified.

brandOwnerstring

Optional. Filter results based on the brand owner of the food. Only applies to Branded Foods

Response

List of foods that matched search terms

foodSearchCriteriaobject

A copy of the criteria that were used in the search.

totalHitsinteger

The total number of foods found matching the search criteria.

currentPageinteger

The current page of results being returned.

totalPagesinteger

The total number of pages found matching the search criteria.

Example response

[
  {
    "totalHits": 1034,
    "foods": [
      {
        "fdcId": 45001529,
        "dataType": "Branded",
        "description": "BROCCOLI",
        "foodNutrients": [
          {
            "number": 303,
            "name": "Iron, Fe",
            "amount": 0.53,
            "unitName": "mg",
            "derivationCode": "LCCD",
            "derivationDescription": "Calculated from a daily value percentage per serving size measure"
          }
        ],
        "publicationDate": "4/1/2019",
        "brandOwner": "Supervalu, Inc.",
        "gtinUpc": "041303020937",
        "additionalDescriptions": "Coon; sharp cheese; Tillamook; Hoop; Pioneer; New York; Wisconsin; Longhorn"
      }
    ]
  }
]

Changes

No recorded changes to this operation across all 1 revision of this API.