Skip to content

Nutrition label OCR API

Nutrition label OCR API: a photo of the pack in, nutrients out

Send a photo of the nutrition table printed on a pack. You get back 21 nutrients as separate JSON fields and a NutriScore grade from A to E with a one-line reason. It reads the label you photographed, so it does not depend on the product being listed in a barcode database.

The test key costs nothing. Credit packs start at $49, with no subscription.

A bowl of plain yogurt on a table

Printed on the pack

Plain yogurt, per 100 g

61kcal

Fat 3.3 g, sugars 4.7 g, protein 3.5 g, salt 0.1 g.

An example of the values on a pack. The scan returns each one as its own field, per pack or per serving as the table states them.

What is a nutrition label OCR API?

It reads the nutrition table printed on a food pack from a photo and returns the numbers as structured data. NutriScan does this with type: "label" on POST /v1/scans.

The same endpoint also takes meal photos and text. A label scan reads the figures printed on the pack.

"I have the pack. I do not have a clean data source for it."

Typing calories, fat, sugars, protein and sodium from a photo takes minutes per product. The scan returns them as fields you can store, sort and show.

"I need a grade, not just a table."

Every result carries a NutriScore grade from A to E and one sentence on why, in the language you ask for. That gives you a field to sort and filter on.

"The numbers must match what is printed."

The result follows the table on the pack, per pack or per serving. Each item has a source field, so you can tell a read value from an estimate.

When does a label photo beat a barcode?

When you hold the pack but the barcode leads nowhere, or when you never had a code to start with. A label photo needs only the pack in front of a camera.

Store brands

A supermarket's own muesli or the Eigenmarke yogurt from a German discounter may have no entry anywhere you can query. The table is on the pack either way.

Regional products

A cheese from a French cooperative or a regional snack sold in a few US states can be missing from a general dataset. A photo of its table is enough.

New and reformulated products

A new recipe prints new numbers on the pack on day one. A photo reads what is printed now.

Nutrition label OCR or a barcode lookup, which do you need?

Use a barcode lookup when you have codes and want data from a product database. Use label OCR when you have photos of packs. NutriScan offers the second.

Label photo scan (NutriScan)Barcode lookup service
You sendA photo of the nutrition tableA barcode number
Works whenThe table is readable in the photoThe product is in that service's database
You get21 nutrients, a NutriScore grade and its reasonThe record that service holds for the product
Search by codeNot offered. No barcode endpointYes

How do you read a nutrition label with an API?

Post the photo, as a public https link or base64 data, with type set to label. The result comes back in the same response.

curl https://platform-api.nutriscan.app/v1/scans \
  -H "Authorization: Bearer $NUTRISCAN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "label",
    "image_url": "https://example.com/granola-bar-back.jpg",
    "language": "en"
  }'

The same call from Python, sending a photo of a German pack from disk and asking for German names. Set language to fr for French.

import base64, os, uuid, requests
# read the photo
with open("haferflocken-packung.jpg", "rb") as f:
    image = base64.b64encode(f.read()).decode()
# send it as image_base64
resp = requests.post(
    "https://platform-api.nutriscan.app/v1/scans",
    headers={
        "Authorization": f"Bearer {os.environ['NUTRISCAN_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={"type": "label", "image_base64": image, "language": "de"},
    timeout=100,
)
scan = resp.json()
print(scan["meal"]["nutri_score"], scan["credits_used"])

The response is the same JSON as any scan. This is the fixed sample a test key returns, shortened, so you can build against the real shape before you buy credits. A live label scan fills the same fields from the pack.

{
  "id": "scn_Q2mX8rT4vK1pLw9eZb3nYh6A",
  "status": "succeeded",
  "language": "en",
  "meal": {
    "name": "Grilled chicken with rice and salad",
    "nutri_score": "B",
    "nutri_score_reason": "Lean protein and vegetables balance the rice; moderate sodium from the marinade.",
    "totals": {
      "calories": 515, "protein_g": 51.9, "carbs_g": 47.7, "fat_g": 11.1,
      "fiber_g": 2.2, "sugar_g": 1.6, "saturated_fat_g": 2.3, "trans_fat_g": 0,
      "micros": { "sodium_mg": 457, "potassium_mg": 645, "...": "13 in all" }
    }
  },
  "items": [ { "name": "Grilled chicken breast", "grams": 150, "source": "food_db", "...": "..." } ],
  "credits_used": 0,
  "test_mode": true
}

What does the label scan return?

Every result has the same fields as a meal scan: 21 nutrients, a NutriScore grade with its reason, a source for each item and the cost of the scan.

FieldWhat it holdsUse it for
meal.totalsCalories, 7 macro fields and 13 micronutrientsYour own nutrition panel
meal.nutri_scoreA grade from A to ESorting and filtering
meal.nutri_score_reasonOne sentence, in the language you setShowing next to the grade
items[].sourcefood_db, web or estimateSending estimates to review
credits_usedWhat this scan costTracking spend per product

Units are in the field names, so protein_g is grams and sodium_mg is milligrams. The result page lists every field.

What image limits apply to a label photo?

JPEG, PNG or WebP, up to 10 MB. Photograph the table itself, flat and in focus, and the scan has the most to read.

LimitValueWhat to do
FormatsJPEG, PNG, WebPConvert HEIC on the device first
File size10 MB per image, 14.5 MB per requestResize large photos before upload
Resolution50 megapixels for JPEG, 24 for PNG and WebPA phone photo is well inside this
image_urlhttps only, 2,048 characters, no redirects, 5 second fetchLink the file itself, not a page or a short link
Scan timeUp to 95 secondsSet your client timeout to 100 seconds or more

Cropping to the table keeps the file small and removes the clutter around it. The scan docs list every request field, including context hints and the Idempotency-Key header for safe retries.

Example, worked from our public pricing

How much does a nutrition label scan cost?

Every scan uses at least 20 credits, which is $0.02, and the exact figure for each one is in credits_used. A typical scan is about 65 credits.

1,000packs

65credits a scan, about

$0.001a credit

$65once

65 credits is our planning figure for a typical scan. Check credits_used on your first few packs and plan with that. A scan needs 20 credits left in your balance to start, and a scan that fails on our side costs nothing.

The Starter pack ($49, 49,000 credits) covers about 750 scans at 65 credits. Credits never expire.

Pack prices

What errors can a label scan return?

Most come from the photo or the balance. A scan that fails on our side returns 500 and costs nothing.

Status and codeWhen it happensWhat to do
400 invalid_imageThe image cannot be read as JPEG, PNG or WebPSend another file or convert it
400 image_url_unreachableWe could not fetch your linkUse a public https URL with no redirect
413 request_too_largeThe body is over 14.5 MBSend an image of 10 MB or less
422 no_food_detectedThe photo shows nothing to scanRetake it. It is charged for the work used, at least 20 credits
402 insufficient_creditsFewer than 20 credits leftBuy a pack in the console
429 rate_limitedOver 60 scans a minuteWait for Retry-After, 60 seconds

The errors page has the full list and retry rules.

Where does a label OCR API not fit?

It reads a photo you send. It does not look products up, so use it where you have the pack image and can wait for a result.

What it does

Reads the nutrition table on a pack photo and returns the values as fields.

Grades the result from A to E and says why, in 12 languages.

Takes a photo as base64 data or a public https link.

What it does not do

No barcode lookup. A barcode number alone returns nothing.

No food search endpoint and no searchable food database.

No values the photo does not show. A blurred or cut-off label gives a partial result.

No instant answer. A scan can take up to 95 seconds.

No official Nutri-Score. The grade is NutriScan's own.

Need one food without a photo? Send it as type: "text" with an amount, as in the calorie API guide.

Questions about reading nutrition labels with an API

Anything else, the API docs cover every field and error.

Can I send a barcode instead of a photo?

No. The API has no barcode lookup and no product database to search, so a barcode number alone returns nothing. It reads the nutrition table on the photo you send. If you already hold barcode data, keep using it, and send a label photo for the products it does not cover.

Which language does a label scan answer in?

The language you set on the request, one of 12: English, German, French, Spanish, Italian, Portuguese, Dutch, Polish, Russian, Turkish, Hindi and Arabic. It controls the names and the grade reason. Only the first two letters are read, and an unsupported value falls back to English.

What happens with a blurred or cut-off label?

The values are read from the photo, so a blurred, angled or partial label gives a partial result. Photograph the table itself, flat and in focus. Each item also carries a source field, so you can send items marked estimate to a person for review.

Is the grade the official Nutri-Score?

No. The NutriScore in the result is NutriScan's own grade from A to E, worked out from the values the scan returns. It is not the official Nutri-Score logo and not a regulator's label, so show it as NutriScan's grade and do not print it on packs.

How much does one label scan cost?

A scan is priced for the work it took, with a minimum of 20 credits, and 1 credit is $0.001. The exact cost of each scan is in credits_used. A scan that fails on our side costs nothing.

How long does a label scan take?

A scan can take up to 95 seconds, so set your HTTP client timeout to at least 100 seconds. For a person waiting on a screen, use streaming. A batch job can send up to 60 scans a minute per account.

Can I try it before buying credits?

Yes. A new account gets a test key that costs nothing and uses no credits. It returns one fixed sample result in the real JSON shape, whatever photo you send, so you can build your parser before you buy a pack.

Turn the next pack photo into data

Sign in with your email, send one label photo to the test key, and buy credits when the shape of the result suits your app.

  • Test key at sign-up
  • Packs from $49
  • No subscription
  • Credits never expire
A bowl of plain yogurt on a table
Example labelPlain yogurt, per 100 gAs printed on the pack61 kcal
NutriScan app meal screen listing calories, macros, vitamins and minerals for one logged meal