{
  "openapi": "3.1.0",
  "info": {
    "title": "Food Nutrition Information API",
    "version": "1.0.0",
    "description": "Nutrition facts by food name: calories, macronutrients and key micronutrients per serving.\n\nSearch foods by name and get nutrition facts per serving: calories, macronutrients and key micronutrients, for fresh produce and packaged products. Built for diet, meal-planning and health apps.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/foodNutritionInformation.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/food-nutrition-information"
  },
  "servers": [
    {
      "url": "https://food-nutrition-information.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "Food",
      "description": "Food Nutrition Information API belongs to the Food category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/food/{id}": {
      "get": {
        "operationId": "getFood",
        "summary": "Get Food",
        "description": "Get Food endpoint of the Food Nutrition Information API. Costs 5 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/food-nutrition-information/get-food"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "1750340"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "fdcId": 1750340,
                  "description": "Cheese, cheddar",
                  "dataType": "Foundation",
                  "publicationDate": "4/1/2019",
                  "foodCategory": {
                    "description": "Dairy and Egg Products"
                  },
                  "foodNutrients": [
                    {
                      "nutrient": {
                        "id": 1008,
                        "name": "Energy",
                        "unitName": "kcal"
                      },
                      "amount": 403
                    },
                    {
                      "nutrient": {
                        "id": 1003,
                        "name": "Protein",
                        "unitName": "g"
                      },
                      "amount": 22.9
                    },
                    {
                      "nutrient": {
                        "id": 1004,
                        "name": "Total lipid (fat)",
                        "unitName": "g"
                      },
                      "amount": 33.3
                    },
                    {
                      "nutrient": {
                        "id": 1005,
                        "name": "Carbohydrate, by difference",
                        "unitName": "g"
                      },
                      "amount": 3.09
                    },
                    {
                      "nutrient": {
                        "id": 1087,
                        "name": "Calcium, Ca",
                        "unitName": "mg"
                      },
                      "amount": 710
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/foods/search": {
      "get": {
        "operationId": "searchFoods",
        "summary": "Search Foods",
        "description": "Search Foods endpoint of the Food Nutrition Information API. Costs 5 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/food-nutrition-information/search-foods"
        },
        "parameters": [
          {
            "name": "brandOwner",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Kraft Heinz"
          },
          {
            "name": "pageNumber",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "1"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "10"
          },
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "cheddar cheese"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "totalHits": 1240,
                  "currentPage": 1,
                  "totalPages": 124,
                  "pageSize": 10,
                  "foods": [
                    {
                      "fdcId": 1750340,
                      "description": "Cheese, cheddar",
                      "dataType": "Foundation",
                      "brandOwner": "",
                      "publishedDate": "2019-04-01",
                      "foodNutrients": [
                        {
                          "nutrientId": 1008,
                          "nutrientName": "Energy",
                          "unitName": "KCAL",
                          "value": 403
                        },
                        {
                          "nutrientId": 1003,
                          "nutrientName": "Protein",
                          "unitName": "G",
                          "value": 22.9
                        },
                        {
                          "nutrientId": 1004,
                          "nutrientName": "Total lipid (fat)",
                          "unitName": "G",
                          "value": 33.3
                        },
                        {
                          "nutrientId": 1005,
                          "nutrientName": "Carbohydrate, by difference",
                          "unitName": "G",
                          "value": 3.09
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 5 tokens per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}