physıque

Docs

HTTP API

Base URL https://wdj534go6k.execute-api.us-east-1.amazonaws.com/agent/v1. Bearer auth. JSON in, JSON out. Dates are calendar days in America/Detroit; weight in lb, calories in kcal, macros in g.

curl -H "Authorization: Bearer $PHYSIQUE_TOKEN" \
  "https://wdj534go6k.execute-api.us-east-1.amazonaws.com/agent/v1/discovery"

Routes

RouteScopeNotes
GET /discoveryanyGranted scopes, timezone, units, limits, freshness.
GET /days?from=&to=&limit=&cursor=fitness:readlimit ≤ 100. Follow cursor until null.
GET /days/{date}fitness:readOne day plus computed totals.
PUT /days/{date}fitness:writeBody needs requestId and expectedRevision.
GET /foodsnutrition:readSaved foods and recipes.
PUT /foods/{slug}nutrition:writeVersioned; slug must equal the normalized name.
GET /export?from=&to=&limit=&cursor=fitness:read + nutrition:readlimit ≤ 50. Versioned pages of days and foods.
GET /photos?from=&to=&tag=&association=&search=photos:metadataMetadata only.
GET /photos/{id}/content?thumbnail=photos:contentReturns a URL that expires in 5 minutes.

The day record

{
  "date": "2026-09-09",
  "revision": 7,
  "weight": 198.4,
  "workout": "barbell overhead press\n155 10\n135 10\n135 10",
  "foodItems": [
    { "id": "…", "name": "Egg scramble", "portion": "6 eggs", "quantity": 6, "foodSlug": "egg-scramble",
      "macros": { "calories": 613, "protein": 56, "carbs": 11, "fat": 37 },
      "estimated": false, "source": "saved", "basis": "serving" }
  ],
  "foodNotes": "handful of almonds",
  "prepNotes": "batch: 5 lb chicken thighs, 4 cups rice, 2 jars butter chicken sauce, yield 8 boxes",
  "steps": 11546
}

prepNotes is what was cooked in batch that day (ingredients, weights, yield), not food eaten: it is never itemized and never counted in totals.

Saved foods with scales: true carry per-unit macros and a fixed base that does not scale: portion = base + macros × quantity. Nutrients that are absent are unknown, never zero. Items from photos or the web are estimated: true with their source named.

Writes

curl -X PUT -H "Authorization: Bearer $PHYSIQUE_WRITE_TOKEN" -H "content-type: application/json" \
  "https://wdj534go6k.execute-api.us-east-1.amazonaws.com/agent/v1/days/2026-09-09" \
  -d '{"requestId":"agent-7f3c…","expectedRevision":7,"weight":198.4}'
  • expectedRevision must match the live record. A stale value returns 409 with the current record; show it to the user and retry with intent, never silently.
  • requestId is idempotent: replaying the same id returns the original receipt, so a lost response is safe to retry.
  • Partial bodies are fine: send only the fields you are changing.

Errors

StatusMeaning
401Missing, expired or revoked credential.
403Credential lacks the scope. Create a separate credential; do not look for another way in.
409Revision conflict; body contains the live record.
429Rate limited (5 requests/s, burst 10). Back off.

Credentials

Created and revoked in the app under Agent access. Shown once; the server stores a SHA-256. Maximum lifetime one year. Bound to the owner: the API decides whose data a token reads, never the request.