Compare nutrition of 2–5 products side by side

Compares 2–5 products side by side on nutrition, Nutri-Score and NOVA group, and names the one with the best Nutri-Score.

Request

GEThttps://food-nutrition.p.apihiver.com/v1/compare?barcodes=3017620422003%2C5449000000996
*
String. Comma-separated barcodes.
Language
Client
1curl --request GET \
2  --url 'https://food-nutrition.p.apihiver.com/v1/compare?barcodes=3017620422003%2C5449000000996' \
3  --header 'Accept: application/json' \
4  --header 'X-API-Key: YOUR_API_KEY'

Compare nutrition of 2–5 products side by side: Food Nutrition API reference

Compares 2–5 products side by side on nutrition, Nutri-Score and NOVA group, and names the one with the best Nutri-Score. This endpoint is part of the Food Nutrition API: Nutrition facts, ingredients, Nutri-Score and allergens for millions of packaged foods — by barcode or name.

Example response (200, application/json)

Success.

1{
2  "products": [
3    {
4      "name": "Nutella",
5      "brand": "Nutella, Ferrero",
6      "image": "https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.879.400.jpg",
7      "barcode": "3017620422003",
8      "quantity": "400 g e",
9      "nova_group": 4,
10      "nutri_score": "E",
11      "nutrition_per_100g": {
12        "fat_g": 30.9,
13        "salt_g": 0.107,
14        "fiber_g": 0,
15        "sodium_g": 0.0428,
16        "sugars_g": 56.3,
17        "protein_g": 6.3,
18        "energy_kcal": 539,
19        "carbohydrates_g": 57.5,
20        "saturated_fat_g": 10.6
21      }
22    },
23    {
24      "name": "Coca-Cola",
25      "brand": "COCA-COLA SERVICES SA/NV",
26      "image": "https://images.openfoodfacts.org/images/products/544/900/000/0996/front_en.1129.400.jpg",
27      "barcode": "5449000000996",
28      "quantity": "330 ml",
29      "nova_group": 4,
30      "nutri_score": "E",
31      "nutrition_per_100g": {
32        "fat_g": 0,
33        "salt_g": 0,
34        "sodium_g": 0,
35        "sugars_g": 10.6,
36        "protein_g": 0,
37        "energy_kcal": 42,
38        "carbohydrates_g": 10.6,
39        "saturated_fat_g": 0
40      }
41    }
42  ],
43  "attribution": "Data from Open Food Facts (openfoodfacts.org), ODbL",
44  "best_nutri_score": "3017620422003"
45}

Errors

  • 400 — A required parameter is missing or a value has the wrong format.
    1{
    2  "error": {
    3    "code": "INVALID_INPUT",
    4    "message": "barcodes: Field required"
    5  }
    6}

Gateway errors (missing key, no subscription, rate limits) are listed in Error codes.