Reference

Cadence API

A small, predictable REST API for your own Cadence data. Use it from scripts, integrations, or hand the generated SKILL.md to any AI assistant.

Base URL: https://cadence-ad3.pages.dev/v1 · All responses are JSON with an ok boolean. Timestamps are epoch milliseconds.

Authentication

Create a key in the app (Dashboard → API). Send it as a bearer token on every request:

Authorization: Bearer cad_live_xxxxxxxxxxxxxxxxxxxxxxxx

Keys are shown only once at creation and stored as salted hashes. Revoke instantly from the dashboard. Default scopes: records:read, records:write, analytics:read.

Data isolation & safety

A key only ever accesses the account that created it. Every request is authorized by the key owner’s id. There is no parameter, endpoint, or trick that lets a key read, modify, or discover another user’s account, records, or analytics — and keys carry no admin capability.

Errors & rate limits

Errors return a non-2xx status and { "ok": false, "error": "...", "code": "..." }. Rate limit: 120 requests/minute per key (HTTP 429 when exceeded).

StatusMeaning
200 / 201Success
401Missing/invalid key
403Missing scope
404Not found
422Validation error
429Rate limited

Account

GET /v1/me

Returns the account and key metadata. Use it to verify a key.

curl https://cadence-ad3.pages.dev/v1/me \
  -H "Authorization: Bearer cad_live_..."

Records

typecigarette · patch · gum · lozenge · caffeine · protein · calories. The server computes derived metrics (nicotine_mg, caffeine_mg, protein_g, calories_kcal).

GET /v1/records — query: type, from, to, limit, offset
POST /v1/records
GET /v1/records/:id
PATCH /v1/records/:id
DELETE /v1/records/:id
curl -X POST https://cadence-ad3.pages.dev/v1/records \
  -H "Authorization: Bearer cad_live_..." \
  -H "Content-Type: application/json" \
  -d '{"type":"cigarette","quantity":1,"trigger":"coffee"}'

curl -X POST https://cadence-ad3.pages.dev/v1/records \
  -H "Authorization: Bearer cad_live_..." -H "Content-Type: application/json" \
  -d '{"type":"caffeine","quantity":1,"meta":{"source":"brewed_coffee"}}'
FieldTypeNotes
typestringrequired
quantitynumbercount / pieces / grams / kcal / servings
occurred_atnumberepoch ms; defaults to now; backfill allowed
trigger, mood, notestringoptional
metaobjectstrength, brand, source, mg, food name, macros…

Analytics

GET /v1/analytics?range=7d|30d|90d

Daily series + totals for your account: per-metric sums, today, last 24h, type & trigger breakdowns, goal progress.

curl "https://cadence-ad3.pages.dev/v1/analytics?range=30d" \
  -H "Authorization: Bearer cad_live_..."

Insights

GET /v1/insights

The deterministic 24h / 2d / 7d trend summary with arrows, gentle flags, and correlation callouts (optionally AI-polished). Scoped to your account.

SKILL.md for AI assistants

When you create a key, Cadence generates a SKILL.md file you can download and drop into any AI assistant. It contains the software name, your key, full usage instructions, and the isolation guarantee — so an AI can safely operate only your account.

Why it’s safe:
  • The embedded key is bound to one account — yours.
  • It can’t reach any other user’s data; the server authorizes by owner id.
  • No admin powers; scoped to records + analytics only.
  • Revoke it anytime and the SKILL.md stops working instantly.
Generate a key & download SKILL.md →