Products

Edit Product

This updates a product.

Note: If the barcode exists then you will be editing the existing product, However if it doesn''t you will be creating a new product with that unique barcode, and adding properties to the product.

POST
/cgi/product_jqm2.pl
session<token>

Session cookie containing user ID, username, and session token. The value is structured as: user_id&username&user_session&session_token e.g. "user_id&exampleuser&user_session&abcdefghijklmnopqrstuvwxyz123456789ABCDEFGHIJKLM". The session token is obtained after successful login via the /cgi/session.pl endpoint.

In: cookie

User-Agent<token>

Identification using the User-Agent header. This is recommended in all requests so that we can contact you if there are issues. If we cannot identify the source of problematic API queries, we may have to block them. User-Agent header in the format 'app_name/app_version (URL or contact info)'

In: header

codestring

The barcode of the product to be added or edited

user_idstring

Username to authenticate with

Note: you must always use the username (and not the email) as it is far less brittle.

passwordstring

Password to authenticate with

Formatpassword
lc?string

2 letter code of the language of the interface. Used to determine the language of certain fields (e.g. product_name and taxonomy fields like categories and labels). If not passed, the language may be inferred by the country of the user (passed through the cc field or inferred by the IP address). Full list at https://static.openfoodfacts.org/data/taxonomies/languages.json

lang?string

2 letter language code of the main language of the product (the most prominent on the packaging)

product_name?string

Product name in the language sent in the lc field. For backward compatibility only, use the field product_name_[language_code] instead.

abbreviated_product_name?string

Abbreviated product name. For backward compatibility only, use the field abbreviated_product_name_[language_code] instead.

generic_name?string

Legal name of the product. For backward compatibility only, use the field generic_name_[language_code] instead.

ingredients_text?string

Raw list of ingredients text. For backward compatibility only, use the field ingredients_text_[language_code] instead.

packaging_text?string

Packaging information text. For backward compatibility only, use the field packaging_text_[language_code] instead.

quantity?string

Product quantity with unit

labels?string

Product labels (comma-separated list)

categories?string

Product categories (comma-separated list)

brands?string

Product brands (comma-separated list)

stores?string

Stores where product is sold

countries?string

Countries where product is sold

origins?string

Origins of ingredients

traces?string

Traces of allergens

packaging?string

Packaging type, format, material. The v3 API documentation has a more structured data for packaging.

serving_size?string

Serving size

nutrition_data_per?string

Whether nutrition data is per 100g or per serving. Note that this field applies to all nutriment fields (existing or new). So if its value is changed, all nutrients should be supplied, so that we don't have existing values per 100g when the new values are per serving, or vice versa.

Value in"100g" | "serving"
product_type?string

The product type is a fundamental separation that tells on which platform the product is made available: Open Food Facts, Open Beauty Facts, Open Pet Food Facts or Open Products Facts.

Each platform has variations on the way it analyses the product.

Changing the product type moves the product to the new platform. It must be done thoughtfully.

Value in"beauty" | "food" | "petfood" | "product"
comment?string

A comment on the contribution. It will be shown in product changes history. Adding meaningful comments help moderators and users understand a single product history.

app_name?string

Name of the app providing the information

app_version?string

Version of the app providing the information

app_uuid?string

When an app uses a single user to log its contributions, it might be interesting to know which user of the app is providing the information. You can use this field to provide an identifier (eg: an sha1 of the username) that's privacy preserving. Make sure that your salt is strong, perfectly random and secret

In case we have trouble with one of your user, it helps our moderators revert edits.

User-Agent?string

It is required that you pass a specific User-Agent header when you do an API request. But some times it's not possible to modify such a header (eg. request using JavaScript in a browser). In such cases, you can override it with this parameter.

product_name_(?<language_code>\w\w)string

Product name in language designated by language_code

abbreviated_product_name_(?<language_code>\w\w)string

Abbreviated product name in language designated by language_code

generic_name_(?<language_code>\w\w)string

Generic/legal name in language designated by language_code

ingredients_text_(?<language_code>\w\w)string

Ingredients list in language designated by language_code, as it appears on the packaging

packaging_text_(?<language_code>\w\w)string

Packaging information text in language designated by language_code

nutriment_(?<nutrient_id>[\w-]+)string

Value for the nutrient designated by nutrient_id (from nutrients.txt taxonomy, e.g. energy-kj, energy-kcal, fat, saturated-fat, etc.)

nutriment_(?<nutrient_id>[\w-]+)_unitstring

Unit for the nutrient designated by nutrient_id (from nutrients.txt taxonomy, e.g. energy-kj, fat etc.)

Response Body

curl -X POST "https://world.openfoodfacts.net/cgi/product_jqm2.pl" \  -F code="0074570036004" \  -F user_id="string" \  -F password="pa$$word"
{
  "status_verbose": "fields saved",
  "status": 1
}