Reference: API CheatSheet
This reference cheatsheet gives you a quick reminder to send requests to the OFF API.
If you are new to API usage you might look at the tutorial. Also, refer to the API reference documentation for complete information.
Add/Edit an Existing Product
Indicate the absence of nutrition facts
no_nutrition_data=on (indicates if the nutrition facts are not indicated on the food label)Add nutrition facts values, units and base
nutrition_data_per=100g
OR
nutrition_data_per=serving
serving_size=38gnutriment_energy=450
nutriment_energy_unit=kJAdding values to a field that is already filled
You just have to prefix
add_before the name of the field
add_categories
add_labels
add_brandsAdding nutrition facts for the prepared product
You can send prepared nutritional values
- nutriment_energy-kj (regular)
- nutriment_energy-kj_prepared (prepared)
Read Product Data
Get product with blame information
To get information about who last modified each field of a product, add the blame parameter:
https://world.openfoodfacts.org/api/v2/product/3017620422003.json?blame=1This returns additional blame information showing:
userid: Who last modified each fieldt: Timestamp of the modificationrev: Revision numbervalue: Current value of the field
Limit response fields
Use the fields parameter to get only specific product data:
https://world.openfoodfacts.org/api/v2/product/3017620422003.json?fields=product_name,brands,nutrimentsSearch for Products
Important: full text search currently works only for v1 API (or search-a-licious, which is in beta)
-
The future of search in Open Food Facts is the search-a-licious project, deployed, in beta, at search.openfoodfacts.org. It has an API: Search-a-licious API
Get suggestions for fields
New solution: Search-a-licious (has all actually used values)
Get brands, categories, labels… suggestions using the Search-a-licious API. You can also use the classic suggest.pl route
Legacy solution: suggest.pl (has all taxonomized values, and only taxonomized values)
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=emb_codes&term=FR
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=categories&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=labels&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=ingredients&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=packaging_shapes&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=packaging_materials&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=packaging_shapes&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=languages&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=stores&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=brands&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=countries&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=traces&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=origins&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=states&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=nutrients&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=additives&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=allergens&term=f
- https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=minerals&term=f
Get data for a list of products
You can use comma to separate multiple values of a query parameter. This allows you to make bulk requests. The product result can also be limited to specified data using fields.
https://world.openfoodfacts.org/api/v2/search?code=3263859883713,8437011606013,6111069000451&fields=code,product_nameGet taxonomy-based suggestions (v3 API)
The v3 API provides suggestions based on taxonomy fields such as synonyms, categories, and packaging shapes.
Reference documentation:
https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#get-/api/v3/taxonomy_suggestions
Example requests:
Get suggestions from synonyms
https://world.openfoodfacts.org/api/v3/taxonomy_suggestions?tagtype=labels&lc=fr&string=f&get_synonyms=1Get suggestions for a specific category
https://world.openfoodfacts.org/api/v3/taxonomy_suggestions?tagtype=categories&string=organicGet suggestions based on packaging shape
https://world.openfoodfacts.org/api/v3/taxonomy_suggestions?tagtype=packaging_materials&shape=box