Search-Item Endpoint
  • 2 Minutes to read
  • Dark
    Light

Search-Item Endpoint

  • Dark
    Light

Article summary

Use this API to look for the nutrition information of any branded food item by the UPC scanned from a branded grocery product or the “nix_item_id” (returned from the search/instant endpoint).

Resource Information

Add the resource information as follows:

Resource InformationValue
Response FormatJSON
Requires AuthenticationYes
HTTP MethodGET
Host Domainhttps://trackapi.nutritionix.com
Endpoint/v2/search/item

Header

The header of the request contains parameters to authenticate the request. The request is authenticated only if the API authentication is enabled for you.

To authenticate the request, you must pass the “x-app-id” and “x-app-key”. For more information, see Understand Request Headers.

Parameters

Expand to see the parameters and description


NameRequired for Authentication
DescriptionExample
upc 
string
Yes, or nix_item_id
Search by product UPC (any UPC type).
49000000450
nix_item_id
string
Yes, or upc
Search for item using nix_item_id returned from search/instant endpoint.
51c549ff97c3e6efadd60294

Request

In the request send the following details:


var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://trackapi.nutritionix.com/v2/search/item/?upc=49000000450',
  'headers': {
    'Content-Type': 'application/x-www-form-urlencoded',
    'x-app-id': ,
    'x-app-key': 
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Response

Returns in JSON format.


{
  "foods": [
    {
      "food_name": "Diet Cola",
      "brand_name": "Coke",
      "serving_qty": 1,
      "serving_unit": "bottle",
      "serving_weight_grams": 226,
      "nf_metric_qty": 591,
      "nf_metric_uom": "ml",
      "nf_calories": 0,
      "nf_total_fat": 0,
      "nf_saturated_fat": null,
      "nf_cholesterol": null,
      "nf_sodium": 70,
      "nf_total_carbohydrate": 0,
      "nf_dietary_fiber": null,
      "nf_sugars": null,
      "nf_protein": 0,
      "nf_potassium": null,
      "nf_p": null,
      "full_nutrients": [
        {
          "attr_id": 203,
          "value": 0
        },
        {
          "attr_id": 204,
          "value": 0
        },
        {
          "attr_id": 205,
          "value": 0
        },
        {
          "attr_id": 208,
          "value": 0
        },
        {
          "attr_id": 307,
          "value": 70
        }
      ],
      "nix_brand_name": "Coke",
      "nix_brand_id": "51db3801176fe9790a89ae0b",
      "nix_item_name": "Diet Cola",
      "nix_item_id": "51d2fae7cc9bff111580d8d8",
      "metadata": {},
      "source": 8,
      "ndb_no": null,
      "tags": null,
      "alt_measures": null,
      "lat": null,
      "lng": null,
      "photo": {
        "thumb": "https://nutritionix-api.s3.amazonaws.com/5b5c17c429f162275dc922b0.jpeg",
        "highres": null,
        "is_user_uploaded": false
      },
      "note": null,
      "class_code": null,
      "brick_code": null,
      "tag_id": null,
      "updated_at": "2022-06-22T03:14:26+00:00",
      "nf_ingredient_statement": "Carbonated Water, Caramel Color, Aspartame, Phosphoric Acid, Potassium Benzoate (to Protect Taste), Natural Flavors, Citric Acid, Caffeine."
    }
  ]
}

FAQs

Do you have any recommended barcode scanning libraries for iOS/Android or other best practices for barcode scanning?

There are many open-source barcode scanning plugins available, and we have had good experience with these:

Calculate the check-digit of a barcode to confirm the mobile device read the barcode correctly.  You can utilize this script as a starting point.  Sometimes in low light situations, or curved packages, the mobile phone will misread the barcode.  If the incorrect barcode is sent to Nutritionix, it will incorrectly appear that the product does not exist in the database.  In the event of a misread barcode event, we recommend building logic into your app to ask the user to scan the product one more time, or manually enter in the barcode number as a backup.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence