HTTP API

The endpoints these pages talk to. The same contract is spelled out, with request and response bodies, in src/site/BACKEND.md.

Authentication

Session endpoints set an HttpOnly cookie and are called by the browser. Everything else takes Authorization: Bearer <token>.

MethodPathPurpose
POST/api/auth/registerCreates an account, starts a session.
POST/api/auth/loginStarts a session.
POST/api/auth/logoutEnds it.
GET/api/auth/github/startRedirects into the OAuth flow.

Content

Each page can ask for a fresher version of itself. The payload is the page’s content document — DocsContent or AuthContent — and anything that fails validation is ignored, so a bad deploy leaves the built-in page standing.

MethodPathReturns
GET/api/docs/:pageIdDocsContent
GET/api/auth/page/:modeAuthContent

Errors

A rejected submission is 422 with a body the form can render in place. field names an input; omit it for a form-level message.

422 Unprocessable Entity
{  "ok": false,  "errors": [    { "field": "email", "message": "That address is already registered." },    { "message": "Check the highlighted fields." }  ]}