Skip to content
skcal
Esc
↑↓navigate↵open⌘Jpreview

Log a meal from photos

Uploads 1–5 photos of a single meal, sends them to Claude vision for per-item calorie and protein estimates, stores the photos plus a meal, and returns the analysis.

POST/api/nutrition/analyze
Authorization
__Secure-better-auth.session_tokenAPI key · cookierequired

Better Auth session. Signing in (Google or email magic link) sets an HttpOnly session cookie that scopes every request to that account. The web app and CLI use this; agents use the OAuth 2.1 flow of the MCP server.

or
AuthorizationBearer token · headerrequired

Personal API key sent as Authorization: Bearer skcal_…. Create and scope keys in the app under your profile → API keys. Keys default to full access; a scoped key is limited to its granted resource:action permissions and cannot manage other keys.

Query parameters
datestring<date>

Day to log against (YYYY-MM-DD). Defaults to the server's current UTC date.

Request body
requiredmultipart/form-data

The meal photos (multipart field photos), plus an optional note caption for context.

photosstring<binary>[]required

1–5 photos of a single meal, possibly from multiple angles (JPEG, PNG, WebP, or GIF; max 8MB each).

notestring

Optional caption to disambiguate the photo; passed to the model and stored as the meal note.

max length 2000
Responses
200

The meal was analyzed and logged.

okbooleanrequired

Always true once analysis succeeds.

mealIdstring<uuid>required

Identifier of the created meal.

itemsAnalyzedItem[]required

Estimated food items.

Show properties
Array of AnalyzedItem
namestringrequired

Estimated food item name.

kcalintegerrequired

Estimated calories for the portion.

proteinGnumberrequired

Estimated protein in grams.

totalKcalintegerrequired

Summed calories across items.

totalProteinGintegerrequired

Summed protein in grams across items.

notestringrequired

The model's one-line assumptions note.

photoKeysstring[]required

R2 object keys of stored photos (empty for text descriptions).

400

The request body or parameters failed validation.

errorstringrequired

Human-readable failure reason.

detailstring

Optional extra context, present on upstream failures.

502

The upstream model call failed.

errorstringrequired

Human-readable failure reason.

detailstring

Optional extra context, present on upstream failures.

503

A required secret (model key or ingest token) is not configured.

errorstringrequired

Human-readable failure reason.

detailstring

Optional extra context, present on upstream failures.

Try it
Server
Authorization
Parameters
Bodymultipart/form-data
Request
curl -X POST 'https://app.skcal.fit/api/nutrition/analyze' \
  -H 'Cookie: __Secure-better-auth.session_token=YOUR_API_KEY' \
  -H 'Accept: application/json' \
  --form-string 'photos=@plate.jpg' \
  --form-string 'photos=@plate-side.jpg' \
  --form-string 'note=the white sauce is toum, and that'\''s a 12oz steak'
Response
{
  "ok": true,
  "mealId": "3f8b1c2a-5d6e-4f70-8a1b-2c3d4e5f6071",
  "items": [
    {
      "name": "grilled chicken breast",
      "kcal": 284,
      "proteinG": 53.4
    },
    {
      "name": "toum",
      "kcal": 90,
      "proteinG": 0.4
    }
  ],
  "totalKcal": 374,
  "totalProteinG": 54,
  "note": "assumed a single chicken breast and one tablespoon of toum",
  "photoKeys": [
    "nick@mintlify.com/2026-06-29/3f8b1c2a-5d6e-4f70-8a1b-2c3d4e5f6071"
  ]
}

Was this page helpful?