Technical Docs
Ask or search…
K

Common Foods Search

The commonFoods query allows users to search for any type of common food. Within the search, food can be filtered by using tags.
Common foods are known as the most intake foods on a daily basis. Among these common foods, we can find apples, cookies, milk, rice, sugar, noodles, etc.

Characteristics

Within the common food search you are able to:

How to calculate the nutrient according to a food portion

Common food nutrients are per each 100g. The value can be different depending on the portion of each food. For example, the weight of a small banana can be 20g, while a big banana can weigh 30g. To calculate the nutrients, use the following equation:
nutrientvalueweight/100nutrient value *weight/100
Where:
  • weight is equivalent the gramWeightfield included within the portions object

Available Arguments

Define at least one argument within the query.
Argument Name
Type
Description
query
Query
Name or keyword of the food. It is possible to add more than one value. The query is case insensitive.
filter
Object that filters food according to different criteria. Use this object to filter:
  • Id
  • externalId
  • Barcode
  • Name
  • Tags
  • Nutrients
  • mealTime
  • Ingredients
after
String
See pagination
before
String
See pagination
first
String
Retrieves the first results from the list.
last
String
See pagination

Available Fields

Field Name
Type
Description
id
ID
Id of the food
description
String
Description of the food
foodDataId
String
Food Id to use in the addFoodLog mutation
name
String
Name of the food
nutrients
nutrients
Object that retrieves the information of the nutrients of the food. For more information on how to use nutrients, see this example.
portions
portions
Object that retrieves the information of the food portions
tags
String
Displays the available tags

Pagination

The commonFood query supports the use of pagination. The following fields can be used
Query
pageInfo{
hasNextPage
hasPreviousPage
startCursor
endCursor
}

Example

Get the nutritional information of a specific food

Query
Result
{
commonFoods(
filter: {
id: "Q29tbW9uRm9vZE5vZGU6N2QyYTY0NDUtN2MwZi00ZTYxLTlkNjctYTA4ZWI2NDhlNTY3"
}
) {
edges {
node {
id
name
description
nutrients {
type
amount
name
unit
}
portions {
amount
gramWeight
modifier
}
}
}
}
}
{
"data": {
"commonFoods": {
"edges": [
{
"node": {
"id": "Q29tbW9uRm9vZE5vZGU6N2QyYTY0NDUtN2MwZi00ZTYxLTlkNjctYTA4ZWI2NDhlNTY3",
"name": "Milk crackers",
"description": "Crackers, milk",
"nutrients": [
{
"type": "VITAMIN_A_IU",
"amount": 58,
"name": "Vitamin A, IU",
"unit": "IU"
},
{
"type": "VITAMIN_K_PHYLLOQUINONE",
"amount": 3.8,
"name": "Vitamin K (phylloquinone)",
"unit": "UG"
},
{
"type": "CHOLINE_TOTAL",
"amount": 10.8,
"name": "Choline, total",
"unit": "MG"
},
{
"type": "FOLIC_ACID",
"amount": 70,
"name": "Folic acid",
"unit": "UG"
},
{
"type": "FOLATE_DFE",
"amount": 139,
"name": "Folate, DFE",
"unit": "UG"
},
{
"type": "FOLATE_FOOD",
"amount": 20,
"name": "Folate, food",
"unit": "UG"
},
{
"type": "SODIUM_NA",
"amount": 687,
"name": "Sodium, Na",
"unit": "MG"
},
{
"type": "TRYPTOPHAN",
"amount": 0.1,
"name": "Tryptophan",
"unit": "G"
},
{
"type": "THREONINE",
"amount": 0.221,
"name": "Threonine",
"unit": "G"
},
{
"type": "METHIONINE",
"amount": 0.138,
"name": "Methionine",
"unit": "G"
},
{
"type": "PHENYLALANINE",
"amount": 0.376,
"name": "Phenylalanine",
"unit": "G"
},
{
"type": "TYROSINE",
"amount": 0.237,
"name": "Tyrosine",
"unit": "G"
},
{
"type": "ALANINE",
"amount": 0.246,
"name": "Alanine",
"unit": "G"
},
{
"type": "GLUTAMIC_ACID",
"amount": 2.482,
"name": "Glutamic acid",
"unit": "G"
},
{
"type": "GLYCINE",
"amount": 0.264,
"name": "Glycine",
"unit": "G"
},
{
"type": "PROLINE",
"amount": 0.858,
"name": "Proline",
"unit": "G"
},
{
"type": "THIAMIN",
"amount": 0.538,
"name": "Thiamin",
"unit": "MG"
},
{
"type": "RIBOFLAVIN",
"amount": 0.418,
"name": "Riboflavin",
"unit": "MG"
},
{
"type": "DHA",
"amount": 0.001,
"name": "22:6 n-3 (DHA)",
"unit": "G"
},
{
"type": "PROTEIN",
"amount": 7.6,
"name": "Protein",
"unit": "G"
},
{
"type": "ASH",
"amount": 2.2,
"name": "Ash",
"unit": "G"
},
{
"type": "COPPER_CU",
"amount": 0.227,
"name": "Copper, Cu",
"unit": "MG"
},
{
"type": "MANGANESE_MN",
"amount": 0.552,
"name": "Manganese, Mn",
"unit": "MG"
},
{
"type": "IRON_FE",
"amount": 3.58,
"name": "Iron, Fe",
"unit": "MG"
},
{
"type": "MAGNESIUM",
"amount": 22,
"name": "Magnesium, Mg",
"unit": "MG"
},
{
"type": "PHOSPHORUS_P",
"amount": 303,
"name": "Phosphorus, P",
"unit": "MG"
},
{
"type": "WATER",
"amount": 4.7,
"name": "Water",
"unit": "G"
},
{
"type": "CALCIUM_CA",
"amount": 172,
"name": "Calcium, Ca",
"unit": "MG"
},
{
"type": "POTASSIUM_K",
"amount": 114,
"name": "Potassium, K",
"unit": "MG"
},
{
"type": "ZINC_ZN",
"amount": 0.67,
"name": "Zinc, Zn",
"unit": "MG"
},
{
"type": "ISOLEUCINE",
"amount": 0.289,
"name": "Isoleucine",
"unit": "G"
},
{
"type": "LEUCINE",
"amount": 0.541,
"name": "Leucine",
"unit": "G"
},
{
"type": "LYSINE",
"amount": 0.241,
"name": "Lysine",
"unit": "G"
},
{
"type": "CYSTINE",
"amount": 0.159,
"name": "Cystine",
"unit": "G"
},
{
"type": "VALINE",
"amount": 0.333,
"name": "Valine",
"unit": "G"
},
{
"type": "ARGININE",
"amount": 0.307,
"name": "Arginine",
"unit": "G"
},
{
"type": "HISTIDINE",
"amount": 0.167,
"name": "Histidine",
"unit": "G"
},
{
"type": "ASPARTIC_ACID",
"amount": 0.345,
"name": "Aspartic acid",
"unit": "G"
},
{
"type": "SERINE",
"amount": 0.399,
"name": "Serine",
"unit": "G"
},
{
"type": "NIACIN",
"amount": 4.43,
"name": "Niacin",
"unit": "MG"
},
{
"type": "FIBER_TOTAL_DIETARY",
"amount": 3.4,
"name": "Fiber, total dietary",
"unit": "G"
},
{
"type": "FATTY_ACIDS_TOTAL_SATURATED",
"amount": 2.912,
"name": "Fatty acids, total saturated",
"unit": "G"
},
{
"type": "FAT",
"amount": 13.77,
"name": "Total lipid (fat)",
"unit": "G"
},
{
"type": "CARBS",
"amount": 71.73,
"name": "Carbohydrate, by difference",
"unit": "G"
},
{
"type": "ENERGY",
"amount": 446,
"name": "Energy",
"unit": "KCAL"
},
{
"type": "SUGARS_TOTAL_INCLUDING_NLEA",
"amount": 10.32,
"name": "Sugars, total including NLEA",
"unit": "G"
},
{
"type": "FATTY_ACIDS_TOTAL_MONOUNSATURATED",
"amount": 5.485,
"name": "Fatty acids, total monounsaturated",
"unit": "G"
},
{
"type": "FATTY_ACIDS_TOTAL_POLYUNSATURATED",
"amount": 4.867,
"name": "Fatty acids, total polyunsaturated",
"unit": "G"
},
{
"type": "VITAMIN_B_12_ADDED",
"amount": 0,
"name": "Vitamin B-12, added",
"unit": "UG"
},
{
"type": "VITAMIN_E_ADDED",
"amount": 0,
"name": "Vitamin E, added",
"unit": "MG"
},
{
"type": "CHOLESTEROL",
"amount": 11,
"name": "Cholesterol",
"unit": "MG"
},
{
"type": "VITAMIN_C_TOTAL_ASCORBIC_ACID",
"amount": 0.2,
"name": "Vitamin C, total ascorbic acid",
"unit": "MG"
},
{
"type": "EPA",
"amount": 0.001,
"name": "20:5 n-3 (EPA)",
"unit": "G"
},
{
"type": "VITAMIN_B_12",
"amount": 0.08,
"name": "Vitamin B-12",
"unit": "UG"
},
{
"type": "PANTOTHENIC_ACID",
"amount": 0.407,
"name": "Pantothenic acid",
"unit": "MG"
},
{
"type": "VITAMIN_B_6",
"amount": 0.037,
"name": "Vitamin B-6",
"unit": "MG"
},
{
"type": "VITAMIN_D_D2_D3",
"amount": 0,
"name": "Vitamin D (D2 + D3)",
"unit": "UG"
},
{
"type": "SELENIUM_SE",
"amount": 15.9,
"name": "Selenium, Se",
"unit": "UG"
}
],
"portions": [
{
"amount": 1,
"gramWeight": 11,
"modifier": "cracker",
"unit": "undetermined"
},
{
"amount": 0.5,
"gramWeight": 14.2,
"modifier": "oz",
"unit": "undetermined"
}
]
}
}
]
}
}
}

Get the list of foods that contain "milk chocolate"

Query
Result
{
commonFoods(query: "milk chocolate", first: 1) {
edges {
node {
id
name
portions {
modifier
amount
gramWeight
}
nutrients {
type
amount
name
unit
}
}
}
}
}
{
"data": {
"commonFoods": {
"edges": [
{
"node": {
"id": "Q29tbW9uRm9vZE5vZGU6MWFkZjRlMmYtYjQxZi00YmNmLTg2M2MtNjcwYTAyYzMxY2Zi",
"name": "Milk chocolate candies",
"portions": [
{
"modifier": "cup chips",
"amount": 1,
"gramWeight": 168
},
{
"modifier": "bar (1.55 oz)",
"amount": 1,
"gramWeight": 44
},
{
"modifier": "bar, miniature",
"amount": 1,
"gramWeight": 7
}
],
"nutrients": [
{
"type": "FATTY_ACIDS_TOTAL_SATURATED",
"amount": 18.509,
"name": "Fatty acids, total saturated",
"unit": "G"
},
{
"type": "DHA",
"amount": 0,
"name": "22:6 n-3 (DHA)",
"unit": "G"
},
{
"type": "EPA",
"amount": 0,
"name": "20:5 n-3 (EPA)",
"unit": "G"
},
{
"type": "DPA",
"amount": 0,
"name": "22:5 n-3 (DPA)",
"unit": "G"
},
{
"type": "WATER",
"amount": 1.5,
"name": "Water",
"unit": "G"
},
{
"type": "FATTY_ACIDS_TOTAL_MONOUNSATURATED",
"amount": 7.186,
"name": "Fatty acids, total monounsaturated",
"unit": "G"
},
{
"type": "FATTY_ACIDS_TOTAL_POLYUNSATURATED",
"amount": 1.376,
"name": "Fatty acids, total polyunsaturated",
"unit": "G"
},
{
"type": "STIGMASTEROL",
"amount": 16,
"name": "Stigmasterol",
"unit": "MG"
},
{
"type": "BETA_SITOSTEROL",
"amount": 37,
"name": "Beta-sitosterol",
"unit": "MG"
},
{
"type": "CAFFEINE",
"amount": 20,
"name": "Caffeine",
"unit": "MG"
},
{
"type": "THEOBROMINE",
"amount": 205,
"name": "Theobromine",
"unit": "MG"
},
{
"type": "FAT",
"amount": 29.66,
"name": "Total lipid (fat)",
"unit": "G"
},
{
"type": "CALCIUM_CA",
"amount": 189,
"name": "Calcium, Ca",
"unit": "MG"
},
{
"type": "POTASSIUM_K",
"amount": 372,
"name": "Potassium, K",
"unit": "MG"
},
{
"type": "SELENIUM_SE",
"amount": 4.5,
"name": "Selenium, Se",
"unit": "UG"
},
{
"type": "NIACIN",
"amount": 0.386,
"name": "Niacin",
"unit": "MG"
},
{
"type": "PANTOTHENIC_ACID",
"amount": 0.472,
"name": "Pantothenic acid",
"unit": "MG"
},
{
"type": "VITAMIN_B_6",
"amount": 0.036,
"name": "Vitamin B-6",
"unit": "MG"
},
{
"type": "CAMPESTEROL",
"amount": 6,
"name": "Campesterol",
"unit": "MG"
},
{
"type": "FIBER_TOTAL_DIETARY",
"amount": 3.4,
"name": "Fiber, total dietary",
"unit": "G"
},
{
"type": "IRON_FE",
"amount": 2.35,
"name": "Iron, Fe",
"unit": "MG"
},
{
"type": "MAGNESIUM",
"amount": 63,
"name": "Magnesium, Mg",
"unit": "MG"
},
{
"type": "PHOSPHORUS_P",
"amount": 208,
"name": "Phosphorus, P",
"unit": "MG"
},
{
"type": "SODIUM_NA",
"amount": 79,
"name": "Sodium, Na",
"unit": "MG"
},
{
"type": "COPPER_CU",
"amount": 0.491,
"name": "Copper, Cu",
"unit": "MG"
},
{
"type": "MANGANESE_MN",
"amount": 0.471,
"name": "Manganese, Mn",
"unit": "MG"
},
{
"type": "PROTEIN",
"amount": 7.65,
"name": "Protein",
"unit": "G"
},
{
"type": "ASH",
"amount": 1.78,
"name": "Ash",
"unit": "G"
},
{
"type": "CRYPTOXANTHIN_BETA",
"amount": 0,
"name": "Cryptoxanthin, beta",
"unit": "UG"
},
{
"type": "LYCOPENE",
"amount": 0,
"name": "Lycopene",
"unit": "UG"
},
{
"type": "VITAMIN_C_TOTAL_ASCORBIC_ACID",
"amount": 0,
"name": "Vitamin C, total ascorbic acid",
"unit": "MG"
},
{
"type": "THIAMIN",
"amount": 0.112,
"name": "Thiamin",
"unit": "MG"
},
{
"type": "RIBOFLAVIN",
"amount": 0.298,
"name": "Riboflavin",
"unit": "MG"
},
{
"type": "FOLATE_TOTAL",
"amount": 12,
"name": "Folate, total",
"unit": "UG"
},
{
"type": "VITAMIN_K_DIHYDROPHYLLOQUINONE",
"amount": 0,
"name": "Vitamin K (Dihydrophylloquinone)",
"unit": "UG"
},
{
"type": "VITAMIN_K_PHYLLOQUINONE",
"amount": 5.7,
"name": "Vitamin K (phylloquinone)",
"unit": "UG"
},
{
"type": "CAROTENE_BETA",
"amount": 0,
"name": "Carotene, beta",
"unit": "UG"
},
{
"type": "CAROTENE_ALPHA",
"amount": 0,
"name": "Carotene, alpha",
"unit": "UG"
},
{
"type": "CHOLESTEROL",
"amount": 23,
"name": "Cholesterol",
"unit": "MG"
},
{
"type": "VITAMIN_D_D2_D3_INTERNATIONAL_UNITS",
"amount": 0,
"name": "Vitamin D (D2 + D3), International Units",
"unit": "IU"
},
{
"type": "FLUORIDE_F",
"amount": 5,
"name": "Fluoride, F",
"unit": "UG"
},
{
"type": "SUGARS_TOTAL_INCLUDING_NLEA",
"amount": 51.5,
"name": "Sugars, total including NLEA",
"unit": "G"
},
{
"type": "FOLATE_DFE",
"amount": 11,
"name": "Folate, DFE",
"unit": "UG"
},
{
"type": "VITAMIN_A_IU",
"amount": 195,
"name": "Vitamin A, IU",
"unit": "IU"
},
{
"type": "VITAMIN_A_RAE",