Nutrition-API
  • Nutrition-API
  • Authorization & Request Setup
    • Authorization Flow
    • API Request Setup
  • Response Usage Guide
    • Reference Codes
    • Routes & Descriptions
    • Models & Usage
    • Icon Formatting
  • Quick Start
    • Setup Summary & API Docs
Powered by GitBook
On this page
Export as PDF
  1. Response Usage Guide

Routes & Descriptions

PreviousReference CodesNextModels & Usage

Last updated 1 year ago

Get Product By Product Code

Summary

Given a product code, such as 698241110109 from UPC/Barcode scanning, get the detailed information and nutrients of the corresponding food product.

Get Product By Food ID

Summary

Given a food items ID, such as 698241110109 get the detailed information and nutrients of the corresponding food product.

Get Product By Reference Code

Summary

All items returned from our API come with a Reference Code. This can be used to retreive the same item later, and to store custom data if necessary.

Search Foods

Summary

This route allows text search against our entire database of foods, products, and recipes.

Simply URL Encode your search term to take care of special characters, and send the request! The default limit (max results returned) is 50. This is the recommended setting, but can be adjusted as needed.

Summary

  • labelId If the selected result has a labelId, pass it as this parameter. If the labelId is empty, pass an all 0's uuid: 00000000-0000-0000-0000-000000000000

  • type All search results will have a type field which will be one of synonym, recipe, or reference. Pass this value to the type parameter

  • resultId all search results will have a resultId. Pass this value to the resultId parameter

(Deprecated) Get Search Result Details [use ]

This route remains to support backward compatibility. should be used instead for all new implementations.

Reference Codes
Reference Codes

Get Food By Product Code

get

get food by product code

Path parameters
productCodestringRequired

product code

Query parameters
minQualityScorestring ยท enumOptional

minimum quality score

Possible values:
Responses
200
OK
application/json
400
Bad Request
application/json
404
Not Found
application/json
429
Too Many Requests
application/json
500
Internal Server Error
application/json
get
GET /v2/products/napi/food/productCode/{productCode} HTTP/1.1
Host: api.passiolife.com
Accept: */*
{
  "brandName": "text",
  "branded": {
    "certified": true,
    "country": "text",
    "images": [
      {
        "bucket": "text",
        "path": "text"
      }
    ],
    "ingredients": "text",
    "ocrText": "text",
    "owner": "text",
    "productCode": "text",
    "reviewed": true,
    "tested": true,
    "upc": "text"
  },
  "concerns": [
    1
  ],
  "description": "text",
  "fromViews": [
    "text"
  ],
  "iconId": "text",
  "id": "text",
  "licenseCopy": "text",
  "name": "text",
  "name_i18n": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  },
  "nutrients": [
    {
      "amount": 1,
      "id": 1,
      "nutrient": {
        "group": "text",
        "id": 1,
        "name": "text",
        "origin": [
          {
            "dataType": "text",
            "id": "text",
            "source": "text",
            "timestamp": "text"
          }
        ],
        "shortName": "text",
        "unit": "text"
      }
    }
  ],
  "origin": [
    {
      "dataType": "text",
      "id": "text",
      "source": "text",
      "timestamp": "text"
    }
  ],
  "popularity": 1,
  "portions": [
    {
      "name": "text",
      "quantity": 1,
      "suggestedQuantity": [
        1
      ],
      "weight": {
        "unit": "text",
        "value": 1
      }
    }
  ],
  "qualityScore": "text",
  "refCode": "text",
  "tags": [
    "text"
  ],
  "timestamp": "text",
  "webLinks": [
    "text"
  ]
}

Get Food By ID

get

get food record by its corresponding food identifier

Path parameters
externalFoodIdstringRequired

food id (ex: 1599690204479)

Query parameters
metadatastringOptional

client can send additional key/value pair data where keys are strings, and values are some json-serializable type. The data should be JSON-encoded and then base64-URL encoded

Responses
200
OK
application/json
400
Bad Request
application/json
404
Not Found
application/json
429
Too Many Requests
application/json
500
Internal Server Error
application/json
get
GET /v2/products/napi/food/{externalFoodId} HTTP/1.1
Host: api.passiolife.com
Accept: */*
{
  "brandName": "text",
  "branded": {
    "certified": true,
    "country": "text",
    "images": [
      {
        "bucket": "text",
        "path": "text"
      }
    ],
    "ingredients": "text",
    "ocrText": "text",
    "owner": "text",
    "productCode": "text",
    "reviewed": true,
    "tested": true,
    "upc": "text"
  },
  "concerns": [
    1
  ],
  "description": "text",
  "fromViews": [
    "text"
  ],
  "iconId": "text",
  "id": "text",
  "licenseCopy": "text",
  "name": "text",
  "name_i18n": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  },
  "nutrients": [
    {
      "amount": 1,
      "id": 1,
      "nutrient": {
        "group": "text",
        "id": 1,
        "name": "text",
        "origin": [
          {
            "dataType": "text",
            "id": "text",
            "source": "text",
            "timestamp": "text"
          }
        ],
        "shortName": "text",
        "unit": "text"
      }
    }
  ],
  "origin": [
    {
      "dataType": "text",
      "id": "text",
      "source": "text",
      "timestamp": "text"
    }
  ],
  "popularity": 1,
  "portions": [
    {
      "name": "text",
      "quantity": 1,
      "suggestedQuantity": [
        1
      ],
      "weight": {
        "unit": "text",
        "value": 1
      }
    }
  ],
  "qualityScore": "text",
  "refCode": "text",
  "tags": [
    "text"
  ],
  "timestamp": "text",
  "webLinks": [
    "text"
  ]
}

Get Search Result Food By RefCode

get

given a search result refcode, retreive the full food information

Path parameters
refCodestringRequired

the string of a base64 url encoded json str. returned with results as 'refCode' from this api. example decoded object: {\

Query parameters
metadatastringOptional

client can send additional key/value pair data where keys are strings, and values are some json-serializable type. The data should be JSON-encoded and then base64-URL encoded

Responses
200
OK
application/json
400
Bad Request
application/json
429
Too Many Requests
application/json
500
Internal Server Error
application/json
get
GET /v2/products/napi/food/search/result/refCode/:refCode HTTP/1.1
Host: api.passiolife.com
Accept: */*
{
  "alternatives": [
    {
      "displayName": "text",
      "iconId": "text",
      "labelId": "text",
      "resultId": "text",
      "type": "text"
    }
  ],
  "results": [
    {
      "displayName": "text",
      "iconId": "text",
      "ingredients": [
        {
          "brandName": "text",
          "branded": {
            "certified": true,
            "country": "text",
            "images": [
              {
                "bucket": "text",
                "path": "text"
              }
            ],
            "ingredients": "text",
            "ocrText": "text",
            "owner": "text",
            "productCode": "text",
            "reviewed": true,
            "tested": true,
            "upc": "text"
          },
          "concerns": [
            1
          ],
          "description": "text",
          "fromViews": [
            "text"
          ],
          "iconId": "text",
          "id": "text",
          "licenseCopy": "text",
          "name": "text",
          "name_i18n": {
            "ANY_ADDITIONAL_PROPERTY": "text"
          },
          "nutrients": [
            {
              "amount": 1,
              "id": 1,
              "nutrient": {
                "group": "text",
                "id": 1,
                "name": "text",
                "origin": [
                  {
                    "dataType": "text",
                    "id": "text",
                    "source": "text",
                    "timestamp": "text"
                  }
                ],
                "shortName": "text",
                "unit": "text"
              }
            }
          ],
          "origin": [
            {
              "dataType": "text",
              "id": "text",
              "source": "text",
              "timestamp": "text"
            }
          ],
          "popularity": 1,
          "portions": [
            {
              "name": "text",
              "quantity": 1,
              "suggestedQuantity": [
                1
              ],
              "weight": {
                "unit": "text",
                "value": 1
              }
            }
          ],
          "qualityScore": "text",
          "refCode": "text",
          "tags": [
            "text"
          ],
          "timestamp": "text",
          "webLinks": [
            "text"
          ]
        }
      ],
      "internalId": "text",
      "internalName": "text",
      "portions": [
        {
          "name": "text",
          "quantity": 1,
          "suggestedQuantity": [
            1
          ],
          "weight": {
            "unit": "text",
            "value": 1
          }
        }
      ],
      "refCode": "text",
      "type": "text"
    }
  ]
}

Search Foods (Basic)

get

search for food (generic, branded or restaraunt) or recipes

Query parameters
termstringRequired

enter your search term here.

limitintegerOptional

sets the maximum number of results to be returned; narrowing, if applied, occurs after this limit.

metadatastringOptional

client can send additional key/value pair data where keys are strings, and values are some json-serializable type. The data should be JSON-encoded and then base64-URL encoded

smartSearchbooleanOptional

set to true to enable a more intelligent AI than default to sort the results. This mode will cost more tokens when enabled, and be slightly slower to respond.

Responses
200
OK
application/json
400
Bad Request
application/json
429
Too Many Requests
application/json
500
Internal Server Error
application/json
get
GET /v2/products/napi/food/search/advanced HTTP/1.1
Host: api.passiolife.com
Accept: */*
{
  "alternateNames": [
    "text"
  ],
  "results": [
    {
      "brandName": "text",
      "displayName": "text",
      "iconId": "text",
      "labelId": "text",
      "longName": "text",
      "nutritionPreview": {
        "calories": 1,
        "carbs": 1,
        "fat": 1,
        "fiber": 1,
        "portion": {
          "name": "text",
          "quantity": 1,
          "suggestedQuantity": [
            1
          ],
          "weight": {
            "unit": "text",
            "value": 1
          }
        },
        "protein": 1
      },
      "recipeId": "text",
      "refCode": "text",
      "referenceId": "text",
      "resultId": "text",
      "score": 1,
      "scoredName": "text",
      "shortName": "text",
      "synonymId": "text",
      "tags": [
        "text"
      ],
      "type": "text"
    }
  ]
}
Deprecated

Get Search Result Food

get

given a search result object, retreive the full food information

Path parameters
labelIdstringRequired

labelid from search result. use an all zeros uuid if unknown.

typestring ยท enumRequired

type from search result

Possible values:
resultIdstringRequired

resultid from search result

Query parameters
metadatastringOptional

client can send additional key/value pair data where keys are strings, and values are some json-serializable type. The data should be JSON-encoded and then base64-URL encoded

Responses
200
OK
application/json
400
Bad Request
application/json
429
Too Many Requests
application/json
500
Internal Server Error
application/json
get
GET /v2/products/napi/food/search/result/:labelId/:type/:resultId HTTP/1.1
Host: api.passiolife.com
Accept: */*
{
  "alternatives": [
    {
      "displayName": "text",
      "iconId": "text",
      "labelId": "text",
      "resultId": "text",
      "type": "text"
    }
  ],
  "results": [
    {
      "displayName": "text",
      "iconId": "text",
      "ingredients": [
        {
          "brandName": "text",
          "branded": {
            "certified": true,
            "country": "text",
            "images": [
              {
                "bucket": "text",
                "path": "text"
              }
            ],
            "ingredients": "text",
            "ocrText": "text",
            "owner": "text",
            "productCode": "text",
            "reviewed": true,
            "tested": true,
            "upc": "text"
          },
          "concerns": [
            1
          ],
          "description": "text",
          "fromViews": [
            "text"
          ],
          "iconId": "text",
          "id": "text",
          "licenseCopy": "text",
          "name": "text",
          "name_i18n": {
            "ANY_ADDITIONAL_PROPERTY": "text"
          },
          "nutrients": [
            {
              "amount": 1,
              "id": 1,
              "nutrient": {
                "group": "text",
                "id": 1,
                "name": "text",
                "origin": [
                  {
                    "dataType": "text",
                    "id": "text",
                    "source": "text",
                    "timestamp": "text"
                  }
                ],
                "shortName": "text",
                "unit": "text"
              }
            }
          ],
          "origin": [
            {
              "dataType": "text",
              "id": "text",
              "source": "text",
              "timestamp": "text"
            }
          ],
          "popularity": 1,
          "portions": [
            {
              "name": "text",
              "quantity": 1,
              "suggestedQuantity": [
                1
              ],
              "weight": {
                "unit": "text",
                "value": 1
              }
            }
          ],
          "qualityScore": "text",
          "refCode": "text",
          "tags": [
            "text"
          ],
          "timestamp": "text",
          "webLinks": [
            "text"
          ]
        }
      ],
      "internalId": "text",
      "internalName": "text",
      "portions": [
        {
          "name": "text",
          "quantity": 1,
          "suggestedQuantity": [
            1
          ],
          "weight": {
            "unit": "text",
            "value": 1
          }
        }
      ],
      "refCode": "text",
      "type": "text"
    }
  ]
}
  • Get Product By Product Code
  • Summary
  • GETGet Food By Product Code
  • Get Product By Food ID
  • Summary
  • GETGet Food By ID
  • Get Product By Reference Code
  • Summary
  • GETGet Search Result Food By RefCode
  • Search Foods
  • Summary
  • GETSearch Foods (Basic)
  • (Deprecated) Get Search Result Details [use Reference Codes]
  • Summary
  • GETGet Search Result Food