Skip to content
opis.Nutrition API

Opis Nutrition API

From a meal photo to nutrients you can defend.

Identify foods and portions from photos, let a person confirm them if you want, and get 53 nutrients with their provenance — through one asynchronous REST API, hosted in London.

  • UK CoFID + USDA + Open Food Facts
  • 53 nutrients, UCUM units
  • AWS eu-west-2 (London)
  • Standard Webhooks
  • Free test mode

Three capabilities, metered separately

Use them together as a meal analysis, or buy just the part you need.

How the asynchronous flow works

Every request returns 202 with a resource you can poll, wait on with Prefer: wait, or follow by webhook. Automatic and manual confirmation run on the same state machine; manual mode simply stops at requires_confirmation until your user answers.

Automatic confirmation

The default. Identified items go straight to nutrition.

  1. queued
    You POST /v1/meal-analyses; we answer 202.
  2. processing· identification
    Foods, portions and confidence are identified from the photo.
  3. processing· nutrition
    Confirmation is recorded as automatic; nutrients are computed.
  4. succeeded
    Webhook meal_analysis.succeeded; fetch the result.

Manual confirmation

A person reviews the items before nutrition runs. The wait is durable state — nothing sits in a queue.

  1. queued
    Same create, with confirmation mode: "manual".
  2. processing· identification
    Foods and portions are identified.
  3. requires_confirmation
    Webhook meal_analysis.requires_confirmation. Your user accepts, edits or rejects; you POST …/confirm with If-Match.
  4. processing· nutrition
    Nutrients are computed for the confirmed items.
  5. succeeded
    The result keeps both the AI view and the human view.
  • Rejected → canceled (rejected_at_confirmation).
  • No answer by confirmation.expires_at → your on_expiry policy: cancel (default) or auto_confirm (recorded as auto_on_expiry).

Read the confirmation guide

Why opis

Five minutes with a test key

  1. Sign in to the console with Google and create an organization.
  2. Create a test API key (opis_test_…). Test mode is free and deterministic.
  3. Upload a photo, create an analysis, and poll it until it settles.
  4. Add a webhook endpoint when you are ready to stop polling.
# 1. Upload a photo (test keys never reach the live engine)
curl https://platform.opis.health/v1/files \
  -H "Authorization: Bearer $OPIS_API_KEY" \
  -F file=@lunch.jpg
# → { "id": "file_01j9…", "status": "processing" }

# 2. Start the analysis
curl https://platform.opis.health/v1/meal-analyses \
  -H "Authorization: Bearer $OPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "images": [{ "file_id": "file_01j9…" }] }'
# → 202 { "id": "mna_01j9…", "status": "queued" }

# 3. Poll until it settles (or use a webhook)
curl https://platform.opis.health/v1/meal-analyses/mna_01j9… \
  -H "Authorization: Bearer $OPIS_API_KEY"
# → { "status": "succeeded", "nutrition": { "totals": { "nutrients": { "energy_kcal": { "value": 341.2, "unit": "kcal" } } } } }

Start in test mode today

Test keys work as soon as you create an organization. Live keys are enabled after opis activates it.