FoodData Central · Schema

FoodSearchCriteria

Request body schema for the POST /v1/foods/search endpoint to search for foods by keyword.

FoodNutritionUSDAGovernmentHealthDietNutrientsPublic Domain

Properties

Name Type Description
query string Search terms to use in the search. The string may also include standard search operators.
dataType array Optional. Filter on a specific data type; specify one or more values in an array.
pageSize integer Optional. Maximum number of results to return for the current page. Default is 50.
pageNumber integer Optional. Page number to retrieve.
sortBy string Optional. Specify one of the possible values to sort by that field.
sortOrder string Optional. The sort direction for the results.
brandOwner string Optional. Filter results based on the brand owner of the food. Only applies to Branded Foods.
View JSON Schema on GitHub

JSON Schema

search-criteria.json Raw ↑
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://fdc.nal.usda.gov/schemas/search-criteria.json",
  "title": "FoodSearchCriteria",
  "description": "Request body schema for the POST /v1/foods/search endpoint to search for foods by keyword.",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "Search terms to use in the search. The string may also include standard search operators.",
      "example": "Cheddar cheese"
    },
    "dataType": {
      "type": "array",
      "description": "Optional. Filter on a specific data type; specify one or more values in an array.",
      "items": {
        "type": "string",
        "enum": ["Branded", "Foundation", "Survey (FNDDS)", "SR Legacy"]
      },
      "minItems": 1,
      "maxItems": 4,
      "example": ["Foundation", "SR Legacy"]
    },
    "pageSize": {
      "type": "integer",
      "description": "Optional. Maximum number of results to return for the current page. Default is 50.",
      "minimum": 1,
      "maximum": 200,
      "example": 25
    },
    "pageNumber": {
      "type": "integer",
      "description": "Optional. Page number to retrieve.",
      "example": 2
    },
    "sortBy": {
      "type": "string",
      "description": "Optional. Specify one of the possible values to sort by that field.",
      "enum": ["dataType.keyword", "lowercaseDescription.keyword", "fdcId", "publishedDate"]
    },
    "sortOrder": {
      "type": "string",
      "description": "Optional. The sort direction for the results.",
      "enum": ["asc", "desc"]
    },
    "brandOwner": {
      "type": "string",
      "description": "Optional. Filter results based on the brand owner of the food. Only applies to Branded Foods.",
      "example": "Kar Nut Products Company"
    }
  }
}