Upload Product Image
This endpoint allows to upload an image for a product. The image is uploaded in the request body as a base64 encoded string. Optionally, it is possible to select the uploaded image for specific information (e.g. front, ingredients, nutrition, packaging) for specific languages. Each selected image is a cropped version of the uploaded image.
If the product does not exist, it will be created.
Path Parameters
The barcode of the product corresponding to the image.
Image data for the product is passed in the image_data_base64 field as a base64 encoded string.
2 letter code of the language of the interface. Used for localizing some fields in returned values (e.g. knowledge panels). 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
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. Full list at https://static.openfoodfacts.org/data/taxonomies/countries.json
Username for login
Note: you must always use the username (and not the email) as it is far less brittle.
Password for login
password
Base64 encoded image data (supported formats: JPEG, PNG, GIF, HEIC)
Optional instructions to select (and possibly crop) the uploaded image for specific information (e.g. front, ingredients, nutrition, packaging) for specific languages.
Response Body
curl -X POST "https://world.openfoodfacts.org/api/v3/product/3017620422003/images" \
-H "Content-Type: application/json" \
-d '{
"lc": "fr",
"cc": "fr"
}'
{
"status_id": "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."
}
}
],
"product": {
"images": {
"uploaded": {}
}
}
}