---
title: "Look up a food by barcode"
method: GET
path: "/barcode/{code}"
tags: ["Foods"]
---

# Look up a food by barcode

`GET /barcode/{code}`

Look up a food by EAN-13 or UPC-A barcode.

## Path parameters

- `code` string, required

## Response `200`

The matching food

- FoodResult — A single food record. Every nutrient value is expressed PER 100 GRAMS of the food, not per serving. To report a portion, multiply by grams and divide by 100 — e.g. an olive oil returning calories_kcal 831 is 831 kcal per 100 g, so a 13 g tablespoon is 108 kcal. Use serving_size_g to translate a serving into grams, but never treat the nutrient values as a per-serving figure.
  - `id` integer
  - `name` string
  - `brand` string, nullable
  - `barcode` string, nullable
  - `category` string, nullable
  - `serving_size_g` number, nullable — Grams in one manufacturer serving, where the source declares one. Descriptive only: the nutrient fields below are not scaled to it. Null on roughly a third of records.
  - `serving_desc` string, nullable — Human-readable label for one serving, e.g. '3/4 cup (170 g)'.
  - `calories_kcal` number, nullable — Energy in kcal per 100 g
  - `protein_g` number, nullable — Protein in grams per 100 g
  - `fat_g` number, nullable — Total fat in grams per 100 g
  - `carbs_g` number, nullable — Carbohydrate in grams per 100 g
  - `fiber_g` number, nullable — Fibre in grams per 100 g
  - `sugar_g` number, nullable — Sugars in grams per 100 g
  - `sodium_mg` number, nullable — Sodium in mg per 100 g
  - `saturated_fat_g` number, nullable — Saturated fat in grams per 100 g
  - `cholesterol_mg` number, nullable — Cholesterol in mg per 100 g
  - `potassium_mg` number, nullable — Potassium in mg per 100 g
  - `image_url` string, nullable
  - `image_thumb_url` string, nullable
  - `source` string — Data source: off (Open Food Facts), usda (USDA FoodData Central), claude (labeled AI estimate) or community
  - `confidence` number — Data confidence score, 0–1
  - `static_url` string, nullable — Path of the human-readable page on www.getdietly.com

## Other responses

- `404` — No food with this barcode
- `429` — Rate limit exceeded. Check the Retry-After and X-RateLimit-* headers.

---

[API](https://skmtc.net/getdietly/apis/dietlyapi.md) · [All operations](https://skmtc.net/getdietly/apis/dietlyapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/getdietly/dietlyapi/revisions/52a57a48ae8d/schema)
