{"openapi":"3.1.0","info":{"title":"Lift Agent API (dev)","version":"0.1.0","description":"REST interface for agents and the Lift Agent app. Same domain as the MCP server at /mcp (also /mcp/t/{token} for clients that cannot send headers). Prod auth: Bearer <owner token> (the app), awk_live_* connection tokens (agents), or OAuth 2.1 awk_oat_* access tokens (\"Sign in with Lift Agent\", MCP authorization spec: see /.well-known/oauth-protected-resource/mcp; the user approves sign-ins in the app). Dev auth: Bearer awk_dev_* (Claude connection, approve mode), awk_user_* (the user), awk_ro_* (read-only). Rate limit (prod): 120 requests/min per token (429 + Retry-After)."},"servers":[{"url":"https://anyworkout.flavrapps.com"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"},"oauth2":{"type":"oauth2","description":"Authorization code + PKCE (S256). Clients: Client ID Metadata Documents or POST /oauth/register. resource must be <base>/mcp. Access tokens awk_oat_ (1 h), rotating refresh tokens awk_ort_ (60 days).","flows":{"authorizationCode":{"authorizationUrl":"https://anyworkout.flavrapps.com/oauth/authorize","tokenUrl":"https://anyworkout.flavrapps.com/oauth/token","refreshUrl":"https://anyworkout.flavrapps.com/oauth/token","scopes":{"profile:read":"Read profile","profile:write":"Write profile","plans:read":"Read plans","plans:write":"Write plans","logs:read":"Read logs","logs:write":"Write logs","nutrition:read":"Read nutrition","nutrition:write":"Write nutrition","messages:write":"Post to the inbox","catalogue:read":"Search exercises"}}}}},"schemas":{"Issue":{"type":"object","required":["path","code","message"],"properties":{"path":{"type":"string","examples":["sessions.upper_a.blocks[1].items[0].exercise"]},"code":{"type":"string","enum":["SCHEMA","UNKNOWN_EXERCISE","AMBIGUOUS_EXERCISE","UNKNOWN_SESSION","EQUIPMENT_UNAVAILABLE","VOLUME_ABOVE_CAP","KCAL_BELOW_FLOOR","RESOLVED_QUERY","TOO_MANY_WEEKS"]},"message":{"type":"string"},"fix":{"type":"string"},"candidates":{"type":"array","items":{"type":"string"}}}},"Problem":{"type":"object","required":["error","message","status"],"properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"error":{"type":"string","examples":["VALIDATION_FAILED","REVISION_CONFLICT","READ_ONLY_CONNECTION"]},"message":{"type":"string"},"fix":{"type":"string"},"issues":{"type":"array","items":{"$ref":"#/components/schemas/Issue"}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/Issue"}}}},"WriteResult":{"type":"object","properties":{"plan_id":{"type":"string"},"revision":{"type":"integer"},"status":{"type":"string","enum":["applied","pending_approval"]},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/Issue"}},"summary_of_changes":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"}}}},"next_steps":{"type":"array","items":{"type":"string"}}}}},"responses":{"Problem":{"description":"Error (RFC 9457 problem+json, BYOA error shape)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/v1/me":{"get":{"summary":"Profile, entitlement and connection scopes","responses":{"200":{"description":"Profile","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Problem"}}}},"/v1/profile":{"get":{"summary":"The user's name and athlete profile","responses":{"200":{"description":"{ name, profile }","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"profile":{"type":"object","properties":{"units":{"enum":["kg","lb"]},"age":{"type":"number"},"sex":{"enum":["male","female","other"]},"height_cm":{"type":"number"},"goals":{"type":"array","items":{"type":"string"}},"experience":{"enum":["beginner","intermediate","advanced"]},"equipment_profiles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"equipment":{"type":"array","items":{"type":"string"}},"kettlebells_kg":{"type":"array","items":{"type":"number"}},"dumbbells_kg":{"type":"array","items":{"type":"number"}}},"required":["id","name","equipment"]}},"limitations":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"notes":{"type":"string"},"contraindication_tags":{"type":"array","items":{"type":"string"}}},"required":["area"]}},"training_maxes":{"type":"array","items":{"type":"object","properties":{"exercise":{"type":"string"},"kg":{"type":"number"},"kind":{"enum":["1rm","tm","e1rm"]},"date":{"type":"string","format":"date"}},"required":["exercise","kg","kind","date"]}},"availability":{"type":"object","properties":{"days":{"type":"array","items":{"enum":["mon","tue","wed","thu","fri","sat","sun"]}},"minutes_per_session":{"type":"integer"}}},"preferences":{"type":"object","properties":{"likes":{"type":"array","items":{"type":"string"}},"dislikes":{"type":"array","items":{"type":"string"}}}},"hide_numbers":{"type":"boolean"},"timezone":{"type":"string","description":"IANA zone, e.g. Europe/London"},"bodyweight_kg":{"type":"number"},"review_day":{"enum":["mon","tue","wed","thu","fri","sat","sun","off"],"description":"Weekly digest day (default sun)"},"review_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Weekly digest local time (default 18:00)"}}}},"required":["name","profile"]}}}}}},"patch":{"summary":"Update the profile (merge patch: top-level keys merged, availability/preferences merged, arrays replaced, null clears). The user may also set name. Agents need profile:write (read-only connections get 403); their changes apply immediately, are logged in activity and announced in the inbox.","requestBody":{"required":true,"description":"Partial profile, e.g. { \"timezone\": \"Europe/London\", \"bodyweight_kg\": 81.5 }","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"units":{"enum":["kg","lb"]},"age":{"type":"number"},"sex":{"enum":["male","female","other"]},"height_cm":{"type":"number"},"goals":{"type":"array","items":{"type":"string"}},"experience":{"enum":["beginner","intermediate","advanced"]},"equipment_profiles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"equipment":{"type":"array","items":{"type":"string"}},"kettlebells_kg":{"type":"array","items":{"type":"number"}},"dumbbells_kg":{"type":"array","items":{"type":"number"}}},"required":["id","name","equipment"]}},"limitations":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"notes":{"type":"string"},"contraindication_tags":{"type":"array","items":{"type":"string"}}},"required":["area"]}},"training_maxes":{"type":"array","items":{"type":"object","properties":{"exercise":{"type":"string"},"kg":{"type":"number"},"kind":{"enum":["1rm","tm","e1rm"]},"date":{"type":"string","format":"date"}},"required":["exercise","kg","kind","date"]}},"availability":{"type":"object","properties":{"days":{"type":"array","items":{"enum":["mon","tue","wed","thu","fri","sat","sun"]}},"minutes_per_session":{"type":"integer"}}},"preferences":{"type":"object","properties":{"likes":{"type":"array","items":{"type":"string"}},"dislikes":{"type":"array","items":{"type":"string"}}}},"hide_numbers":{"type":"boolean"},"timezone":{"type":"string","description":"IANA zone, e.g. Europe/London"},"bodyweight_kg":{"type":"number"},"review_day":{"enum":["mon","tue","wed","thu","fri","sat","sun","off"],"description":"Weekly digest day (default sun)"},"review_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Weekly digest local time (default 18:00)"}}}}}},"responses":{"200":{"description":"{ name, profile }","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"profile":{"type":"object","properties":{"units":{"enum":["kg","lb"]},"age":{"type":"number"},"sex":{"enum":["male","female","other"]},"height_cm":{"type":"number"},"goals":{"type":"array","items":{"type":"string"}},"experience":{"enum":["beginner","intermediate","advanced"]},"equipment_profiles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"equipment":{"type":"array","items":{"type":"string"}},"kettlebells_kg":{"type":"array","items":{"type":"number"}},"dumbbells_kg":{"type":"array","items":{"type":"number"}}},"required":["id","name","equipment"]}},"limitations":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"notes":{"type":"string"},"contraindication_tags":{"type":"array","items":{"type":"string"}}},"required":["area"]}},"training_maxes":{"type":"array","items":{"type":"object","properties":{"exercise":{"type":"string"},"kg":{"type":"number"},"kind":{"enum":["1rm","tm","e1rm"]},"date":{"type":"string","format":"date"}},"required":["exercise","kg","kind","date"]}},"availability":{"type":"object","properties":{"days":{"type":"array","items":{"enum":["mon","tue","wed","thu","fri","sat","sun"]}},"minutes_per_session":{"type":"integer"}}},"preferences":{"type":"object","properties":{"likes":{"type":"array","items":{"type":"string"}},"dislikes":{"type":"array","items":{"type":"string"}}}},"hide_numbers":{"type":"boolean"},"timezone":{"type":"string","description":"IANA zone, e.g. Europe/London"},"bodyweight_kg":{"type":"number"},"review_day":{"enum":["mon","tue","wed","thu","fri","sat","sun","off"],"description":"Weekly digest day (default sun)"},"review_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Weekly digest local time (default 18:00)"}}}},"required":["name","profile"]}}}},"403":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/logs/workouts/{id}":{"get":{"summary":"One workout log","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ log }","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"$ref":"#/components/responses/Problem"}}},"put":{"summary":"Replace a past workout (user/owner only; agents may only add logs). Full byoa.log@0.1; id must match","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"description":"byoa.log document","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"{ log, warnings }","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"$ref":"#/components/responses/Problem"},"404":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"}}},"delete":{"summary":"Delete a past workout (user/owner only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"},"403":{"$ref":"#/components/responses/Problem"},"404":{"$ref":"#/components/responses/Problem"}}}},"/v1/review/weekly":{"get":{"summary":"Weekly review: adherence, PRs, stalls, pain, volume vs plan, nutrition, highlights and a prompt for your agent","parameters":[{"name":"end","in":"query","required":false,"description":"Last day of the 7-day window (default: today in the user's time zone)","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Weekly review","content":{"application/json":{"schema":{"type":"object","properties":{"week":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"sessions":{"type":"object","properties":{"planned":{"type":"integer"},"done":{"type":"integer"},"missed":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"session":{"type":"string"},"name":{"type":"string"}}}}}},"prs":{"type":"array","items":{"type":"object","properties":{"exercise":{"type":"string"},"name":{"type":"string"},"e1rm_kg":{"type":"number"},"previous_best_kg":{"type":"number"}}}},"stalls":{"type":"array","items":{"type":"object","properties":{"exercise":{"type":"string"},"name":{"type":"string"},"weeks":{"type":"integer"},"e1rm_kg":{"type":"number"}}}},"pain":{"type":"array","items":{"type":"object","properties":{"exercise":{"type":"string"},"area":{"type":"string"},"level":{"type":"number"},"date":{"type":"string"}}}},"volume_by_muscle":{"type":"array","items":{"type":"object","properties":{"muscle":{"type":"string"},"sets":{"type":"number"},"target":{"type":"number"}}}},"nutrition":{"type":"object","properties":{"days_logged":{"type":"integer"},"avg_kcal":{"type":"number"},"avg_protein_g":{"type":"number"},"target_kcal":{"type":["number","null"]},"target_protein_g":{"type":["number","null"]}}},"highlights":{"type":"array","items":{"type":"string"},"maxItems":5,"description":"Rule-based, most important first"},"prompt":{"type":"string","description":"Ready-to-paste prompt for the user's agent"}},"required":["week","sessions","prs","stalls","pain","volume_by_muscle","highlights","prompt"]}}}},"400":{"$ref":"#/components/responses/Problem"}}}},"/v1/webhooks":{"get":{"summary":"Webhooks (owner only). The signing secret is never returned here","responses":{"200":{"description":"{ webhooks, available_events }","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"enum":["workout.logged","revision.proposed","revision.applied","review.ready","message.created","profile.updated"]}},"description":{"type":"string"},"created_at":{"type":"string"},"secret_last4":{"type":"string"},"last_delivery":{"type":"object","properties":{"at":{"type":"string"},"event_id":{"type":"string"},"type":{"type":"string"},"ok":{"type":"boolean"},"attempts":{"type":"integer"},"http_status":{"type":"integer"},"error":{"type":"string"}}}}}},"available_events":{"type":"array","items":{"type":"string"}}}}}}},"403":{"$ref":"#/components/responses/Problem"}}},"post":{"summary":"Create a webhook (owner only). Deliveries: POST { id, type, created_at, data } with X-LiftAgent-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>; 5 s timeout, 3 attempts, no redirects; https only in prod; private/loopback/link-local addresses refused","requestBody":{"required":true,"description":"{ url, events, description? }","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"events":{"type":"array","items":{"enum":["workout.logged","revision.proposed","revision.applied","review.ready","message.created","profile.updated"]}},"description":{"type":"string"}},"required":["url","events"]}}}},"responses":{"201":{"description":"{ webhook, secret } (secret shown once)","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"enum":["workout.logged","revision.proposed","revision.applied","review.ready","message.created","profile.updated"]}},"description":{"type":"string"},"created_at":{"type":"string"},"secret_last4":{"type":"string"},"last_delivery":{"type":"object","properties":{"at":{"type":"string"},"event_id":{"type":"string"},"type":{"type":"string"},"ok":{"type":"boolean"},"attempts":{"type":"integer"},"http_status":{"type":"integer"},"error":{"type":"string"}}}}},"secret":{"type":"string"}}}}}},"403":{"$ref":"#/components/responses/Problem"},"409":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/webhooks/{id}":{"delete":{"summary":"Delete a webhook (owner only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"},"404":{"$ref":"#/components/responses/Problem"}}}},"/v1/webhooks/{id}/test":{"post":{"summary":"Send a signed webhook.test event once (owner only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ delivery: last_delivery }","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"$ref":"#/components/responses/Problem"}}}},"/v1/exercises":{"get":{"summary":"Search the exercise catalogue","parameters":[{"name":"q","in":"query","required":false,"description":"Free text","schema":{"type":"string"}},{"name":"equipment","in":"query","required":false,"description":"Comma-separated equipment ids the user has","schema":{"type":"string"}},{"name":"pattern","in":"query","required":false,"description":"Movement pattern","schema":{"type":"string"}},{"name":"muscle","in":"query","required":false,"description":"Muscle id","schema":{"type":"string"}},{"name":"level","in":"query","required":false,"description":"beginner|intermediate|advanced","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Max results","schema":{"type":"integer"}}],"responses":{"200":{"description":"Exercises","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/exercises/{id}":{"get":{"summary":"Exercise detail","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Exercise","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"$ref":"#/components/responses/Problem"}}}},"/v1/taxonomy":{"get":{"summary":"Muscle, equipment and pattern vocabularies","responses":{"200":{"description":"Vocab","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/validate":{"post":{"summary":"Dry-run validation of any byoa.* document","parameters":[{"name":"mode","in":"query","required":false,"description":"lenient|strict","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"A byoa document, or { document, mode }","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"{ ok, value, issues, warnings, preview? }","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/plans":{"get":{"summary":"List plans","responses":{"200":{"description":"Plans","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"Create a plan","requestBody":{"required":true,"description":"{ document, activate?, summary?, rationale? } or a raw byoa.plan document","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"201":{"description":"Applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WriteResult"}}}},"202":{"description":"Pending approval","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WriteResult"}}}},"403":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/plans/{id}":{"get":{"summary":"Get a plan","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"view","in":"query","required":false,"description":"document|compiled|summary","schema":{"type":"string"}},{"name":"revision","in":"query","required":false,"description":"Revision number","schema":{"type":"integer"}},{"name":"week","in":"query","required":false,"description":"Week index for view=compiled","schema":{"type":"integer"}}],"responses":{"200":{"description":"Plan view (ETag = revision)","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"$ref":"#/components/responses/Problem"}}},"put":{"summary":"Replace the plan document (creates a revision)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":false,"description":"Revision you edited (or base_revision in the body)","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"{ document, base_revision?, summary?, rationale? } or a raw byoa.plan document","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WriteResult"}}}},"202":{"description":"Pending approval","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WriteResult"}}}},"409":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"},"428":{"$ref":"#/components/responses/Problem"}}},"patch":{"summary":"JSON Patch (RFC 6902) against the current revision","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"description":"{ patch: [...], base_revision?, summary?, rationale? } or a bare patch array with If-Match","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Applied","content":{"application/json":{"schema":{"type":"object"}}}},"202":{"description":"Pending","content":{"application/json":{"schema":{"type":"object"}}}},"409":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/plans/{id}/revisions":{"get":{"summary":"Revision history (newest first)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Revisions","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/plans/{id}/revisions/{n}/approve":{"post":{"summary":"Approve a pending revision (user only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"n","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Applied","content":{"application/json":{"schema":{"type":"object"}}}},"409":{"$ref":"#/components/responses/Problem"}}}},"/v1/plans/{id}/revisions/{n}/reject":{"post":{"summary":"Reject a pending revision (user only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"n","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Rejected","content":{"application/json":{"schema":{"type":"object"}}}},"409":{"$ref":"#/components/responses/Problem"}}}},"/v1/plans/{id}/revert":{"post":{"summary":"Revert to an earlier revision (new revision, subject to approval mode)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"description":"{ to_revision }","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Applied","content":{"application/json":{"schema":{"type":"object"}}}},"202":{"description":"Pending","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/schedule":{"get":{"summary":"Planned/completed/missed sessions","parameters":[{"name":"from","in":"query","required":false,"description":"ISO date","schema":{"type":"string"}},{"name":"to","in":"query","required":false,"description":"ISO date","schema":{"type":"string"}}],"responses":{"200":{"description":"Schedule","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/logs/workouts":{"get":{"summary":"Workout logs (newest first)","parameters":[{"name":"from","in":"query","required":false,"description":"ISO date","schema":{"type":"string"}},{"name":"to","in":"query","required":false,"description":"ISO date","schema":{"type":"string"}},{"name":"exercise","in":"query","required":false,"description":"Catalogue id","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"Pagination cursor","schema":{"type":"string"}}],"responses":{"200":{"description":"{ logs, next_cursor, total }","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"Record a workout (byoa.log@0.1)","requestBody":{"required":true,"description":"byoa.log document","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"201":{"description":"Logged","content":{"application/json":{"schema":{"type":"object"}}}},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/import/hevy":{"post":{"summary":"Import a Hevy workout export (user/owner token only). Dry run unless commit=1; re-imports skip existing logs","parameters":[{"name":"commit","in":"query","required":false,"description":"1 to insert (default: dry run)","schema":{"type":"string"}},{"name":"tz","in":"query","required":false,"description":"IANA zone for Hevy local times (default: server zone)","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"Hevy CSV (max 5 MB)","content":{"text/csv":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object","properties":{"csv":{"type":"string"}},"required":["csv"]}}}},"responses":{"200":{"description":"Dry run: { dry_run, stats, unmatched, warnings, would_insert, would_skip_duplicates, preview }","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"{ dry_run: false, stats, unmatched, warnings, inserted, skipped_duplicates, log_ids }","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"$ref":"#/components/responses/Problem"},"413":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/logs/food":{"get":{"summary":"One day's food entries and totals","parameters":[{"name":"date","in":"query","required":false,"description":"YYYY-MM-DD (default today)","schema":{"type":"string"}}],"responses":{"200":{"description":"{ date, entries, totals: { kcal, protein_g, carbs_g, fat_g } }","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"Log food eaten","requestBody":{"required":true,"description":"{ date?: YYYY-MM-DD (default today), kcal, protein_g, carbs_g, fat_g, name? }","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"201":{"description":"{ food_id, entry, day_totals }","content":{"application/json":{"schema":{"type":"object"}}}},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/media":{"get":{"summary":"Exercise animation URLs that exist on this server","responses":{"200":{"description":"{ exercises: { [id]: { front34, side, poster } } } (absolute URLs or null)","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/media/{file}":{"get":{"summary":"Exercise animation file (public; Range requests supported)","security":[],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"video/mp4 or image/jpeg"},"206":{"description":"Partial content"},"404":{"$ref":"#/components/responses/Problem"},"416":{"description":"Range not satisfiable"}}}},"/v1/connections":{"get":{"summary":"Agent connections (owner only)","responses":{"200":{"description":"{ connections }","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"Create an agent connection (owner only). The token is returned once; only its hash is stored.","requestBody":{"required":true,"description":"{ name, client?, approval_mode: auto|approve|readonly }","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"201":{"description":"{ connection, token, mcp_url, mcp_url_with_token }","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/connections/{id}":{"patch":{"summary":"Change approval mode (owner only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"description":"{ approval_mode }","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Connection","content":{"application/json":{"schema":{"type":"object"}}}}}},"delete":{"summary":"Revoke a connection and its token (owner only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ revoked }","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/oauth-protected-resource/mcp":{"get":{"summary":"OAuth protected-resource metadata for /mcp (RFC 9728; also served at /.well-known/oauth-protected-resource)","security":[],"responses":{"200":{"description":"{ resource: <base>/mcp, authorization_servers: [<base>], scopes_supported, bearer_methods_supported }","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/oauth-authorization-server":{"get":{"summary":"OAuth authorization-server metadata (RFC 8414). Not an OpenID provider: /.well-known/openid-configuration is 404","security":[],"responses":{"200":{"description":"{ issuer, authorization_endpoint, token_endpoint, registration_endpoint, revocation_endpoint, code_challenge_methods_supported: [S256], client_id_metadata_document_supported: true, authorization_response_iss_parameter_supported: true, … }","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/oauth/register":{"post":{"summary":"Dynamic Client Registration (RFC 7591). Redirect URIs: https, or http on localhost/127.0.0.1/[::1] (any port). Default token_endpoint_auth_method none","security":[],"requestBody":{"required":true,"description":"{ client_name?, redirect_uris, token_endpoint_auth_method?, grant_types?, response_types?, client_uri? }","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"201":{"description":"{ client_id, client_id_issued_at, client_secret? , … }","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"{ error: invalid_redirect_uri | invalid_client_metadata, error_description }","content":{"application/json":{"schema":{"type":"object"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/oauth/authorize":{"get":{"summary":"Authorization endpoint (browser). Requires response_type=code, client_id (registered id or a Client ID Metadata Document URL), redirect_uri, code_challenge + code_challenge_method=S256; state passed through; resource = <base>/mcp. Shows a pairing code; the user approves in the app; then redirects to redirect_uri with code, state and iss (or error=access_denied). Requests expire after 10 minutes","security":[],"parameters":[{"name":"response_type","in":"query","required":false,"description":"code","schema":{"type":"string"}},{"name":"client_id","in":"query","required":false,"description":"Client id","schema":{"type":"string"}},{"name":"redirect_uri","in":"query","required":false,"description":"Registered redirect URI","schema":{"type":"string"}},{"name":"code_challenge","in":"query","required":false,"description":"PKCE S256 challenge","schema":{"type":"string"}},{"name":"code_challenge_method","in":"query","required":false,"description":"S256","schema":{"type":"string"}},{"name":"state","in":"query","required":false,"description":"Opaque, returned unchanged","schema":{"type":"string"}},{"name":"scope","in":"query","required":false,"description":"Space-separated scopes (default: all)","schema":{"type":"string"}},{"name":"resource","in":"query","required":false,"description":"<base>/mcp","schema":{"type":"string"}}],"responses":{"302":{"description":"To the pairing page, or back to the client with an error"},"400":{"description":"HTML error page (unknown client or redirect URI)"}}}},"/oauth/token":{"post":{"summary":"Token endpoint (application/x-www-form-urlencoded). grant_type=authorization_code (code, redirect_uri, client_id, code_verifier, resource; codes are single-use and live 60 s) or refresh_token (refresh_token, client_id; rotates; replaying a used refresh token revokes the sign-in)","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"{ access_token, token_type: Bearer, expires_in: 3600, refresh_token, scope }","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"{ error: invalid_grant | invalid_request | invalid_target | unsupported_grant_type, error_description }","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"{ error: invalid_client }","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/oauth/revoke":{"post":{"summary":"Token revocation (RFC 7009): token, token_type_hint?, client_id. Revoking a refresh token ends the whole sign-in. Always 200","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Revoked (or unknown)"}}}},"/v1/oauth/requests":{"get":{"summary":"Pending agent sign-in requests (owner only): { requests: [{ id, client_name, client_uri?, redirect_host, code, scopes, created_at, expires_at }] }","responses":{"200":{"description":"{ requests }","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"$ref":"#/components/responses/Problem"}}}},"/v1/oauth/requests/{id}/approve":{"post":{"summary":"Approve a sign-in request (owner only). Creates a normal agent connection (client guessed: claude | chatgpt | other); deleting it revokes its OAuth tokens","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"description":"{ approval_mode: 'auto' | 'approve' | 'readonly', name? }","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"{ connection }","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"$ref":"#/components/responses/Problem"},"404":{"$ref":"#/components/responses/Problem"},"409":{"$ref":"#/components/responses/Problem"},"410":{"$ref":"#/components/responses/Problem"},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/oauth/requests/{id}/deny":{"post":{"summary":"Decline a sign-in request (owner only); the browser is sent back with error=access_denied","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Declined"},"403":{"$ref":"#/components/responses/Problem"},"404":{"$ref":"#/components/responses/Problem"},"409":{"$ref":"#/components/responses/Problem"}}}},"/v1/summary/progress":{"get":{"summary":"Agent-optimised progress digest","parameters":[{"name":"period","in":"query","required":false,"description":"7d|28d|custom","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"custom start","schema":{"type":"string"}},{"name":"to","in":"query","required":false,"description":"custom end","schema":{"type":"string"}}],"responses":{"200":{"description":"Summary","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/nutrition":{"get":{"summary":"Active nutrition plan and pending changes","responses":{"200":{"description":"Nutrition","content":{"application/json":{"schema":{"type":"object"}}}}}},"put":{"summary":"Create or replace the nutrition plan","requestBody":{"required":true,"description":"byoa.nutrition document","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Applied","content":{"application/json":{"schema":{"type":"object"}}}},"202":{"description":"Pending","content":{"application/json":{"schema":{"type":"object"}}}},"422":{"$ref":"#/components/responses/Problem"}}}},"/v1/nutrition/revisions/{n}/approve":{"post":{"summary":"Approve pending nutrition change","parameters":[{"name":"n","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Applied","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/nutrition/revisions/{n}/reject":{"post":{"summary":"Reject pending nutrition change","parameters":[{"name":"n","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Rejected","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/messages":{"get":{"summary":"Agent inbox (for the app), newest first: { messages: [{ id, created_at, from: { connection, name }, title?, body, kind: note|weekly_review|plan_change|alert, read, data? }] }. System weekly digests have from.connection \"system\", kind weekly_review and data { end }","responses":{"200":{"description":"Messages","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"Post a note to the user's Agent inbox","requestBody":{"required":true,"description":"{ body, title?, kind? }","content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"201":{"description":"Delivered","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/export":{"get":{"summary":"Full byoa.export@0.1 bundle","responses":{"200":{"description":"Export","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}