# Nutrition Food Lookup (`easyapi/nutrition-food-lookup`) Actor

Search Open Food Facts by keyword or barcode — nutrition, Nutri-Score, ingredients.

- **URL**: https://apify.com/easyapi/nutrition-food-lookup.md
- **Developed by:** [EasyApi](https://apify.com/easyapi) (community)
- **Categories:** Agents
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 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.

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

## Nutrition Food Lookup

Look up packaged foods from Open Food Facts by keyword or barcode. Get nutrition-per-100g, Nutri-Score, NOVA group, Eco-Score, ingredients, allergens, and product images as structured Dataset rows — ideal for meal apps, retail enrichment, and research pipelines.

### Features

- **Search mode** — keyword queries across the global Open Food Facts catalog
- **Barcode mode** — exact GTIN / EAN / UPC product codes
- Nutrition macros per 100g (energy, fat, carbs, sugars, fiber, protein, salt, sodium)
- Nutri-Score, NOVA, Eco-Score when the source provides them
- Ingredients text, allergens, traces, brands, categories, countries
- Light pacing between requests; no API key required

### Modes

| Mode | Input | Behavior |
| --- | --- | --- |
| `search` | `queries[]` | Keyword search, capped by `maxItems` |
| `barcode` | `barcodes[]` | One product per code (or error row) |

### Input

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `mode` | string | `search` | `search` or `barcode` |
| `queries` | array | — | Keywords for search mode |
| `barcodes` | array | — | Product barcodes for barcode mode |
| `maxItems` | integer | `20` | Max products to return (1–100) |

#### Search example

```json
{
  "mode": "search",
  "queries": ["oat milk", "greek yogurt"],
  "maxItems": 20
}
```

#### Barcode example

```json
{
  "mode": "barcode",
  "barcodes": ["3017620422003", "5000112586404"]
}
```

### Output

One Dataset item per product:

| Field | Description |
| --- | --- |
| `code` | Barcode / product code |
| `productName` | Display name |
| `brands` / `quantity` / `categories` / `labels` | Catalog metadata |
| `countries` | Markets / countries tags |
| `ingredientsText` | Ingredients blurb |
| `allergens` / `traces` | Allergen information |
| `nutriscoreGrade` / `novaGroup` / `ecoscoreGrade` | Score fields when present |
| `imageUrl` / `url` | Image and product page |
| `energyKcal100g` | Calories per 100g |
| `fat100g` / `saturatedFat100g` | Fat macros |
| `carbohydrates100g` / `sugars100g` / `fiber100g` | Carb macros |
| `proteins100g` / `salt100g` / `sodium100g` | Protein and salt |
| `sourceQuery` | Query or barcode that produced the row |
| `error` | Present when a barcode / search failed |
| `scrapedAt` | ISO timestamp |

#### Example shape

```json
{
  "kind": "product",
  "code": "5010029200014",
  "productName": "Oat Drink",
  "brands": "Example Brand",
  "nutriscoreGrade": "a",
  "novaGroup": 1,
  "energyKcal100g": 46,
  "fat100g": 1.5,
  "carbohydrates100g": 6.6,
  "sugars100g": 4.1,
  "proteins100g": 1.0,
  "salt100g": 0.09,
  "url": "https://world.openfoodfacts.org/product/5010029200014",
  "sourceQuery": "oat milk"
}
```

### Use cases

- Enrich grocery SKUs with Nutri-Score and macros
- Power barcode scanners in consumer apps
- Research category nutrition distributions from open data

### Scope notes

- Coverage is strongest for packaged foods; restaurant dishes and fresh produce are sparse.
- Score fields (`nutriscoreGrade`, `novaGroup`, `ecoscoreGrade`) are missing for many products — treat null as “unknown”, not “healthy”.
- Upstream availability can vary by region; failed searches return an error row instead of crashing the run.

### Tips

- Start with one query and `maxItems: 5` to inspect field quality for your category.
- Prefer barcode mode when you already have GTINs — results are more precise.
- Keep batches moderate; the Actor already inserts short delays between requests.

# Actor input Schema

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

search = keyword. barcode = product barcodes / GTINs.

## `queries` (type: `array`):

Keywords for search mode.

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

Product barcodes for barcode mode.

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

Maximum products to return (1–100).

## Actor input object example

```json
{
  "mode": "search",
  "queries": [
    "oat milk"
  ],
  "maxItems": 10
}
```

# Actor output Schema

## `overview` (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 = {
    "mode": "search",
    "queries": [
        "oat milk"
    ],
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("easyapi/nutrition-food-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 = {
    "mode": "search",
    "queries": ["oat milk"],
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("easyapi/nutrition-food-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 '{
  "mode": "search",
  "queries": [
    "oat milk"
  ],
  "maxItems": 10
}' |
apify call easyapi/nutrition-food-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,easyapi/nutrition-food-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/sc26a4Sigkonv9W99/builds/CwREWaf1Cv5jbyjGd/openapi.json
