Add barcode scanning to your app

Your app sends the UPC or EAN from a scan. Chomp returns its ingredients, serving size, nutrients, allergens, and trace ingredients from a catalog of more than 850,000 products. One request per scan.

What a scan returns

One request per scan returns the whole record, shortened here. There is no database to load and no feed to keep current: Chomp maintains the catalog and re-checks branded products about twice a month.

GET /api/v2/food/branded/barcode.php?api_key=YOUR_KEY&code=0762111036537, shortened

{
  "items": [
    {
      "barcode": "0762111036537",
      "name": "Bar, Cranberry Bliss",
      "brand": "Starbucks Coffee Company",
      "serving": { "size": 69, "measurement_unit": "g", "size_fulltext": "1 BAR" },
      "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, …), …",
      "nutrients": [ // 5 of 14 shown, per 100 g
        { "name": "Energy", "per_100g": 493, "measurement_unit": "KCAL" },
        { "name": "Protein", "per_100g": 4.35, "measurement_unit": "G" },
        { "name": "Total lipid (fat)", "per_100g": 27.54, "measurement_unit": "G" },
        { "name": "Carbohydrate, by difference", "per_100g": 56.52, "measurement_unit": "G" },
        { "name": "Sodium, Na", "per_100g": 275, "measurement_unit": "MG" }
      ],
      "allergens": ["Milk"]
    }
  ]
}

In every branded record

  • IngredientsThe statement as printed, plus a parsed list
  • Serving sizesSize, unit, and the wording on the pack
  • NutrientsCalories, macros, vitamins, and minerals per 100 g
  • AllergensAs declared on the label, in their own field
  • TracesMay-contain statements, separate from allergens

Nutrients are per 100 g, and the serving size lets you show values per serving. Records also carry categories and packaging photos where available.

Allergens and traces, ready to use

Declared allergens and may-contain traces come back as separate fields, so your app can warn on them, filter on them, or show them without parsing label text.

They are the allergens declared on the product's source label, not a list derived from its ingredients. If your app warns users about allergens, show the ingredient list alongside them.

A real record: Kellogg's Baked Twists, 9310055598430

"allergens": [
  "Gluten",
  "Milk",
  "Soybeans",
  "Sulphur Dioxide And Sulphites"
],
"traces": ["Nuts", "Peanuts"]

Test it on your own products

  1. Read the barcode endpoint page: every parameter, every response field, and the errors you can hit.
  2. Download the sample file (11 records) and check its fields against the screen your app shows after a scan.
  3. For a match-rate test, get the larger sample and compare it with the products your users scan.
  4. To call the live API, start a free trial on Standard and scan the products in your kitchen. Limited has no trial.

Which plan fits a scanner

Below about 2,800 requests a month, Limited costs less. Above that, Standard does. The pricing page has a cost estimator.

Limited

$0 a month plus $0.01 per request. Barcode lookup only, at 30 requests a minute. No trial, and no response caching, so a rescan is a new request.

Standard

$25 a month plus $0.001 per request. All four endpoints, at 100 requests a minute, and responses may be cached for under 24 hours. Starts with a 5-day free trial; a card is required.

Common questions

What if a barcode isn't in the catalog?

The call returns a 404. The barcode page lists the fixes to try first: add or strip leading zeros to match the stored format. The catalog covers more than 850,000 products, so run the larger sample against the products your users scan most to see your match rate before you commit.

Do I need search, or only barcode lookup?

Limited covers barcode lookup only. For a search box, a browse screen, or ingredient lookup you need Standard or Premium. On Standard, each search endpoint accepts one search every 10 seconds, which suits occasional lookups but not a search box that fires as users type. Premium has no search pace. The same key keeps working when you change plans.

Can I cache scan results in my app?

On Standard and Premium, for under 24 hours. Limited doesn't allow caching.