Images

Upload Product Image

Changed on

Photos are source and proof of data. The first photo uploaded for a product is auto-selected as the product’s “front” photo.'

post/cgi/product_image_upload.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

codestring required

Barcode of the product

imagefieldstring required

Indicates the type of the image and the corresponding language. It should be in the format {IMAGE_TYPE}_{LANG} format, where IMAGE_TYPE is one of front|ingredients|nutrition|packaging and LANG is the 2 letter language code. Use other with no language code if you don't want the image to be selected. Note that the first image of a product is always selected as front picture.

imgupload_front_enstring binary required

This field must contain image binary content. The format and extension must be one of gif|jpeg|jpg|png|heic.
This field is dynamic and dependent on the value of imagefield in the request body. It wil be imgupload_the value of the imagefield stated earlier. For example, if imagefield=front_en, the name of this field should be imageupload_front_en.

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": "3017620422003",
  "imagefield": "front_en"
}

Response

OK

imgidinteger
statusstring
imagefieldstring
codestring

Example response

{
  "files": [
    {
      "url": "/product/3017620422003/nutella-ferrero",
      "name": "Nutella - Ferrero - 400g",
      "thumbnailUrl": "/images/products/301/762/042/2003/123.100.jpg",
      "code": "3017620422003"
    }
  ],
  "image": {
    "thumb_url": "123.100.jpg",
    "imgid": 123,
    "crop_url": "123.400.jpg"
  },
  "imgid": 123,
  "status": "status ok",
  "imagefield": "front_en",
  "code": "3017620422003"
}

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

    6 more changes in this revision