API conventions
Developers · API conventionsAPI conventions
The rules every endpoint follows. If an endpoint disagrees with this page, the endpoint is wrong.
Envelope
Every successful JSON response is wrapped:
{ "data": … }
Paginated responses add a cursor object:
{ "data": [ … ], "pagination": { "next": "eyJpZCI6NDJ9" } }
pagination.next is null or absent on the last page. Room message history
also keeps data.next for older clients, but new clients use
pagination.next.
Identifiers
All ids are strings in JSON, even though they are integers in SQLite:
"id": "42", "actor_id": "7". Never parse them as numbers and never compare
them with == across types. Request bodies and path parameters accept either
form; the server normalises.
Timestamps
All JSON timestamps are milliseconds since the Unix epoch and end in _at:
created_at, edited_at, expires_at. Two deliberate exceptions:
- OAuth token responses use
created_atin seconds (RFC 6749 convention). - JWT claims (
iat,exp,auth_time) use seconds.
Errors
Non-2xx responses use RFC 9457 problem documents with a stable machine code:
{
"type": "about:blank",
"title": "Not Found",
"status": 404,
"detail": "Post not found.",
"code": "not_found",
"request_id": "7f3c1a9e2b4d6f80"
}
Content type is application/problem+json. code is what clients should branch
on; title and detail are human-facing. request_id matches the
X-Request-Id response header and is safe to quote in a bug report.
Two endpoints keep the OAuth shape on purpose: POST /oauth/token and
POST /oauth/revoke return { "error": "invalid_client", "error_description": … }
per RFC 6749. The client SDKs normalise both into one error type.
Pagination
- Opaque base64url
cursor, never an offset. limitdefault 20, maximum 100 unless the endpoint says otherwise.- Cursors are stable across ranking changes for id-ordered lists. The home timeline is ranked; treat a repeated or skipped item after a rank change as possible and de-duplicate by id.
Idempotency
Send Idempotency-Key: <uuid> on any create request:
POST /statusesPOST /statuses/:id/comment(and/comments)POST /rooms/:id/channels/:cid/messagesPOST /conversations/:username/messages
The first success is stored for 24 hours. A replay returns the original status
and body with X-Idempotency-Replayed: true and performs no side effects.
Generate one key per logical action and reuse it across retries — never include
a timestamp in the key.
Rate limits
120 requests/minute, keyed on the Bearer token when present, otherwise the IP.
Response headers: X-RateLimit-Limit, X-RateLimit-Remaining,
X-RateLimit-Reset. 429 responses carry a problem document. Authentication
endpoints have tighter limits; the Retry-After header is authoritative.
Versioning
X-Extrovert-Api-Version: 2 is on every /api response and
GET /api/v1/instance reports api_version. Additive changes ship without a
version bump; breaking changes are listed in CHANGELOG-API.md.
CORS
Access-Control-Allow-Origin: * for /api requests. Native clients send an
explicit Authorization header and never rely on cookies, so * is safe.
Transport
Production (NODE_ENV=production) fails closed on plain HTTP unless
EXTV_TRUST_PROXY is set and a TLS-terminating proxy forwards the request.
Media and avatars are served from unguessable capability URLs; see
Security.