Chomp API Center

Barcode lookup

GET /food/branded/barcode.php

Plans: Limited · Standard · Premium

Get the full record for one branded product from its UPC or EAN barcode, including its ingredients, serving size, nutrients, allergens, and traces.

GTIN-8, GTIN-12, and GTIN-13 formats are supported.

Per serving: nutrient values are per 100 g. The serving object gives the serving size, such as 69 g or "1 BAR", so you can scale values to one serving. Some records give the serving as text, such as "1 portion (50 g)".

Rate limit: 30 requests a minute on Limited, 100 on Standard, none on Premium (within fair use). Barcode lookups are not subject to the search pace.

If a lookup returns a 404, try these first:

  • Prepend a leading zero to turn a 12-digit UPC-A into an EAN-13
  • Pad an EAN-8 with five leading zeros
  • Strip leading zeros entirely

Base URL

Production server — live data

https://chompthis.com/api/v2

Parameters

NameTypeRequiredDescription
api_key string Required Your API key, sent as a query parameter on every request.
code string Required The UPC or EAN barcode. Example: 0762111036537.
user_id string Premium Premium only. Send one ID per end user, such as an internal ID or a hash, never an email address or a name. For server-side calls with no end users, send one fixed ID such as system-batch. Details

Errors

400 · 401 · 404 · 500
400

Bad request. A parameter is missing or invalid — check that code is present and holds digits only.

401

Unauthorized. One message covers several causes:

  • The key isn't recognized, or the subscription is cancelled.
  • Your plan doesn't include this endpoint.
  • You passed your plan's requests-per-minute limit.
  • A Premium request has no user_id.

Only a missing user_id and a Premium trial over its call cap add a sentence to the message. Try It on this page works out the likely cause for your key.

404

Not found. No product matches that barcode. Check the format (GTIN-8/12/13), try the leading-zero fixes above, or fall back to search by name on Standard or Premium.

500

Server error. Something went wrong on our side. Try again; if it keeps happening, contact support and include the barcode you sent.

Every error returns its HTTP status and a JSON body with a single error string. The line "Please try again in a minute" appears on most errors, but it only helps after a rate limit or the search pace.

Examples of the errors you will see most often:

401 — any cause except the two below

{ "error": "401 Unauthorized: Invalid API key, unauthorized access, or usage limits exceeded. Please try again in a minute or contact us. https://chompthis.com/api/ticket-new.php?ref=401" }

401 — Premium request without user_id

{ "error": "401 Unauthorized: Invalid API key, unauthorized access, or usage limits exceeded. You are missing the required \"user_id\" parameter to fulfill his request. Please pass in a unique user ID for every user on your platform that accesses our API. Please try again in a minute or contact us. https://chompthis.com/api/ticket-new.php?ref=401" }

404 — barcode not found

{ "error": "404 Not Found: No food items were found. Please try again in a minute or contact us. https://chompthis.com/api/ticket-new.php" }

Response schema

itemsarray
The matching products — one object per product. Fields may be null or absent when no data is available for them.
barcodestring
The product's EAN/UPC barcode, as stored.
namestring
Item name, as recorded in the source data.
brandstring
The brand that owns this item.
descriptionstring
A description of this item, when one is available.
ingredientsstring
The ingredient statement as printed on the package, from greatest quantity to least.
ingredient_listarray of string
The item's ingredients as a normalized list.
packageobject
Basic packaging information for this item.
package.quantityinteger
Package quantity.
package.sizestring
Package size, e.g. "100g".
servingobject
Serving information for this item.
serving.sizenumber or string
Serving size. Some records give a number, with the unit in serving.measurement_unit. Others give the whole serving as text, such as "1 portion (50 g)", and leave the unit empty. A few have no serving size.
serving.measurement_unitstring
The unit for the serving size (e.g. g, tsp). Can be null.
serving.size_fulltextstring
Serving size as written on the package, e.g. "2 PIECES".
categoriesarray of string
The categories this item belongs to.
nutrientsarray
The nutrients found in this item — one object per nutrient, each carrying the subfields below.
nutrients.namestring
Nutrient name, e.g. Energy, Fat, Sodium.
nutrients.per_100gnumber
Amount of the nutrient per 100g of food.
nutrients.measurement_unitstring
The unit the amount is measured in, e.g. g, mg, kj. Energy can be reported in kj, with a separate kcal entry when one is available.
nutrients.rankinteger
Position in the source data’s nutrient ordering (USDA FoodData Central) — a display sequence, not an amount or a quality score. Null when the source record carries no rank.
nutrients.data_pointsinteger
Number of observations the value is based on.
nutrients.descriptionstring
Description of the nutrient's source.
diet_labelsobject
Compatibility labels for the three supported diets, under the keys vegan, vegetarian, and gluten_free. Every label carries the same five subfields below.
diet_labels.namestring
Diet name — Vegan, Vegetarian, or Gluten Free.
diet_labels.is_compatibleboolean
Whether the item is compatible with this diet.
diet_labels.compatibility_levelinteger
2 — compatible: no flagged ingredients; you can label the product as fitting the diet. 1 — compatible, with caution: is_compatible is still true, but a possibly incompatible ingredient is present — one whose source decides whether it fits, such as sugar that may be filtered through bone char, or natural flavors of unstated origin; the diet_flags list names it, so check the flag before you label the product. 0 — not compatible: a flagged ingredient rules the product out for that diet.
diet_labels.confidenceboolean
Whether Chomp is confident in how this item is graded for this diet — a separate signal from the level above. For branded products, confidence follows the ingredient statement: when the statement is in English, grades are confident; when it is not, confidence is false and the description reads "uncertain" — at any level. Code your labeling rules on compatibility_level; use confidence to decide how much human review a grade gets.
diet_labels.confidence_descriptionstring
The grade in words — e.g. "Compatible with the Vegan diet, with caution." when a confident level-1 grade carries a caution. Or "Compatibility with the Vegan diet is uncertain." when confidence is false.
diet_flagsarray
The specific ingredients that triggered a diet incompatibility or an allergen warning — one object per flag, each carrying the subfields below. Empty when nothing is flagged.
diet_flags.ingredientstring
The flagged ingredient's name.
diet_flags.ingredient_descriptionstring or null
Why this ingredient was flagged, in plain words.
diet_flags.diet_labelstring
The diet this ingredient may not be compatible with.
diet_flags.is_compatibleboolean
Whether this ingredient is compatible with that diet.
diet_flags.compatibility_levelinteger
How compatible the ingredient is, on the same 0–2 scale as the labels: 0 rules the diet out; 1 depends on the source.
diet_flags.compatibility_descriptionstring
How this ingredient was graded, in words — e.g. "It depends on the source." or "Banned - Not acceptable for diet/lifestyle."
diet_flags.is_allergenboolean
Whether the ingredient is a known allergen.
packaging_photosobject
URLs for packaging and label photographs, grouped by view — front, nutrition, and ingredients. Each view carries the same three sizes below.
packaging_photos.smallstring
Small photo URL (200px).
packaging_photos.thumbstring
Thumbnail photo URL (100px).
packaging_photos.displaystring
Full-sized photo URL (400px).
allergensarray of string
The allergens declared on the product's source label. The list is the label's own declaration, not derived from the ingredient list — for allergen-safety decisions, cross-check the ingredient list as well.
brand_listarray of string
Every brand associated with this item — some items are sold under more than one brand.
countriesarray of string
The countries where this item is sold.
country_detailsobject
More detail on the countries above.
country_details.english_speakinginteger
How many of those countries are primarily English-speaking.
country_details.non_english_speakinginteger
How many are not.
palm_oil_ingredientsarray of string
Ingredients in this item made from palm oil.
has_english_ingredientsboolean
Whether English ingredients are available for this item.
mineralsarray of string
The minerals this item contains.
vitaminsarray of string
The vitamins this item contains.
tracesarray of string
Trace ingredients that may be found in this item.
keywordsarray of string
Keywords that describe this item.

In context

Request example

cURL

curl "https://chompthis.com/api/v2/food/branded/barcode.php?api_key=YOUR_KEY&code=0762111036537"

Try it

No key yet? Start a free trial.

Your key stays in this page; nothing is stored.

Response example

200 — application/json

{
  "items": [
    {
      "barcode": "0762111036537",
      "name": "Bar, Cranberry Bliss",
      "brand": "Starbucks Coffee Company",
      "ingredients": "ENRICHED FLOUR (WHEAT FLOUR, MALTED BARLEY FLOUR, NIACIN, IRON, THIAMIN MONONITRATE, RIBOFLAVIN, FOLIC ACID), BROWN SUGAR, WHITE CONFECTIONERY COATING (SUGAR, PALM KERNEL AND PALM OILS, WHEY, NONFAT MILK, SOY LECITHIN, TITANIUM DIOXIDE [COLOR], NATURAL FLAVOR, VANILLA FLAVOR), CREAM CHEESE (PASTEURIZED CREAM AND MILK, MILK PROTEINS, NATURAL ACIDS, SALT, XANTHAN, CAROB BEAN AND GUAR GUMS), CRANBERRIES (CRANBERRIES, SUGAR, SUNFLOWER OIL), UNSALTED BUTTER, EGGS, MARGARINE (VEGETABLE OIL [SOYBEAN AND PALM OILS], WATER, MONO AND DIGLYCERIDES, NONFAT DRY MILK, SOY LECITHIN, NATURAL FLAVOR, VITAMIN A PALMITATE, BETA CAROTENE), SUGAR, GINGER (GINGER, CANE SUGAR), PALM OIL, ORANGE PEEL (ORANGE PEEL, SUGAR, ORANGE OIL), COCONUT OIL, CANOLA OIL, SALT, MALTITOL, VANILLA FLAVOR, WATER, CORNSTARCH, BAKING POWDER (SODIUM ACID PYROPHOSPHATE, SODIUM BICARBONATE, CORNSTARCH, MONOCALCIUM PHOSPHATE), BAKING SODA.",
      "package": { "quantity": null, "size": "100g" },
      "serving": { "size": 69, "measurement_unit": "g", "size_fulltext": "1 BAR" },
      "categories": ["Snack, Energy & Granola Bars"],
      "nutrients": [
        { "name": "Energy", "per_100g": 493, "measurement_unit": "KCAL", "rank": 300, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Protein", "per_100g": 4.35, "measurement_unit": "G", "rank": 600, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Total lipid (fat)", "per_100g": 27.54, "measurement_unit": "G", "rank": 800, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Carbohydrate, by difference", "per_100g": 56.52, "measurement_unit": "G", "rank": 1110, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Fiber, total dietary", "per_100g": 1.4, "measurement_unit": "G", "rank": 1200, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Sugars, total including NLEA", "per_100g": 40.58, "measurement_unit": "G", "rank": 1510, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Calcium, Ca", "per_100g": 58, "measurement_unit": "MG", "rank": 5300, "data_points": 0, "description": "Calculated from a daily value percentage per serving size measure" },
        { "name": "Iron, Fe", "per_100g": 1.57, "measurement_unit": "MG", "rank": 5400, "data_points": 0, "description": "Calculated from a daily value percentage per serving size measure" },
        { "name": "Sodium, Na", "per_100g": 275, "measurement_unit": "MG", "rank": 5800, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Vitamin C, total ascorbic acid", "per_100g": 0, "measurement_unit": "MG", "rank": 6300, "data_points": 0, "description": "Calculated from a daily value percentage per serving size measure" },
        { "name": "Vitamin A, IU", "per_100g": 435, "measurement_unit": "IU", "rank": 7500, "data_points": 0, "description": "Calculated from a daily value percentage per serving size measure" },
        { "name": "Fatty acids, total saturated", "per_100g": 17.39, "measurement_unit": "G", "rank": 9700, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Fatty acids, total trans", "per_100g": 0, "measurement_unit": "G", "rank": 15400, "data_points": 0, "description": "Calculated from value per serving size measure" },
        { "name": "Cholesterol", "per_100g": 51, "measurement_unit": "MG", "rank": 15700, "data_points": 0, "description": "Calculated from value per serving size measure" }
      ],
      "diet_labels": {
        "vegan": { "name": "Vegan", "is_compatible": false, "compatibility_level": 0, "confidence": true, "confidence_description": "Not compatible with the Vegan diet." },
        "vegetarian": { "name": "Vegetarian", "is_compatible": true, "compatibility_level": 1, "confidence": true, "confidence_description": "Compatible with the Vegetarian diet, with caution." },
        "gluten_free": { "name": "Gluten Free", "is_compatible": false, "compatibility_level": 0, "confidence": true, "confidence_description": "Not compatible with the Gluten Free diet." }
      },
      "diet_flags": [
        { "ingredient": "Milk", "ingredient_description": "Not vegan if derived from an animal. Check the ingredients.", "diet_label": "Vegan", "is_compatible": false, "compatibility_level": 0, "compatibility_description": "Banned - Not acceptable for diet/lifestyle.", "is_allergen": true },
        { "ingredient": "Barley", "ingredient_description": "Often contains a form of grain gluten. Check the ingredients if gluten-free is not on the label.", "diet_label": "Gluten Free", "is_compatible": false, "compatibility_level": 0, "compatibility_description": "Banned - Not acceptable for diet/lifestyle.", "is_allergen": false },
        { "ingredient": "Wheat", "ingredient_description": "Wheat includes gluten. Check the ingredients if gluten-free is not on the label.", "diet_label": "Gluten Free", "is_compatible": false, "compatibility_level": 0, "compatibility_description": "Banned - Not acceptable for diet/lifestyle.", "is_allergen": false },
        { "ingredient": "Whey", "ingredient_description": "The watery part of milk that remains after the formation of curds.", "diet_label": "Vegan", "is_compatible": false, "compatibility_level": 0, "compatibility_description": "Banned - Not acceptable for diet/lifestyle.", "is_allergen": false },
        { "ingredient": "Natural", "ingredient_description": "Ingredients are not synthetic or artificial, but extracted directly from plants or animal products", "diet_label": "Vegetarian", "is_compatible": true, "compatibility_level": 1, "compatibility_description": "It depends on the source. This ingredient is made more than one way, and only some ways fit this diet.", "is_allergen": false },
        { "ingredient": "Sugar", "ingredient_description": "A sweet material that consists of sucrose. Some sugars are processed through boneblack.", "diet_label": "Vegan", "is_compatible": true, "compatibility_level": 1, "compatibility_description": "It depends on the source. This ingredient is made more than one way, and only some ways fit this diet.", "is_allergen": false },
        { "ingredient": "Niacin", "ingredient_description": "Used as a cholesterol treatment. In rare cases it can be derived from animal sources.", "diet_label": "Vegan", "is_compatible": true, "compatibility_level": 1, "compatibility_description": "It depends on the source. This ingredient is made more than one way, and only some ways fit this diet.", "is_allergen": false },
        { "ingredient": "Riboflavin", "ingredient_description": "May contain milk.", "diet_label": "Vegan", "is_compatible": true, "compatibility_level": 1, "compatibility_description": "It depends on the source. This ingredient is made more than one way, and only some ways fit this diet.", "is_allergen": false }
      ],
      "packaging_photos": {
        "front": {
          "small": null,
          "thumb": null,
          "display": null
        },
        "nutrition": {
          "small": null,
          "thumb": null,
          "display": null
        },
        "ingredients": {
          "small": null,
          "thumb": null,
          "display": null
        }
      },
      "allergens": ["Milk"],
      "brand_list": ["Starbucks", "Starbucks Coffee Company"],
      "countries": ["United States"],
      "country_details": { "english_speaking": 1, "non_english_speaking": 0 },
      "palm_oil_ingredients": [],
      "ingredient_list": ["Brown Sugar", "Color", "Enriched Flour", "Folic Acid", "Iron", "Natural Fla", "Niacin", "Nonfat Milk", "Palm Kernel And Palm Oils", "Riboflavin", "Soy Lecithin", "Sugar", "Thiamin Mononitrate", "Titanium Dioxide", "Wheat Flour Malted Barley Flour", "Whey", "White Confectionery Coating"],
      "has_english_ingredients": true,
      "minerals": ["Iron"],
      "vitamins": ["Folic Acid", "Niacin", "Riboflavin", "Thiamin Mononitrate"],
      "traces": [],
      "description": "STARBUCKS, BAR, CRANBERRY BLISS",
      "keywords": ["Bar", "Blis", "Coffee", "Company", "Cranberry", "Starbuck"]
    }
  ]
}