Skip to content

Nutrition API for meal logging

Food logging API for apps

Your users log a meal three ways: a photo of the plate, a photo of a pack label, or a line of text. All three go to one endpoint, POST /scans, and come back in the same JSON, so your app stores one object per meal.

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

Grilled chicken breast with a grain side and vegetables on a wooden board

Lunch, ready to confirm

Grilled chicken with rice and salad

B

515kcal

Calories today1,000 of 2,000 kcal

The sample result from a test key. The API returns the meal, 515 kcal and the grade; your app keeps the day's total and the goal.

How does meal logging work in your app?

The user gives your app a photo, a label photo or a line of text. Your server sends it to the API, shows the result, and saves the meal in your own database after the user confirms.

  1. The user logs a meal

    A plate photo, a pack label photo, or text such as "Zwei Spiegeleier und eine Scheibe Vollkornbrot".

  2. Your server sends the scan

    One call to POST /v1/scans with type set to meal, label or text, the user's language and a meal_time hint if your app knows it.

  3. Your app shows the result

    The dish name, each item with its portion in grams, the totals and the NutriScore grade. An item with source set to estimate is a good one to ask the user to check.

  4. The user confirms or edits

    They fix a portion or drop an item, and your app recalculates the item and the meal totals. If they ate half, context.consumed_quantity can say so up front.

  5. Your app saves it

    Write the scan id and the fields you need next to the user id and the time. GET /v1/scans/{id} returns the same JSON again.

Which inputs can a user log a meal with?

Three: a meal photo, a photo of a pack's nutrition table, and text. The result has the same shape for all three, so your app needs one code path for the diary.

InputYou sendWhat it is for
Meal photo, type: "meal"image_base64 or a public https image_urlA plate, a bowl or a takeaway box. See the food recognition API.
Pack label, type: "label"A photo of the nutrition table, flat and in focusPackaged food, such as a yogurt cup. See the nutrition label OCR API.
Text, type: "text"text, up to 2,000 charactersA typed log, or speech your app turned into text. See the nutrition analysis API.

Every result has id, meal, items and credits_used. The result page lists each field.

What does a request to log a meal look like?

One POST with a bearer key, and the result comes back in the same response.

The response is the fixed sample a test key returns, trimmed. A live scan has the same shape.

Request

curl https://platform-api.nutriscan.app/v1/scans \
  -H "Authorization: Bearer $NUTRISCAN_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: log-8f3a1c" \
  -d '{
    "type": "meal",
    "image_url": "https://example.com/lunch.jpg",
    "language": "en",
    "context": { "meal_time": "lunch" }
  }'

Response, test key sample

{
  "id": "scn_Q2mX8rT4vK1pLw9eZb3nYh6A",
  "status": "succeeded",
  "engine_version": "2026.11.0",
  "meal": {
    "name": "Grilled chicken with rice and salad",
    "nutri_score": "B",
    "totals": { "calories": 515, "protein_g": 51.9,
                "carbs_g": 47.7, "fat_g": 11.1, "…": "…" }
  },
  "items": [
    { "name": "Grilled chicken breast",
      "portion": { "value": 150, "unit": "g", "display": "150 g" },
      "grams": 150, "calories": 248, "source": "food_db", "…": "…" }
  ],
  "credits_used": 0,
  "test_mode": true
}

How do you wire it into the log screen?

Two functions on your server: one that scans and returns the result for review, and one that saves the meal after the user confirms.

An example in Node. The db call stands in for your own storage.

// Your server. Keep the API key here, never in the app.
export async function scanMeal(logId, input, language) {
  const resp = await fetch("https://platform-api.nutriscan.app/v1/scans", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.NUTRISCAN_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": logId, // one id per log attempt: a retry is charged once
    },
    body: JSON.stringify({ ...input, language, context: { meal_time: "lunch" } }),
    signal: AbortSignal.timeout(100_000), // a scan can take up to 95 seconds
  });
  const scan = await resp.json();
  if (!resp.ok) throw new Error(scan.error.code); // for example no_food_detected
  return scan; // show it to the user; nothing is saved yet
}
//
// Runs when the user taps Confirm. This table is yours: the API keeps no diary.
export async function saveMeal(userId, scan, eatenAt) {
  await db.meals.insert({
    user_id: userId,
    scan_id: scan.id, // GET /v1/scans/{id} returns the same JSON again
    eaten_at: eatenAt,
    name: scan.meal.name,
    nutri_score: scan.meal.nutri_score,
    totals: scan.meal.totals,
    items: scan.items, // the user may have edited portions before confirming
  });
}

If the user edits the text and scans again, use a new key. The same key with a different body returns 409 idempotency_conflict.

What does an AI calorie tracking API do, and what stays with your app?

It turns a photo, a label or a line of text into calories, macros and micronutrients for one meal. Everything about the person stays in your app.

The request carries no end-user id and there is no diary endpoint. For the numbers of a food you already named, see the calorie API.

JobNutriScan APIYour app
Read a plate, a label or textYesCollects the input
Portions in grams, 21 nutrients, grade A to EYesShows them
User accounts and sign-inNoYes
The diary and where meals are storedNoYes
Daily totals, goals and streaksNoYes
Edits after the scanNoYes, then recalculate

How do you keep the log screen responsive?

Add "stream": true to the request. The scan id arrives at once, the detected items after about 10 to 15 seconds, and the full result when it is ready.

  • scan.started comes first, with the scan id. Keep it: if the connection drops, GET /v1/scans/{id} returns the finished scan.
  • items.detected gives the dish name and each item with a portion. The final result can still rename, add or drop an item.
  • scan.completed carries the same JSON as a plain call.

A streamed scan can run up to 140 seconds, so the screen needs a waiting state either way. Background jobs can use a plain call with a 100 second timeout. Code is on the streaming page.

Example, worked from our public pricing

What does a logged meal cost?

About 65 credits, or about $0.065, for a typical meal photo. For 1,000 users who log 2 meals a day that is about $3,900 a month, an estimate.

1,000users

2meals a day

30days

$0.065about 65 credits a meal

$3,900a month

That is 60,000 scans and about 3,900,000 credits, or $3.90 per user. A big plate costs more, so your real figure shows up in credits_used after the first live scans. At 1 meal a day it is about $1,950 a month, at 3 about $5,850.

Six Scale packs, one Growth and three Starter ($3,940, 3,940,000 credits) cover that month. Credits you do not use stay in your balance.

Pack prices

Can you build the log screen before you pay?

Yes. Sign in with your email and you get a test key at once. It uses no credits, so your team can finish the screens before anyone buys a pack.

A test key at sign-up

It returns the fixed sample with test_mode set to true and credits_used at 0, whatever you send.

The same shape as a live scan

Code written against the sample runs unchanged with a live key.

Run live scans before launch

The sample never changes, so it cannot show how your photos come back. The $49 Starter pack covers a real test.

What limits and errors matter on a log screen?

The limit is 60 scans a minute per account, and a scan can take up to 95 seconds. Queue lunchtime bursts on your server and handle five cases on screen.

SituationCodeWhat your app does
More than 60 scans a minute429 rate_limitedWait for Retry-After, 60 seconds. Send scans from a queue at a steady pace.
The service is at capacity429 platform_busyRetry after a short wait.
A photo with no food422 no_food_detectedAsk for a new photo. It is charged for the work it used, at least 20 credits.
Balance too low402 insufficient_creditsTop up in the console. A scan needs 20 credits to start, so alert your team before the balance runs out.
A scan failed on our side500 scan_failedRetry with the same key. A failed scan costs 0 credits.

Photos go in as base64 or a public https link, up to 10 MB, as JPEG, PNG or WebP. HEIC is not supported yet, so convert iPhone photos on the device. See limits and errors.

Where does it not fit?

It reads meals from photos, labels and text. It has no food search and does not run your diary.

What it does

Reads a plate, a pack label or typed text, and returns each item with its portion in grams.

Returns 21 nutrients per item and a NutriScore grade with a reason, in 12 languages.

What it does not do

No food search, no barcode lookup and no searchable food database, so no type-ahead log screen.

No accounts, diary, daily totals or goals. Your app keeps those.

Photos arrive as an upload or an https link, and a scan can take up to 95 seconds.

The numbers are estimates for food logging, not for medical decisions.

Questions from developers adding food logging

The API docs cover every field and error. The fitness apps page is the business view of the same build.

Which inputs can a user log a meal with?

Three, all through POST /v1/scans: a meal photo (type meal), a photo of a pack's nutrition table (type label) and a line of text (type text). The result has the same shape for each, so your app stores one kind of object per meal.

Does the API keep my users' food diary?

No. The request carries no end-user id and there is no diary endpoint. Your app owns accounts, the diary, daily totals, goals and edits. Save the fields you need with the scan id.

How do I keep the log screen responsive while a scan runs?

Add stream true to the request. The detected items arrive after about 10 to 15 seconds and the full result follows, so you can show the items while the numbers load. A plain call can take up to 95 seconds.

How much does one logged meal cost?

A typical meal photo uses about 65 credits, about $0.065, and a short text log about 60. Every result reports its exact cost in credits_used. Credits are prepaid in packs from $49 and never expire.

What happens if a user taps log twice or the network drops?

Send an Idempotency-Key header with one value per log attempt. A retry with the same key and body returns the first result and uses credits once. If a streamed connection drops, the scan still finishes and GET /v1/scans/{id} returns it.

Can users search for a food and pick it from a list?

No. There is no food search, no barcode lookup and no searchable food database. A user can type what they ate with an amount, such as 150 g grilled chicken breast, and you send it as text. Keep another source for search or barcodes.

Build your log screen against a test key

Sign in with your email, finish the flow on the sample result, and buy credits when you go live.

  • Test key at sign-up
  • Packs from $49
  • No subscription
  • Credits never expire
A breaded pork schnitzel with a lemon wedge
Example resultSchweineschnitzel, paniert1 Schnitzel, 150 g420 kcal
NutriScan app meal screen listing calories, macros, vitamins and minerals for one logged meal