Knowledge Graph

The Food Knowledge Graph API provides access to a database of food information that includes a hierarchy of food items, nutrition facts and food categorizations. It includes generic food items, packaged products, menu items and recipes, which can be looked up using full text search or foreign identifiers such as barcodes.

Concepts

Items

Items represent food items like a tomato. Subtypes include Products, Recipes, Restaurant Dishes. Items are related to each other by a parent and child relationship. For instance, brown rice is a type of rice. Items can be composed of other items which allows for the creation of variations of an item like a baked potato with sour cream or without. They are associated with nutrition facts.

idunique identifier
namename of the item
detailsextra details to disambiguate the name
descriptionlong form description of the item
brandbrand object if the item is branded
nutrition_factslist of nutrition fact objects
text_ingredientsIngredients list in a textual format, usually coming from a packaged product or recipe
ingredientslist of ingredient objects
translationsmapping from locale strings to translations of the name, details and description fields
categorizationsmapping specifying if the item contains peanuts, is organic and etc.
typethe type of item, including packaged product, recipe
is_genericbit specifying if the item is generic (ex: Sandwich) or concrete (ex: Katz's Reuben Sandwich) instance
is_privatespecifies if the item is only viewable by the current user

Nutrition Facts

Items may optionally include one or more nutrition facts. A nutrition fact contains a set of nutrition values for a given serving size.

{
"id": "127be913-2336-4d52-9d8f-5632baf02be4",
"item": "001a758f-134f-47d0-b456-f7ae0ec5eca5",
"servings_per_package": null,
"serving": {
"amount": 11.0,
"grams": 40.0,
"unit": {
"id": "a7e4c596-3db9-4223-a943-e88cece92755",
"singular_name": "piece",
"plural_name": "pieces",
"measure_type": null,
"measure_system": null,
"granularity": 0.25
}
},
"nutrition": {
"calories": 130.0,
"total_fat": 0.0,
"saturated_fat": 0.0,
"trans_fat": 0.0,
"total_carb": 29.0,
"sugars": 18.0,
"fiber": 0.0,
"protein": 2.0,
"cholesterol": 0.0,
"sodium": 20.0,
"calcium": 0.0,
"iron": 0.0,
"vitamin_a_iu": 0.0,
"vitamin_c": 0.0
},
"is_default": true
}

Units

A unit is associated with a Nutrition Facts serving. Common units include measurements like cups, tablespoons, fluid ounces, grams, etc.. Also, units can include things which are countable or the prepared item like cookie, chips, pretzel, chicken strip, or potato wedge.

Brands

Packaged or restaurant items may contain a brand.

{
"id": "5a423ab6-05dc-44a9-95bf-b043e0dfd944",
"name": "Frito Lay, Sunflower Seeds, Original",
"brand": {
"id": "9576167f-b839-4983-b57c-5e3b771f65d8",
"name": "Frito-Lay Company",
"manufacturer": null,
"type": null
}
}

Hierarchy

Items are organized into a hierarchy, allowing you to determine the type of an item and also find a more specific version of a generic item.

Beverage > Soda > Cola > Coca Cola Zero
{
"id": "e64f6d59-f067-47df-b88b-e0a32d909979",
"name": "Chocolate Milk",
"parents": [
{
"id": "ca87a313-ac7f-4cb8-bec8-fc8c51cf0096",
"name": "Milk"
},
{
"id": "5864fa90-a7d6-47fc-92e9-6bd81255693a",
"name": "Flavored Milk"
}
],
"children": [
{
"id": "3011dcb2-c6cf-4568-8033-b53117002be8",
"name": "Chocolate Milk",
"details": "whole milk based",
"display_name": "Whole"
},
{
"id": "6b50caec-9d34-49bf-9def-4a8a1981fc5e",
"name": "Chocolate Milk",
"details": "reduced fat (2%) milk based",
"display_name": "Reduced fat, 2% milk"
},
{
"id": "08963672-e51b-4203-87f8-cff0354d7eea",
"name": "Chocolate Milk",
"details": "lowfat (1%) milk based",
"display_name": "Lowfat, 1% milk"
}
]
}

Categorizations

Items can be categorized using the categorizations mapping

{
"name": "Cheese",
"categorizations": {
"milk": "Y"
}
}

Foreign Identifiers

Items can be accessed using foreign identifiers such as UPC barcodes or USDA identifiers.

Translations

Items can be internationalized using the translations attribute, which maps from a locale string to translations of item fields into that locale.

{
"name": "Cottage Cheese",
"translations": {
"es": {
"name": "Queso Requesón"
}
}
}