RTFC API

Authentication

Send your token as either header - they are equivalent:

X-Auth-Token: rtfc_…
Authorization: Bearer rtfc_…

Every endpoint requires one. There are no anonymous endpoints, and that is enforced by a gate in front of every route rather than per-handler, so it cannot be forgotten on a new endpoint.

Three kinds of credential

What it isWho uses it
Personal Access Token (rtfc_…)Long-lived API key, created in the dashboard or minted for an end userYour server
Session JWT24h token from POST /v1/auth/tokenInteractive clients that log in with a password
Stream token5-minute, SSE-only, from POST /v1/stream/tokenBrowsers, which cannot send headers on EventSource

A stream token is deliberately useless for anything else: it is rejected as a general bearer token, so leaking one into a URL or a log exposes a read of one stream for five minutes, not your account.

Scopes

A token can be restricted to what it actually needs:

ScopeGrants
readGET anything you can see
writeCreate and modify debates, claims, votes, sessions, media
streamOpen SSE connections
provisionCreate and delete end-user accounts
adminAdministrative endpoints (implies all others)
bash
curl -sX POST $RTFC/tokens \
  -H "X-Auth-Token: $TOKEN" -H 'Content-Type: application/json' \
  -d '{"name": "read-only dashboard", "scopes": ["read"]}'

The plaintext token is returned exactly once. Afterwards you only ever see a prefix.

A token created with no scopes has full access. That is the default, and it is what every token issued before scopes existed has - so nothing broke when scopes arrived. Restrict deliberately; you will not be restricted by accident.

Calling something outside your scopes returns 403:

json
{"error": {"code": "insufficient_scope",
           "message": "This token lacks the 'write' scope",
           "details": {"required_scope": "write", "token_scopes": ["read"]}}}

Which to use

backend, and a separate per-user PAT for each of their accounts. See Multi-tenancy - this matters more than it sounds.

that to the browser. Never ship a PAT to a client.

Rotating and revoking

GET /v1/tokens lists yours; DELETE /v1/tokens/{id} revokes one, effective immediately. Revoke rather than delete the user when a key leaks - the account and its debates survive.