The Challenge of Extracting Global Food and Nutrition Data
Building a food intelligence platform, powering a nutrition app, or monitoring consumer packaged goods (CPG) market trends requires fast access to structured, reliable product data. Retailers, brand managers, and developers often need to analyze thousands of food items across international markets, tracking details like ingredients, allergens, processing levels, and nutritional profiles.
While Open Food Facts hosts a crowd-sourced catalog of over 3 million products worldwide, manually querying or extracting clean, targeted records presents operational hurdles. Requesting massive regional datasets without category narrowing can trigger API throttling, while standard raw database dumps require extensive post-processing to clean up missing or malformed fields.
The Open Food Facts Scraper solves this by providing a targeted, lightweight interface to query, filter, and extract structured grocery data directly into JSON or CSV datasets without requiring proxies, authentication, or session cookies.
Key Features of the Open Food Facts Scraper
The actor interacts directly with the public Open Food Facts JSON API over HTTP. It exposes nine distinct execution modes and built-in filtering parameters to help you isolate exact product subsets:
-
Flexible Query Modes: Retrieve products using nine specialized operational modes:
search,byBarcodes,byCategory,byBrand,byCountry,byStore,byLabel,byManufacturer, orbyUrls. -
Localized API Routing: When querying specific markets (such as
country: "united-states"orcountry: "france"), the scraper automatically directs requests to localized API endpoints (e.g.,us.openfoodfacts.orgorfr.openfoodfacts.org). This delivers localized catalog data while reducing payload bottlenecks. - Multi-Dimensional Nutritional Scoring: Extract standardized quality and processing metrics, including Nutri-Score (grades A to E), Eco-Score (environmental impact ratings A to E), and NOVA groups (food processing levels from 1 = unprocessed to 4 = ultra-processed).
- Dietary & Safety Filtering: Exclude specific allergens (like gluten, milk, or peanuts) and enforce required product labels (such as organic, vegan, or fair-trade) directly at fetch time.
- Clean, Omitted Null Outputs: Fields with empty or missing values are automatically omitted from output payloads, preventing unnecessary null clutter in downstream database storage.
Essential Input Parameters Explained
To build custom scraping workflows, you can combine several input schema fields depending on your target criteria:
-
mode(required): Defines the primary extraction path. Choose fromsearch,byBarcodes,byCategory,byBrand,byCountry,byStore,byLabel,byManufacturer, orbyUrls. -
searchQuery: Free-text string searching product names, brands, or ingredient lists (e.g.,chocolate). -
categorySlug: Target food categories using slug formats, such aschocolate-spreadsorpastas. -
brandSlug: Specify brand names such asnutella,danone,coca-cola, orkelloggs. -
nutriscore&ecoscore: Multi-select arrays accepting letter grades ("A","B","C","D","E") to filter products by health or environmental metrics. -
novaGroup: Multi-select array filtering by food processing levels[1, 2, 3, 4]. -
excludesAllergens: Array of allergen tags (e.g.,["gluten", "milk"]) to drop unsafe items. -
containsLabels: Array of required product certificates or labels (e.g.,["organic", "vegan"]). -
minProductCompleteness: An integer from0to100that drops incomplete crowd-sourced records. Setting a higher completeness requirement ensures output records contain rich nutriments and ingredient data. -
maxItems: An integer hard cap on the emitted records (1 to 1000).
For instance, to query organic, vegan chocolate spreads with high nutritional ratings in a single run, configure the input using single-property parameters:
{ "mode": "byCategory", "categorySlug": "chocolate-spreads", "containsLabels": ["organic", "vegan"], "nutriscore": ["A", "B"] }
To extract localized data for a specific retail store, set the retailer and country filters:
{ "mode": "byStore", "storeSlug": "carrefour", "country": "france", "maxItems": 100 }
Extracted Data Output Structure
Every product record returned by the actor delivers clean, standardized keys. Key fields contained in each returned product item include:
-
Product Identifiers: Universal barcodes (
codecanonicalized to EAN-13 / UPC-A format),productName,primaryBrand,brandsTags[], and directproductUrl. -
Categorization & Retail:
categoryHierarchy[],mainCategory,stores[],manufacturingPlaces, andcountries[]. -
Nutritional Panel (Per 100 g): The nested
nutrimentsobject contains standardized numerical values forenergyKcal,energyKj,fat,saturatedFat,carbohydrates,sugars,addedSugars,fiber,proteins,salt,sodium,cholesterol,iron,calcium, and vitaminsvitaminA,vitaminC, andvitaminD. -
Processing & Health Scores: Letter scores for
nutriscoreandecoscore, numericalnovaGroupclassifications (1 to 4), plusadditivesTags[]andallergensTags[]. -
Dietary Analysis: Raw
ingredientsTextalongside structuredingredientsAnalysisstatuses forpalmOilStatus,veganStatus, andvegetarianStatus. -
Media Assets: Direct links in
imageUrlsforfront,ingredients, andnutritionpanel photos.
How to Set Up and Run the Open Food Facts Scraper
Follow these four steps to execute your first data extraction on the Apify platform:
-
Open the Actor in Apify Console: Search for
openfoodfacts-scraperin the Apify Store and open the Actor task run page. -
Select Execution Mode and Primary Filters: Set your target
mode(such assearch,byCategory, orbyBarcodes). Enter target text insearchQueryor specify slugs likebrandSlugorcategorySlug. -
Refine Health & Dietary Rules: Set
minProductCompleteness(e.g.,50or higher) to drop partial entries. Enforce dietary rules usingexcludesAllergensor multi-selectnutriscorearrays. - Start the Run and Export Data: Click Start. Once execution finishes, inspect your dataset directly in the Console or export records via the API in JSON, CSV, Excel, or XML formats.
Practical Use Cases for Open Food Facts Data
1. Nutrition and Fitness App Data Ingestion
Developers building calorie counters or diet tracking applications can ingest barcode-keyed nutritional facts directly into their software. Using mode: "byBarcodes" with lists of EAN/UPC barcodes enables apps to auto-populate per-100 g nutriments, serving sizes, and allergen warnings instantly.
2. CPG Market Research & Competitor Benchmarking
Brand strategists can evaluate competitor portfolios across regional markets. By filtering by brandSlug or manufacturerSlug, researchers can analyze ingredient lists, monitor palm oil status across product ranges, and track how competitor products rank across Nutri-Score and Eco-Score metrics.
3. Retailer Assortment & Sustainability Audits
E-commerce managers and sustainability analysts can examine retailer catalog footprints using mode: "byStore". Combining store filters with ecoscore and packaging tags (packagingTags[]) surfaces insights on packaging recyclability, origin data, and certified sustainable products across major grocery chains.
Frequently Asked Questions
Do I need proxies or authentication to run this actor?
No. The Open Food Facts API is public, free, and open under the Open Database License (ODbL). The actor operates via HTTP requests without requiring proxies, cookies, or API keys. It employs small inter-request delays (≈200 ms) to respect host server guidelines politely.
What is the difference between Nutri-Score, Eco-Score, and NOVA groups?
- Nutri-Score: A front-of-pack nutritional grade (A best to E worst) calculated by balancing positive nutrients (fiber, protein, fruits/vegetables) against negative components (sugars, saturated fats, sodium).
- Eco-Score: An environmental impact rating (A best to E worst) assessing life-cycle impact, packaging recyclability, transport, and certifications.
- NOVA Group: A classification of food processing levels ranging from 1 (unprocessed foods like raw fruits or grains) to 4 (ultra-processed foods like soft drinks, packaged snacks, and ready meals).
Does the scraper track historical grocery prices?
No. Open Food Facts is a catalog of food product attributes, nutritional details, ingredients, and packaging specs. It does not store historical pricing data.
Ready to try it yourself? Run *Open Food Facts Scraper** on the Apify Store -- no setup required.*
Top comments (0)