Agent API Docs

Everything you need to hand an AI agent a key and let it log meals for you.

What this is

An API key lets an AI agent log food and supplements to your account on your behalf. The agent talks to the UA Strength API over HTTPS. A video analysis uploader key lets a program on your computer attach video analyses to your sets.

Premium

API keys, connected apps and the MCP server are part of UA Strength Premium. On an account without it, every authenticated request to the API or the MCP server is refused, reads included, whatever credential it carries. The answer is 403 with the code premium_required:

{
  "error": {
    "code": "premium_required",
    "message": "This needs UA Strength Premium. Subscribe at ultimate-analysis.com/settings/premium/ and this connection works again."
  }
}

Pass the message on to the person instead of retrying. Nothing changes until the account has Premium, and every refused request still counts toward the account’s daily limit on agent requests. Keys and connected apps stay listed in Settings and work again as soon as the account has Premium. A connected app that goes 30 days without being used has to be connected again.

The one exception is the account holder’s own signed-in session, which can still read a video analysis’s curves (GET /v1/video-analyses/{id}/series) and delete an analysis (DELETE /v1/video-analyses/{id}), so analyses stay readable and deletable without Premium. An API key or connected app is refused on those two routes as well, and posting an analysis is refused for every caller.

Getting a key

Create one on the API Keys settings page, which needs Premium. The plaintext key is shown only once and cannot be recovered — copy it immediately and store it securely. If you lose it, revoke and create a new one.

What a key can do

Keys come in three presets. The table below is what each one can and cannot do.

ActionNutrition keyFull access keyVideo analysis uploader key
Log / read food and supplements (/v1/food, /v1/supplements)yesyes403
Read /nutritionyesyes403
Read /workouts, /activity403yesyes
Read /biometrics403yes403
Read video analyses (/v1/video-analyses)403yesyes
Post or delete video analyses403403yes
Create or revoke API keys403403403
Undo agent activity403403403

No API key can manage keys or undo its own activity, regardless of scope. Only a signed-in session can. That is what stops a leaked key from extending its own access or covering its tracks.

Only an uploader key can post video analyses. Connected apps and Full access keys cannot, because those usually belong to an assistant. A key keeps the scopes it was created with: a Full access key made before video analyses existed cannot read them, and a new one can. An uploader key can read your whole workout log, since that is how it finds the set a video belongs to. Keep it on the computer that runs the program.

Endpoints

The fifteen endpoints a key can call, plus the spec itself:

MethodPathScopePurpose
POST/v1/foodnutrition:writeLog a food entry
GET/v1/foodnutrition:readList food entries (newest first; optional date, limit)
PATCH/v1/food/{id}nutrition:writeCorrect a food entry the caller logged (see below)
DELETE/v1/food/{id}nutrition:writeDelete a food entry the caller logged (see below)
PATCH/v1/supplements/{id}nutrition:writeCorrect a supplement entry the caller logged (see below)
DELETE/v1/supplements/{id}nutrition:writeDelete a supplement entry the caller logged (see below)
POST/v1/supplementsnutrition:writeLog a supplement entry
GET/v1/supplementsnutrition:readList supplement entries (newest first; optional date, limit)
GET/v1/foods/searchnutrition:readSearch previously logged foods by name
GET/v1/foods/catalognutrition:readSearch the food catalogue (USDA and Open Food Facts): each food’s figures per 100 g, its servings and its source
POST/v1/video-analysesvideoAnalysis:writeAttach the analysis of one set’s video to that set (see below)
GET/v1/video-analysesvideoAnalysis:readList video analyses (newest first; optional setId, limit, offset)
GET/v1/video-analyses/{id}videoAnalysis:readRead one video analysis and its summary
GET/v1/video-analyses/{id}/seriesvideoAnalysis:readRead an analysis’s curves: position, speed and acceleration at every sample
DELETE/v1/video-analyses/{id}videoAnalysis:writeDelete a video analysis the caller posted (see below)
GET/v1/openapi.jsonnoneThis API’s machine-readable OpenAPI 3.1 spec

Correcting and removing entries

An agent can fix its own mistakes. PATCH changes only the fields you send; anything omitted keeps its current value. DELETE removes the entry, and the account holder can still undo it afterwards.

Both are deliberately narrow. A key or connector may only amend an entry that it created itself, within the last 24 hours, that has not already been undone, and that nothing else has written to since. Entries logged in the app, entries belonging to a different key, and older entries are the account holder’s alone. The 24 hours runs from when the entry was created, not from the last edit, so an agent cannot hold a row open by touching it repeatedly.

A refusal is 403 carrying a machine-readable reason —not_authored_by_caller, outside_window, undone, orchanged_by_someone_else — so an agent can tell “not mine” from “too late” and say something useful rather than retrying.

Video analyses

A post is one set’s analysis as compact JSON, at most 1 MiB: when each rep started and ended, how fast it moved, and the tracked position, speed and acceleration at every sample. The video itself is never sent. The document’s schema is VideoAnalysisDocument in /v1/openapi.json, and a document the server cannot use is refused with 400 and a message naming the field.

A set shows its newest analysis. A post replaces the analyses of that set that the same key posted and nothing has written to since, whatever their age. Analyses you or other keys posted stay. A set holds at most five live analyses, and an account takes at most 200 posts a day. The same rule decides DELETE: a key may delete only an analysis it posted that nothing has written to since, and anything else is refused with 403 and one of the reasons above. Undoing a post on the agent activity page removes it and brings back the analyses it replaced.

Send an Idempotency-Key of at most 200 characters with every post, and resend the same body under the same key when you retry. A repeat answers 200 with the analysis already stored. The same key with a different analysis is refused with 409 analysis_exists, so a new analysis of a set needs a new key.

Point an agent at GET /v1/openapi.json directly — it needs no credentials, so the agent can discover every endpoint before it authenticates. A key that lacks a required scope receives 403 insufficient_scope rather than an empty result, so a missing scope is never mistaken for empty data.

Worked examples

These run as-is once $UA_KEY holds your key.

Log a meal

# consumedAt is optional and defaults to now. mealSlot is optional:
# 1 Breakfast, 2 Lunch, 3 Dinner, 4 Snacks, unless you renamed your meals.
curl -X POST https://api.ultimate-analysis.com/v1/food \
  -H "Authorization: Bearer $UA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Chobani Yogurt","calories":140,"proteinGrams":20,"mealSlot":1}'

Read today’s food

# date is YYYY-MM-DD. Omit it to list recent entries.
curl https://api.ultimate-analysis.com/v1/food?date=2026-08-19 \
  -H "Authorization: Bearer $UA_KEY"

Search previously logged foods

# Reuse your own known macros instead of guessing them.
curl "https://api.ultimate-analysis.com/v1/foods/search?q=chicken" \
  -H "Authorization: Bearer $UA_KEY"

The search endpoint exists so an agent reuses the calories and macros you already recorded for a food, rather than guessing them fresh each time. Before logging “chicken,” an agent should search first.

Look a food up in the catalogue

# Figures are per 100 g; each serving gives its grams.
curl "https://api.ultimate-analysis.com/v1/foods/catalog?q=oatmeal%20cooked&limit=5" \
  -H "Authorization: Bearer $UA_KEY"

For a food you have not logged before, the catalogue gives measured figures: multiply a figure per 100 g by the serving’s grams and the servings eaten, divide by 100, and log the totals. A food from Open Food Facts carries a link to its page, to credit when its figures are quoted.

Using it with an agent

Idempotency

Every POST endpoint accepts an optional Idempotency-Key header of up to 200 characters. Retrying a POST with the same value returns the originally-created entry instead of creating a duplicate, which makes agent retries safe.

curl -X POST https://api.ultimate-analysis.com/v1/food \
  -H "Authorization: Bearer $UA_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: meal-2026-08-19-001" \
  -d '{"name":"Banana","calories":105}'

Rate limits

Limits count the requests from each client address, so keys used from one machine share them. Exceeding a limit returns 429.

Safety