Products

Get Product Data

Changed on

Retrieve information for a product with a specific barcode.

The fields parameter allows to specify what fields to retrieve.

get/api/v3/product/{code}

Request

  • Base URL
    https://world.openfoodfacts.org
  • Auth
    API key in header User-Agent

Path parameters

codestring required
Example:3017620422003

The barcode of the product to be fetched

Query parameters

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

Expected product type of the requested product

Example:all

Used for READ queries for one product. Expected product type of the requested product. Defaults to the product type of the server the query is sent to (e.g. 'food' for Open Food Facts, 'beauty' for Open Beauty Facts, etc.). 'all' matches all product types. If the product exists on a different server that matches the requested product type, the API will return a 302 redirect to the correct server. Otherwise, the API will return a 404 error. It is possible that new product types will be added in the future.

ccstring
Example:us

2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request.

lcstring
Example:fr

2 letter code of the language of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the language may be inferred by the domain name prefix.

tags_lcstring
Example:fr

2 letter language code to request names of tags in a specific language.

For READ requests: if passed, all taxonomized tags of the response will include a lc_name property with the translation in the requested language, if available. Otherwise, the property value will contain the name in the original language, prefixed by the 2 language code and a colon.

For WRITE requests: if passed, taxonomized tags fields with a lc_name property will be considered to be in this language.

fieldsstring

Comma separated list of fields requested in the response.

Special values:

  • "none": returns no fields
  • "raw": returns all fields as stored internally in the database
  • "all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels".

Defaults to "all" for READ requests. The "all" value can also be combined with fields like "attribute_groups" and "knowledge_panels".

knowledge_panel_clientstring
Example:web

Client requesting knowledge panels. Used to customize which knowledge panels are returned. Example values: "web", "mobile". Defaults to "app" for all API requests, and "web" for all other requests.

activate_knowledge_panels_simplifiedboolean
Example:true

If true, knowledge panels will include the simplified_root knowledge panel its simplified sub-panels (e.g. simplified health and environment cards)

activate_knowledge_panels_ingredients_nutrition_firstboolean
Example:true

If true, the root knowledge panel starts with an ingredients card and a nutrition card, followed by collapsed health and environment cards with a one-line summary, the product information card, and a collapsed report a problem card. The ingredients and nutrition cards are part of the health card: knowledge_panels_included and knowledge_panels_excluded select them with health_card

activate_knowledge_panel_physical_activitiesboolean
Example:true

If true, knowledge panels will include the physical activities panel

activate_knowledge_panel_product_historyboolean
Example:true

If true, and if the user is logged in, knowledge panels will include the product_history panel (a table of the changes history of the product, in the contribution card)

activate_knowledge_panel_product_informationboolean
Example:true

If true, the product_card panel also lists the storage conditions and customer service of the product when filled, and a sources_manufacturer panel is returned for products of a producer organization

knowledge_panels_includedstring
Example:health_card, environment_card

When knowledge_panels are requested, you can specify which panels should be in the response. All the others will be excluded.

knowledge_panels_excludedstring
Example:health_card, environment_card

When knowledge_panels are requested, you can specify which panels to exclude from the response. All the others will be included. If a panel is both excluded and included (with the knowledge_panels_excluded parameter), it will be excluded.

Response

OK

status'success' | 'success_with_warnings' | 'success_with_errors' | 'failure'

Overall status of the request: whether it failed or succeeded, with or without warnings or errors.

Example response

{
  "status": "success_with_errors",
  "result": {
    "id": "product_updated",
    "name": "Product updated",
    "lc_name": "Produit mis à jour"
  },
  "errors": [
    {
      "message": {
        "id": "sugars_higher_than_carbohydrates",
        "name": "Sugars higher than carbohydrates",
        "lc_name": "Sucres plus élevés que les glucides",
        "description": "Sugars (40g) are higher than carbohydrates (35g).",
        "lc_description": "Les sucres (40g) sont plus élévés que les glucdes."
      },
      "field": {
        "id": "nutriment.sugars",
        "value": "40"
      },
      "impact": {
        "id": "nutrients_not_updated",
        "name": "Nutrients not updated",
        "lc_name": "Nutriments non mis à jour",
        "description": "The nutrients were not updated.",
        "lc_description": "Les nutriments n'ont pas été mis à jour."
      }
    }
  ]
}

Changes

    • breaking

      the allOf[subschema #2]/product response's property type changed from no type to object for status

    • info

      added the new optional query request parameter activate_knowledge_panel_physical_activities

    • info

      added the new optional query request parameter activate_knowledge_panel_product_history

    13 more changes in this revision