# Open Food Facts Scraper (`leorochasantos/open-food-facts`) Actor

Search Open Food Facts by product name or look up any EAN barcode. Returns nutrition facts, Nutri-Score, NOVA group, Eco-Score, ingredients, and categories — one flat typed row per product.

- **URL**: https://apify.com/leorochasantos/open-food-facts.md
- **Developed by:** [Leonardo Santos](https://apify.com/leorochasantos) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.95 / 1,000 food product 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Open Food Facts Scraper

Search the Open Food Facts database by product name or look up a product by its
EAN barcode. Returns structured nutrition facts, Nutri-Score, NOVA group,
Eco-Score, ingredients, and categories — one row per product, ready for
LLM/MCP consumption.

### Why this actor?

- **Clean, structured output** — flat JSON with typed nullable fields, no raw
  HTML to parse. Nutri-Score, NOVA group, and Eco-Score are extracted and
  normalized.
- **Dual-API resilience** — tries `world.openfoodfacts.org` first, silently
  falls back to `fr.openfoodfacts.org` on transport failures so your automation
  keeps running.
- **Predictable billing** — pay per delivered product row. Error items
  (product not found, upstream failures) are always free.
- **Agent-ready** — every row carries a `scraped_at` ISO timestamp,
  `productUrl` for traceability, and flat nullable fields that LLMs consume
  without confusion.

### Input

```json
{
  "mode": "search",
  "query": "chocolate",
  "maxResults": 10,
  "country": "world"
}
```

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `mode` | `"search"` or `"barcode"` | `"search"` | Search by name or look up a specific barcode. |
| `query` | string | — | Product name or keyword (required in search mode). |
| `barcode` | string | — | EAN-13 barcode (required in barcode mode). |
| `maxResults` | 1–100 | 10 | Max products to return (search mode only). |
| `country` | `"world"` or `"fr"` | `"world"` | OFF instance to query. Falls back to the other on failure. |

### Output

One item per product:

```json
{
  "input": "chocolate",
  "code": "3017620422003",
  "productName": "Nutella",
  "brand": "Ferrero",
  "quantity": "400 g",
  "categories": ["spreads", "sweet spreads", "hazelnut spreads", "chocolate spreads"],
  "nutriscore": "e",
  "novaGroup": 4,
  "ecoscore": "d",
  "ingredientsText": "Sugar, palm oil, hazelnuts (13%), ...",
  "imageUrl": "https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.123.400.jpg",
  "productUrl": "https://world.openfoodfacts.org/product/3017620422003",
  "error": null,
  "scraped_at": "2026-07-17T00:00:00.000Z"
}
```

Error items have `error` set to a non-null message and are **never charged**.

### Pricing

Pay per event, and **the platform usage is on us** — the price you see is the price you pay, with no compute bill on top.

| Event | Price | What one charge buys |
|---|---|---|
| Food Product Result | **$0.003** | One product row delivered. Error items (product not found, upstream failures) are never charged. |
| Actor Start | **$0.002** | One run, whatever it returns. |

Higher Apify subscription tiers pay less on every event (Silver −20%, Gold −35%).

### Use cases

- **Nutrition monitoring** — track Nutri-Score and NOVA group for a portfolio
  of products over time.
- **Grocery data enrichment** — resolve barcodes to full nutrition and
  ingredient profiles.
- **Product discovery** — search for products by keyword and compare nutrition
  scores across brands.
- **LLM pipelines** — feed structured food data into agent tool calls, RAG,
  or analytics dashboards.

### FAQ

**Where does the data come from?** The [Open Food Facts](https://world.openfoodfacts.org/)
database — a collaborative, free, and open database of food products from
around the world.

**What barcode formats are supported?** EAN-13, EAN-8, UPC-A, and UPC-E
barcodes are supported by the Open Food Facts API.

***

*This Actor is an independent tool and is not affiliated with or endorsed by
Open Food Facts.*

# Actor input Schema

## `mode` (type: `string`):

Search by product name/query or look up a specific product by barcode (EAN).

## `query` (type: `string`):

Product name or keyword to search for (required in search mode).

## `barcode` (type: `string`):

Product barcode (EAN-13 or similar) to look up (required in barcode mode).

## `maxResults` (type: `integer`):

Maximum number of products to return (search mode only, 1–100).

## `country` (type: `string`):

Open Food Facts instance to query. Falls back to the other on failure.

## `proxyConfiguration` (type: `object`):

Proxy to use for outgoing requests.

## Actor input object example

```json
{
  "mode": "search",
  "query": "chocolate",
  "barcode": "3017620422003",
  "maxResults": 10,
  "country": "world",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

# 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 = {
    "query": "chocolate",
    "barcode": "3017620422003"
};

// Run the Actor and wait for it to finish
const run = await client.actor("leorochasantos/open-food-facts").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 = {
    "query": "chocolate",
    "barcode": "3017620422003",
}

# Run the Actor and wait for it to finish
run = client.actor("leorochasantos/open-food-facts").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 '{
  "query": "chocolate",
  "barcode": "3017620422003"
}' |
apify call leorochasantos/open-food-facts --silent --output-dataset

```

## MCP server setup

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

```

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/iQ29VABkcGbLR77Bv/builds/iZW9faBznRQ70TyU7/openapi.json
