Images

Upload Product Image

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

In: cookie

User-Agent<token>

Authentication using User-Agent header User-Agent header in the format 'app_name/app_version (email)'

In: header

codestring

Barcode of the product

imagefieldstring

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|other and LANG is the 2 letter language code. Use other 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_enfile

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.

Formatbinary
comment?string

A comment on the contribution. 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.

Response Body

curl -X POST "https://world.openfoodfacts.net/cgi/product_image_upload.pl" \
  -F code="3017620422003" \
  -F imagefield="front_en" \
  -F imgupload_front_en="string"
{
  "files": [
    {
      "url": "/product/3017620422003/nutella-ferrero",
      "filename": "",
      "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"
}