Skip to content
All APIs

Food · 1 endpoint

Open Food Facts Product

One packaged food product by barcode — brand, ingredients, allergens, nutri-score, and the nutrition table per 100 g, from the open food database.

Status
Operational
Price
1 credit / request
Rate limit
120 / 60s
Cache
30m
Requests
0

Endpoint

How to call it

GET/v1/food/barcode/{barcode}

Code

Request — cURL

v1

curl https://api.diraz.co.id/v1/food/barcode/%7Bbarcode%7D \
  -H "Authorization: Bearer drz_live_…"

For AI agents

Callable through the MCP server with the same key:

call_api {"endpoint":"openfoodfacts-product","params":{"max_age":"60"}}

Parameters

barcodepath segment · required
The EAN/UPC barcode printed on the package.
max_ageinteger (seconds) · optional
Ask for data no older than this. Clamped to the product's own floor, so it can narrow the window but never force a refresh on every call.Default: 300

Example response

200 OK

JSON

{
  "data": {
    "barcode": "3017620422003",
    "name": "Nutella",
    "brand": "Ferrero",
    "quantity": "400 g",
    "categories": ["en-breakfasts", "en-spreads"],
    "ingredients": "Sugar, palm oil, hazelnuts, skimmed milk powder...",
    "allergens": ["en:milk", "en:nuts"],
    "nutriscore_grade": "e",
    "nova_group": 4,
    "serving_size": "15 g",
    "energy_kcal_100g": 539,
    "sugars_g_100g": 56.3,
    "salt_g_100g": 0.107,
    "fat_g_100g": 30.9,
    "proteins_g_100g": 6.3,
    "image": "https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.4.400.jpg",
    "url": "https://world.openfoodfacts.org/product/3017620422003"
  },
  "meta": {
    "request_id": "req_7Q2fK4mZ",
    "as_of": "2026-08-20T16:30:00.000Z",
    "age_seconds": 120,
    "next_update_at": "2026-08-20T17:00:00.000Z"
  }
}
barcode / name / brand / quantity
The barcode, product name, brand, and stated size.
nutriscore_grade / nova_group
The nutri-score letter and NOVA processing group, when scored.
ingredients / allergens / categories
The ingredient list as published, declared allergens, and category tags.
energy_kcal_100g / sugars_g_100g / salt_g_100g / fat_g_100g / proteins_g_100g
The nutrition table, per 100 g as declared.
image / url
The front-of-pack photo and the product's page.

Errors

When something goes wrong

Every failure carries a stable machine-readable code and the same meta.request_id a success carries — quote it and we can find your request. Errors are never billed.

401 Unauthorized

JSON

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "The API key is invalid, expired, or revoked."
  },
  "meta": {
    "request_id": "req_7Q2fK4mZ"
  }
}
UNAUTHORIZEDHTTP 401
Missing, malformed, expired, or revoked API key.
FORBIDDENHTTP 403
The key is valid but lacks the scope this product needs.
VALIDATION_ERRORHTTP 422
A query parameter is the wrong type or out of range.
RATE_LIMITEDHTTP 429
Rate limit exhausted. `Retry-After` says how long to wait.
SERVICE_UNAVAILABLEHTTP 503
No data recent enough to serve. Carries `Retry-After`, and is never billed.

Data freshness

Every response is timestamped

as_of is when the data was published, age_seconds how old it is now, and next_update_at when newer data is expected.

  • Up to date

    200

    Inside its published window. Almost every request.

  • Delayed

    delayed: true

    Newer data is late; you get the latest there is, flagged.

  • Unavailable

    503

    Nothing recent enough. Carries Retry-After, never billed.

Health

Is it up?

  • Open Food Facts Product

1/1 passing