Products

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

Request

  • Base URL
    https://world.openfoodfacts.net
  • Auth
    API key in cookie session and API key in header User-Agent

Request body multipart/form-data

product_type'beauty' | 'food' | 'petfood' | 'product'

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.

codestring required

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

Password to authenticate with

lcstring

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

langstring

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

product_namestring

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

abbreviated_product_namestring

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

generic_namestring

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

ingredients_textstring

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

packaging_textstring

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

quantitystring

Product quantity with unit

labelsstring

Product labels (comma-separated list)

categoriesstring

Product categories (comma-separated list)

brandsstring

Product brands (comma-separated list)

storesstring

Stores where product is sold

countriesstring

Countries where product is sold

originsstring

Origins of ingredients

tracesstring

Traces of allergens

packagingstring

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

serving_sizestring

Serving size

nutrition_data_per'100g' | 'serving'

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.

commentstring

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_namestring

Name of the app providing the information

app_versionstring

Version of the app providing the information

app_uuidstring

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-Agentstring

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.

Example request

{
  "code": "0074570036004",
  "packaging": "Frozen"
}

Response

OK

status_verbosestring
statusinteger

Example response

{
  "status_verbose": "fields saved",
  "status": 1
}

Changes

    • breaking

      added to the request body allOf list

    • breaking

      the response's body type changed from no type to object for status

    • warning

      removed from the request body allOf list

    2 more changes in this revision