Product by barcode (GTIN / EAN / UPC)
A product by its barcode: EAN-13, EAN-8, UPC-A, UPC-E or GTIN-14 (the check digit is verified; UPC-E is expanded). Looked up in the open product databases (food, cosmetics, pet food and other products; open data under the ODbL, source and license say where a record comes from). Returns name, generic name, brands, quantity and net quantity, serving size, categories, labels, origins, manufacturing places, countries and stores, packaging, packager codes, ingredients, allergens, traces, additives, vegan / vegetarian / palm-oil-free flags, nutrition facts per 100 g and per serving (energy, fat, saturated fat, carbohydrates, sugars, fiber, protein, salt, sodium and, when the label lists them, vitamins A, B1-B12, C, D, E and K, minerals such as calcium, iron, magnesium, zinc, phosphorus, potassium, copper, selenium and iodine, mono- and polyunsaturated fat, omega-3 and omega-6, starch, polyols, lactose, caffeine and taurine, all in grams), ingredients_detail (the parsed ingredient list: id, text, stated and estimated percent, vegan / vegetarian / palm-oil flags, E-number and additive class, origins and sub-ingredients), Nutri-Score, NOVA group, Eco-Score, food groups, product images (front, ingredients, nutrition, packaging), languages, completeness, scan count and created / updated dates. raw=true adds the full record. Answers 404 when no database knows the barcode.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
gtinrequired | string | Barcode digits (8, 12, 13 or 14). Example: 3017624010701 |
source | all | food | beauty | petfood | products | Which database to ask. Default: all |
raw | boolean | Also return the full record. Default: false |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/barcode/v1/lookup?gtin=3017624010701" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/barcode/v1/lookup",
params={"gtin": "3017624010701"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/barcode/v1/lookup");
url.searchParams.set("gtin", "3017624010701");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).