# Barcode → Nutrition API (Open Food Facts, no key) (`synthetic.ia/openfoodfacts-nutrition`) Actor

Scan a barcode and get clean product data: nutrition per 100g, Nutri-Score, NOVA, ingredients, allergens, and image — or search millions of foods. Open Food Facts, no API key. HTTP API + MCP. Pay per query.

- **URL**: https://apify.com/synthetic.ia/openfoodfacts-nutrition.md
- **Developed by:** [Synthetic](https://apify.com/synthetic.ia) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 nutrition queries

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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

## Barcode → Nutrition API (Open Food Facts, no key)

Turn a **barcode into clean nutrition data** over a simple HTTP API — product name, brand, **nutrition per 100g**, **Nutri-Score**, **NOVA** processing group, ingredients, allergens and product image — or **search millions of foods**. Powered by Open Food Facts open data, wrapped into tidy JSON. No API key, no signup. Pay per query.

- 🏷️ **Barcode → nutrition** — one call returns a clean, normalized product
- 🥗 **Nutri-Score, NOVA, Eco-Score** — health & processing ratings ready to use
- 🔬 **Nutriments per 100g** — energy, fat, saturated fat, carbs, sugars, fiber, protein, salt, sodium
- ⚠️ **Ingredients & allergens** — parsed tags (milk, nuts, gluten…) + additives & labels
- 🔎 **Search** — by text, category or brand across millions of products
- ⚡ HTTP API (Standby) + usable from AI agents (MCP)

### Sample output (product)

```json
{
  "ok": true,
  "product": {
    "code": "3017620422003", "name": "Nutella", "brands": "Nutella, Ferrero", "quantity": "400 g",
    "nutriScore": "E", "novaGroup": 4, "ecoScore": "D",
    "nutrimentsPer100g": { "energyKcal": 539, "fat": 30.9, "saturatedFat": 10.6, "sugars": 56.3, "proteins": 6.3, "salt": 0.107 },
    "allergens": ["milk", "nuts", "soybeans"],
    "imageUrl": "https://images.openfoodfacts.org/…/front.jpg"
  }
}
```

### How to use

#### HTTP API (Standby — recommended)

Base URL: `https://synthetic-ia--openfoodfacts-nutrition.apify.actor` with header `Authorization: Bearer <APIFY_TOKEN>`.

| Endpoint | Body | Does |
|---|---|---|
| `POST /product` | `{ barcode }` | One product: nutrition, ratings, ingredients, allergens, image |
| `POST /search` | `{ q?, category?, brand?, page?, pageSize?: 1-50 }` | Matching products |
| `GET /` | — | Endpoint list |

`GET /product?barcode=3017620422003` also works (query-string form).

```bash
## Barcode → nutrition
curl -X POST ".../product" -H "Authorization: Bearer $APIFY_TOKEN" -d '{"barcode":"3017620422003"}'

## Search foods
curl -X POST ".../search" -H "Authorization: Bearer $APIFY_TOKEN" \
  -d '{"q":"greek yogurt","pageSize":10}'

## Search by category
curl -X POST ".../search" -H "Authorization: Bearer $APIFY_TOKEN" \
  -d '{"category":"breakfast-cereals","pageSize":20}'
```

### Input (one-shot run)

- **operation** — `product` or `search`.
- **barcode** — 4-14 digits (Product).
- **q** / **category** / **brand** / **pageSize** — Search filters.

### Use cases

Diet & health apps, calorie trackers, "scan a product" features, grocery tools, allergen checks, and any place you need clean nutrition data from a barcode without licensing a food database.

### Pricing

**Per query** from **$0.01** (drops to $0.003 on higher tiers). Platform usage included.

### Related Actors

- **[Weather API](https://apify.com/synthetic.ia/open-meteo-weather)**, **[ESPN Sports Data API](https://apify.com/synthetic.ia/espn-sports-api)**, **[Yahoo Finance API](https://apify.com/synthetic.ia/yahoo-finance-api)** — more clean no-key data APIs.

### FAQ

**Do I need a key?** No. Open Food Facts is open data.

**Which barcodes?** Millions of food products worldwide (EAN/UPC). Coverage is best in Europe and growing everywhere; some products may be missing or partly filled (it's crowdsourced).

**Is nutrition per serving or per 100g?** We return per-100g nutriments (the OFF standard); serving size is included when available.

### Legal

Data by [Open Food Facts](https://openfoodfacts.org), licensed under the **Open Database License (ODbL)** — you may reuse it, including commercially, provided you attribute Open Food Facts and share back any enrichment of the database under ODbL. Product images have their own licenses. This Actor is not affiliated with Open Food Facts.

# Changelog

This Actor's version history is a separate document: https://apify.com/synthetic.ia/openfoodfacts-nutrition/changelog.md

# Actor input Schema

## `operation` (type: `string`):

Look up one product by barcode, or search foods.

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

Product barcode (4-14 digits), e.g. 3017620422003.

## `q` (type: `string`):

Search: product/brand text (e.g. 'greek yogurt').

## `category` (type: `string`):

Search filter, English category tag (e.g. 'chocolates', 'breakfast-cereals').

## `brand` (type: `string`):

Search filter by brand (e.g. 'nestle').

## `pageSize` (type: `integer`):

1-50.

## Actor input object example

```json
{
  "operation": "product",
  "barcode": "3017620422003",
  "pageSize": 10
}
```

# Actor output Schema

## `result` (type: `string`):

The query result JSON.

## `runs` (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 = {
    "pageSize": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("synthetic.ia/openfoodfacts-nutrition").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 = { "pageSize": 10 }

# Run the Actor and wait for it to finish
run = client.actor("synthetic.ia/openfoodfacts-nutrition").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 '{
  "pageSize": 10
}' |
apify call synthetic.ia/openfoodfacts-nutrition --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,synthetic.ia/openfoodfacts-nutrition"
        }
    }
}
```

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/zRUIfwkdg25DSeSZI/builds/bt3mqHHUXJ77nk27E/openapi.json
