# Open Food Facts Barcode Lookup (`sourcewise/open-food-facts-barcode-lookup`) Actor

Looks up EAN-8, EAN-13, or UPC barcodes via the public Open Food Facts API and returns product name, brand, categories, ingredients, Nutri-Score, labels, quantity, and image URL with change monitoring.

- **URL**: https://apify.com/sourcewise/open-food-facts-barcode-lookup.md
- **Developed by:** [Sourcewise](https://apify.com/sourcewise) (community)
- **Categories:** Lead generation, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Open Food Facts Barcode Lookup

Look up EAN-8, EAN-13, or UPC barcodes via the public Open Food Facts API. Returns product name, brand, categories, ingredients, Nutri-Score, labels, quantity, and image URL. Includes change monitoring to detect new or updated products since the last run.

Data © Open Food Facts contributors, Open Database License (ODbL) and Creative Commons Attribution-ShareAlike (CC-BY-SA).

### Who this is for

- E-commerce teams enriching product catalogs with standardized food data.
- Nutrition apps needing ingredients, allergens, and Nutri-Score grades.
- Market researchers tracking product formulations and label changes.
- Retailers verifying packaging claims (organic, vegan, gluten-free) across suppliers.

### Use cases

- Bulk-enrich a product database with missing nutrition and ingredient information.
- Monitor competitor product reformulations by scheduling daily runs with change detection.
- Validate label compliance for private-label products against Open Food Facts community data.
- Build ingredient-based filtering (allergens, additives, dietary preferences) for consumer apps.

### Input

Provide either a CSV file (upload or public URL) with a column named `barcode` or `ean`, or a direct array of barcode strings. The CSV method is primary; the array serves as a fallback.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `csvFile` | string | Yes\* | Public URL or uploaded CSV file containing a `barcode` or `ean` column. |
| `barcodes` | array\[string] | No | Fallback list of EAN-8, EAN-13, or UPC codes (e.g., `["3017620422003", "5449000000996"]`). |
| `onlyNew` | boolean | No | When `true`, outputs only barcodes that are new or have changed since the previous run. Default `false`. |
| `delayMs` | integer | No | Pause between API calls to respect rate limits. Default `1000` ms. |
| `maxItems` | integer | No | Maximum number of barcodes to process per run. Default `100`. |

\*Either `csvFile` or `barcodes` must be provided.

#### Example input

{
"csvFile": "https://example.com/barcodes.csv",
"barcodes": \["3017620422003", "5449000000996", "4001686012345"],
"onlyNew": false,
"delayMs": 1000,
"maxItems": 100
}

### Output

Each result is an object with the following fields. Fields marked *required* are always present; others appear when the product is found.

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `barcode` | string | Yes | The queried barcode (EAN-8, EAN-13, or UPC). |
| `found` | boolean | Yes | Whether the product was found in Open Food Facts. |
| `productName` | string | No | Product name as listed. |
| `brands` | string | No | Brand(s) associated with the product. |
| `categories` | string | No | Category hierarchy (comma-separated). |
| `ingredientsText` | string | No | Ingredients list as text. |
| `nutriScoreGrade` | string | No | Nutri-Score letter grade (a–e). |
| `labels` | string | No | Labels/tags (comma-separated, e.g., organic, vegan). |
| `quantity` | string | No | Product quantity (e.g., `200 g`, `1.5 L`). |
| `imageUrl` | string | No | URL of the product front image. |
| `changedAt` | string | No | ISO timestamp when this result was detected as new or changed (only in monitoring mode). |
| `previousValues` | object | No | Previous values for fields that changed (only when `onlyNew=true`). |

#### Example output

\[
{
"barcode": "3017620422003",
"found": true,
"productName": "Nutella",
"brands": "Ferrero, Nutella",
"categories": "Cocoa and hazelnuts spreads, Confectionary based spreads",
"ingredientsText": "Ingrédients : Sucre, Huile De Palme, Noisettes 13%, Cacao Maigre 7, 4%, Lait Écrémé En Poudre 6, 6%, Lactoserum En Poudre, Émulsifiants : Lécithines Soja], Vanilline, Sans Gluten,",
"nutriScoreGrade": "e",
"labels": "Vegetarian, No gluten, Triman",
"quantity": "400 g e",
"imageUrl": "https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.879.400.jpg",
"changedAt": null,
"previousValues": null
},
{
"barcode": "5449000000996",
"found": true,
"productName": "Coca-Cola Original",
"brands": "Coca-Cola",
"categories": "Bebidas de cola",
"ingredientsText": "ماء غازي، سكر، ملون 50 ، مشروب غازي بمستخلصات نباتية طرف المركز العمرا کوکاکوا المشرویات بتونس، شارع الأن ترخیض سجلة کوکاکولا، کوک جاف مگان نظیف پایان حسطّ و یحبد CAZEUGE AUX FYT الاستهلاك قبل",
"nutriScoreGrade": "e",
"labels": "Hecho en la UE, Triman",
"quantity": "330 ml",
"imageUrl": "https://images.openfoodfacts.org/images/products/544/900/000/0996/front_en.1129.400.jpg",
"changedAt": null,
"previousValues": null
}
]

### Pricing

Pay per result: approximately $2 per 1,000 results. You are charged only for successful lookups (products found or not found). The first run with `onlyNew=true` returns all products; subsequent runs return only changes.

### Limits

- Rate limit: default 1 request per second (adjustable via `delayMs`).
- Open Food Facts API allows generous usage; please respect their terms of use.
- Maximum items per run: configurable via `maxItems` (default 100).
- Change monitoring requires persistent storage; the actor stores state between runs automatically.

### Source

Data sourced from [Open Food Facts](https://world.openfoodfacts.org/) – open food product database. Licensed under ODbL (database) and CC-BY-SA (content). This actor is not affiliated with or endorsed by Open Food Facts.

### Example output

```json
[
  {
    "barcode": "3017620422003",
    "found": true,
    "productName": "Nutella",
    "brands": "Ferrero, Nutella",
    "categories": "Cocoa and hazelnuts spreads, Confectionary based spreads",
    "ingredientsText": "Ingrédients : Sucre, Huile De Palme, Noisettes 13%, Cacao Maigre 7, 4%, Lait Écrémé En Poudre 6, 6%, Lactoserum En Poudre, Émulsifiants : Lécithines Soja], Vanilline, Sans Gluten,",
    "nutriScoreGrade": "e",
    "labels": "Vegetarian, No gluten, Triman",
    "quantity": "400 g e",
    "imageUrl": "https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.879.400.jpg",
    "changedAt": null,
    "previousValues": null
  },
  {
    "barcode": "5449000000996",
    "found": true,
    "productName": "Coca-Cola Original",
    "brands": "Coca-Cola",
    "categories": "Bebidas de cola",
    "ingredientsText": "ماء غازي، سكر، ملون 50 ، مشروب غازي بمستخلصات نباتية طرف المركز العمرا کوكاکوا المشرويات بتونس، شارع الأن ترخيض سجلة كوكاكولا، كوك جاف مگان نظيف نهاية حسطّ ويحبد CAZEUGE AUX FYT الاستهلاك قبل",
    "nutriScoreGrade": "e",
    "labels": "Hecho en la UE, Triman",
    "quantity": "330 ml",
    "imageUrl": "https://images.openfoodfacts.org/images/products/544/900/000/0996/front_en.1129.400.jpg",
    "changedAt": null,
    "previousValues": null
  }
]
```

# Actor input Schema

## `csvFile` (type: `string`):

Upload a CSV file or provide a public URL to a CSV file with a column named 'barcode' or 'ean' containing the codes. This is the primary input.

## `barcodes` (type: `array`):

Array of EAN-8, EAN-13, or UPC codes (strings). Used only if CSV file is not provided. Example: \["3017620422003", "737628064502"]

## `onlyNew` (type: `boolean`):

When on, outputs only barcodes that are new or have changed data since the previous run. Off by default.

## `delayMs` (type: `integer`):

Pause between API calls to respect rate limits. Default 1000 ms.

## `maxItems` (type: `integer`):

Stop after this many results (you pay per result).

## Actor input object example

```json
{
  "csvFile": "https://example.com/barcodes.csv",
  "barcodes": [
    "3017620422003",
    "5449000000996",
    "4001686012345"
  ],
  "onlyNew": false,
  "delayMs": 1000,
  "maxItems": 100
}
```

# Actor output Schema

## `results` (type: `string`):

One item per result, with: barcode, found, productName, brands, categories, ingredientsText, nutriScoreGrade, labels, quantity, imageUrl, changedAt, previousValues.

## `summary` (type: `string`):

How many results the run returned, and when it finished.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "csvFile": "https://example.com/barcodes.csv",
    "barcodes": [
        "3017620422003",
        "5449000000996",
        "4001686012345"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sourcewise/open-food-facts-barcode-lookup").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "csvFile": "https://example.com/barcodes.csv",
    "barcodes": [
        "3017620422003",
        "5449000000996",
        "4001686012345",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("sourcewise/open-food-facts-barcode-lookup").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "csvFile": "https://example.com/barcodes.csv",
  "barcodes": [
    "3017620422003",
    "5449000000996",
    "4001686012345"
  ]
}' |
apify call sourcewise/open-food-facts-barcode-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sourcewise/open-food-facts-barcode-lookup"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/zKNLOg7VhzW4sKkqD/builds/8l26heAJA4AyH74Eb/openapi.json
