Whisk Docs
Whisk HomeHelp CenterDeveloper Tools
v2.0.0
v2.0.0
  • The Whisk Platform
  • Whisk API Overview
    • Introduction
    • Integration
    • Authentication
      • Server Token
      • User Access Token
        • Auth Flow Example
      • Client Token
      • Anonymous Access from Client Apps
    • Whisk Sandbox
    • Getting Started
  • Whisk API Reference 2.0
    • Provisioning
      • Get provisioning
    • Autocomplete
    • Community
      • Get your Communities
      • Get Communities from a Topic
      • Discover Recommended Communities
      • Search Communities
      • Get a Community
      • Get Recipes from a Community
      • Add Recipes to a Community
      • Remove a Recipe from a Community
      • Join a Community
      • Leave a Community
    • Posts and Reviews
      • Get reviews for a recipe
      • Create or edit review
      • Create a Post
      • Get Post by id
      • Delete a Post
      • Edit a Post
      • Report a Post
      • Create a Post Reply
      • Get Post Replies
      • Delete a Post reply
      • Report a Post reply
      • Like a Post or Reply
      • Users who liked a Post or Reply
    • Public profiles
      • Hide recipe in Public profile
      • Get Recipes for Public Profile
      • Get User's public profile by user_id
      • Get User's public profile by username
    • Custom Label
    • Feed
      • Obtain a Recipe Feed
    • Food DB
      • Autocomplete
      • Search
      • Get Food
    • Food List
    • Food Log
    • Foodpairing
    • Healthy meal recommendations
      • Healthy recipe only recommendations for DA
      • Recipe recommendations for SH
      • Tailored Plan API request for Samsung TV
    • Meal Plan
      • Generate a Meal Plan
      • Meal Object
        • Get Meals
        • Delete Meal
        • Add a Meal
      • Meal Plan Settings Object
        • Get Meal Plan Settings
        • Update Meal Plan Settings
      • Meal Plan Batch
    • Recipe
      • Get a Recipe
      • Search a Recipe
      • User Recipes & Collections
        • Add User Recipe
        • Create A Recipe
        • Update External Recipe
        • Get All User Recipes
        • Update User Recipe
        • Remove Recipe from Favorites
        • Create Collection
        • Get All User Collections
        • Get Collection
        • Get Recipes from a Collection
        • Remove Collection
        • Get Smart Collection
        • Get Recipes from a Smart Collection
    • Shopping List
      • Get your Shopping Lists
      • Get a Shopping List
      • Create a Shopping List
      • Delete a Shopping List
      • Update basic details of a Shopping List
      • Move Items between Shopping Lists
      • Add Items to a Shopping List
      • Delete an Item from a Shopping List
      • Update an Item in a Shopping List
      • Clear Items from a Shopping List
    • Media
    • Store Item
    • Unit Conversion
    • Users
      • Get a User
      • Update User Settings using Patch
      • Update User Settings using Post
    • Try it out!
  • Shopping List SDK
    • Overview
    • Examples
      • Shoppable Recipes
      • Shoppable Products
      • Shoppable Media
    • Basic Setup
      • Basic Setup
      • Methods
      • Event Listeners
      • Widget
      • Subscriptions
      • Global Configuration
      • UTM Parameters
      • Using With SPA
  • Shopping List Mobile API
    • Overview
    • Examples
    • Reference
  • API Resources
    • Authentication Scopes
    • Errors and Troubleshooting
    • Cursor Pagination
    • Limits
    • Nutrients
    • Recipe Labels
    • Filtering Recipes using Custom Labels
    • Health Score, Glycemic Index, Glycemic Load
    • Whisk User Data
    • Integrated Retailers
    • Optimizing Image Load
    • Meal Plan
Powered by GitBook
On this page
  • Description
  • Parameters
  • Response

Was this helpful?

  1. Whisk API Reference 2.0
  2. Food DB

Get Food

GET https://api.whisk.com/food/v2/get

PreviousSearchNextFood List

Last updated 1 year ago

Was this helpful?

Description

Returns brand, nutrition data and available measurements for food

Parameters

Name
Optional
Type
Description

food_hits

no

array[string]

Food identifiers to be fetched

response_mask.paths

yes

array[string]

List of top level fields of result model to be returned. Minimal required set of fields should be specified to reduce payload size

Request example

The recommended set of fields to request to cover the common use case of displaying a product is

title
brand
nutrition
measures
curl -X GET "https://api.whisk.com/food/v2/get?food_hits=CiMyMDJlNjM2M2Q3YWRkNjU0ZmI2OGZmZTNkZGM1ODliMzY5ZA==&food_hits=CiMyMDI2OTdjYjQ5MGU5YmM0MTMzYTg5OWYzOWJhZTI3NmEyZQ==&language=en&country=gb&response_mask.paths=title&response_mask.paths=brand&response_mask.paths=nutrition&response_mask.paths=measures" -H  "accept: application/json" -H  "Authorization: Bearer %WHISK_TOKEN%"

Response

Data returned in JSON. Empty strings, zero values, empty arrays and null values are not returned.

Json response example with the proper response_mask.paths specified

{
  "food": [
    {
      "title": "apple",
      "measures": {
        "measures_with_nutrition": [
          {
            "nutrition": {
              "nutrition": [
                {
                  "unit_name": "NUTRITION_UNIT_MKG",
                  "code": "NUTRITION_CODE_VITB12"
                },
                {
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_CHOLE"
                },
                {
                  "amount": 10.100000381469727,
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_SUGAR"
                },
                {
                  "amount": 0.6000000238418579,
                  "unit_name": "NUTRITION_UNIT_MKG",
                  "code": "NUTRITION_CODE_VITK1"
                },
                {
                  "amount": 0.03999999910593033,
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_FAPU"
                },
                {
                  "amount": 0.019999999552965164,
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_FASAT"
                },
                {
                  "amount": 12.760000228881836,
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_CHOCDF"
                },
                {
                  "unit_name": "NUTRITION_UNIT_MKG",
                  "code": "NUTRITION_CODE_FOL"
                },
                {
                  "amount": 11.399999618530273,
                  "unit_name": "NUTRITION_UNIT_MKG",
                  "code": "NUTRITION_CODE_VITA_RAE"
                },
                {
                  "amount": 0.05000000074505806,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_ZN"
                },
                {
                  "amount": 0.029999999329447746,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_RIBF"
                },
                {
                  "amount": 0.12999999523162842,
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_FAT"
                },
                {
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_FAMS"
                },
                {
                  "amount": 0.27000001072883606,
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_PROCNT"
                },
                {
                  "amount": 11,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_P"
                },
                {
                  "amount": 4,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_VITC"
                },
                {
                  "amount": 90,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_K"
                },
                {
                  "amount": 4,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_MG"
                },
                {
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_FATRN"
                },
                {
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_NA"
                },
                {
                  "amount": 0.05000000074505806,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_TOCPHA"
                },
                {
                  "amount": 1.2999999523162842,
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_FIBTG"
                },
                {
                  "amount": 0.03999999910593033,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_VITB6A"
                },
                {
                  "amount": 47.79999923706055,
                  "unit_name": "NUTRITION_UNIT_KCAL",
                  "code": "NUTRITION_CODE_ENERC_KCAL"
                },
                {
                  "amount": 0.019999999552965164,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_THIA"
                },
                {
                  "amount": 5,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_CA"
                },
                {
                  "unit_name": "NUTRITION_UNIT_MKG",
                  "code": "NUTRITION_CODE_VITD"
                },
                {
                  "amount": 0.09000000357627869,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_NIA"
                },
                {
                  "amount": 0.07000000029802322,
                  "unit_name": "NUTRITION_UNIT_MG",
                  "code": "NUTRITION_CODE_FE"
                }
              ]
            },
            "measures": [
              {
                "amount": 4.625121890828984,
                "name": "small",
                "measure_unit": "MEASURE_UNIT_OZ",
                "nutrition_coefficient": 1.3112000000000001
              },
              {
                "amount": 131.12,
                "name": "small",
                "measure_unit": "MEASURE_UNIT_G",
                "nutrition_coefficient": 1.3112000000000001
              },
              {
                "amount": 5.649477745844799,
                "name": "medium",
                "measure_unit": "MEASURE_UNIT_OZ",
                "nutrition_coefficient": 1.6016
              },
              {
                "amount": 160.16,
                "name": "medium",
                "measure_unit": "MEASURE_UNIT_G",
                "nutrition_coefficient": 1.6016
              },
              {
                "amount": 3.5273961949580412,
                "name": "100 G",
                "measure_unit": "MEASURE_UNIT_OZ",
                "nutrition_coefficient": 1
              },
              {
                "amount": 100,
                "name": "100 G",
                "measure_unit": "MEASURE_UNIT_G",
                "nutrition_coefficient": 1
              },
              {
                "amount": 182,
                "name": "medium",
                "measure_unit": "MEASURE_UNIT_G",
                "nutrition_coefficient": 1.82
              },
              {
                "amount": 6.922162292985661,
                "name": "large",
                "measure_unit": "MEASURE_UNIT_OZ",
                "nutrition_coefficient": 1.9624000000000001
              },
              {
                "amount": 196.24,
                "name": "large",
                "measure_unit": "MEASURE_UNIT_G",
                "nutrition_coefficient": 1.9624000000000001
              }
            ]
          }
        ]
      },
      "food_hit": "CiMyMDI2OTdjYjQ5MGU5YmM0MTMzYTg5OWYzOWJhZTI3NmEyZQ=="
    }
  ]
}

Core Attributes

In case response_mask.paths brand, title, nutrition, measures as in the example above are passed

Name
Optional
Type
Description

title

no

string

Localized food name

brand

yes

string

Brand name

measures

yes

object

Wrapper object for a list of measures

measures.measures_with_nutrition

no

array

List of measurements specific to this food along with the nutrition per 100 g

measures.measures_with_nutrition.measures.amount

no

double

Number of measure_unit within one measure e.g. slice of cheese is 20g, cup of milk is 240ml. Not rounded

measures.measures_with_nutrition.measures.measure_unit

no

enum

MEASURE_UNIT_G | MEASURE_UNIT_ML | MEASURE_UNIT_OZ | MEASURE_UNIT_FL_OZ

measures.measures_with_nutrition.measures.nutrition_coefficient

no

double

Multiplier to use with nutrition per 100g to get nutrition of measure. It's derived from product density

measures.measures_with_nutrition.measures.name

no

string

Localized measurement name e.g. slice

measures_with_nutrition.nutrition

no

object

Wrapper object for nutrition list

measures_with_nutrition.nutrition.nutrition

no

array

List of nutrition components

measures_with_nutrition.nutrition.nutrition.amount

yes

double

Amount of nutrition component per 100g of the food

measures_with_nutrition.nutrition.nutrition.unit_name

no

enum

NUTRITION_UNIT_G | NUTRITION_UNIT_MG | NUTRITION_UNIT_MKG | NUTRITION_UNIT_KCAL Macronutrients and Fiber are returned in grams Micronutrients are returned either in milligrams of micrograms Energy is returned in Kilocalories

measures_with_nutrition.nutrition.nutrition.code

no

enum

See below

Nutrition codes

Whisk is always trying to provide full up to date nutritional data, although all nutrition codes for food are not always available. Nutrition codes for missing data are not returned.

  • NUTRITION_CODE_ENERC_KCAL: Energy

  • NUTRITION_CODE_FAT: Total Fat

  • NUTRITION_CODE_FASAT: Saturated Fat

  • NUTRITION_CODE_CHOCDF: Carbohydrate Total

  • NUTRITION_CODE_SUGAR: Sugars

  • NUTRITION_CODE_PROCNT: Protein

  • NUTRITION_CODE_NA: Sodium

  • NUTRITION_CODE_FIBTG: Fiber

  • NUTRITION_CODE_FATRN: Trans Fat

  • NUTRITION_CODE_FAMS: Monounsaturated Fat

  • NUTRITION_CODE_FAPU: Polyunsaturated Fat

  • NUTRITION_CODE_FAT_UNSAT: Unsaturated Fat

  • NUTRITION_CODE_CHOLE: Cholesterol

  • NUTRITION_CODE_CA: Calcium

  • NUTRITION_CODE_MG: Magnesium

  • NUTRITION_CODE_K: Potassium

  • NUTRITION_CODE_FE: Iron

  • NUTRITION_CODE_ZN: Zinc

  • NUTRITION_CODE_P: Phosphorus

  • NUTRITION_CODE_VITA_RAE: Vitamin A

  • NUTRITION_CODE_VITC: Vitamin C

  • NUTRITION_CODE_THIA: Thiamin B1

  • NUTRITION_CODE_RIBF: Riboflavin B2

  • NUTRITION_CODE_NIA: Niacin B3

  • NUTRITION_CODE_VITB6A: Vitamin B6

  • NUTRITION_CODE_FOL: Folic Acid B9

  • NUTRITION_CODE_VITB12: Vitamin B12

  • NUTRITION_CODE_VITD: Vitamin D

  • NUTRITION_CODE_TOCPHA: Vitamin E

  • NUTRITION_CODE_VITK1: Vitamin K

Imperial measures

When country is specified in the request and is one of USA, UK, Canada, then Whisk API will return measures in both Metric and Imperial systems.

Measures and nutrition explained

To support volume based measures we've introduced a nutrition_coefficient attribute. Let's see it on the following example

      "title":"milk",
        "measures_with_nutrition": [
          {
            "nutrition": {
              "nutrition": [
                {
                  "amount": 60,
                  "unit_name": "NUTRITION_UNIT_KCAL",
                  "code": "NUTRITION_CODE_ENERC_KCAL"
                },
                {
                  "amount": 3.200000047683716,
                  "unit_name": "NUTRITION_UNIT_G",
                  "code": "NUTRITION_CODE_FAT"
                }
              ]
            },
            "measures": [
              {
                "amount": 240,
                "name": "cup",
                "measure_unit": "MEASURE_UNIT_ML",
                "nutrition_coefficient": 2.448
              },
              {
                "amount": 100,
                "name": "100 Ml",
                "measure_unit": "MEASURE_UNIT_ML",
                "nutrition_coefficient": 1.02
              }
            ]
          }
        ]

Whisk API returns nutrition per 100g in metric units. It's a standard adopted all over the world including USDA and KFDA.

The response above means:

There's 60 kCal and 3.2g of Fat in 100g of Milk.

The cup of milk has volume of 240 ml or 8.11 fl oz. The cup of milk weights 2.448 times more than 100g of milk. So the cup of milk has 60 * 2.448 = 146.88 kCal and 3.2 * 2.448 = 7.8g of Fat.

Sometimes one product may come with different attributes e.g. cooked or fried. Since nutrition of cooked product is different, it will come as a separate item within measures_with_nutrition array.

Swagger doc