HTTP API
Ward is served behind handle_path /ward-api/*, which strips the prefix. So
a route written /login in the source is POST /ward-api/login to a caller,
and Ward itself never sees the prefix. Every path below is given as the caller
sees it.
Conventions that hold everywhere
- A refusal names the request, never the server. Any unhandled throw becomes
{"error":"internal"}. The default Fastify behaviour putserr.messagein the body, and the reproduction was as bad as it sounds: a missing signing key plus correct credentials answered500with the absolute on-disk path of the estate's signing key, from the one route the whole internet can reach unauthenticated. - Per-session answers are
no-store. Nothing between Ward and a caller may hold one. - Ambiguous failures are one answer. Login,
/session-statusand the client assertion check each collapse their failure modes deliberately; see the relevant page. - Query strings are logged. Fastify's request log line includes the URL, so
nothing secret may travel in one — with the single audited exception of
GET /verify?token=, which has its own log serializer to redact it.
Public — no credential
| Method | Path | What it does |
|---|---|---|
GET | /health | Liveness. Static answer. |
GET | /.well-known/jwks.json | The public half of the signing key. The OpenID Connect provider publishes the same key at /oidc/jwks. |
GET | /apps | Apps open to public registration, for the register page's app picker. |
POST | /register | Create an account at an app whose public_registration flag is on. |
GET | /verify?token= | Consume an emailed verification token. The one route allowed a secret in the query string, because an email client must be able to link to it. |
Session — Ward's own cookies
The access cookie (ward_session) is scoped to Path=/ward-api and the
refresh cookie (ward_refresh) to Path=/ward-api/refresh, so only Ward's own
pages send them. No app receives either.
| Method | Path | What it does |
|---|---|---|
POST | /login | Identifier + password. Sets the access and refresh cookies. |
POST | /refresh | Spends the refresh cookie, rotates the family, reissues both. |
POST | /logout | Revokes the family. Rows are marked, not deleted. |
POST | /refresh/logout | The same, for a caller that holds only the refresh cookie. |
GET | /session | Whether this browser has a live Ward session, for Ward's own UI. Always 200. |
GET | /account | This account's own identity and grants. |
POST | /account/password | Change own password. |
POST | /account/sessions/revoke-others | Sign out every other session, keeping this one. |
POST /login collapses every failure into one answer, and unknown identifiers
still spend a dummy hash so timing does not leak account existence. The lockout
is deliberately not keyed on request.ip — see
decisions-implementation.
Service — the client assertion
An app authenticates as its OpenID Connect client: a fresh private_key_jwt
assertion (client_assertion_type + client_assertion, aud = the issuer) in
the JSON body. A missing or bad assertion is 401 {"error":"invalid_client"}.
| Method | Path | What it does |
|---|---|---|
POST | /session-status | Is this Ward session, signed in through OpenID Connect, still live and the grant still held? Apps cache the answer for 30 seconds. Only mounted when WARD_OIDC_ISSUER is set. |
POST | /notify | Mail one of the calling app's users. Ward holds the address; the app never sees it. |
Both are described in Sign in with Ward.
POST /introspect, the x-ward-app-key header and the console's app-key
routes are gone; a request to /introspect is now 404. The history is in
decisions — app keys.
OpenID Connect
When WARD_OIDC_ISSUER is set, Ward also serves the provider under /oidc/*
(discovery, JWKS, authorization, token, end session) and its login step at
/refresh/oidc/:uid. The full table is on Sign in with Ward.
Console — the superuser cookie
Every path below sits under /console/ and that is functional, not cosmetic:
the ward_console cookie is scoped to Path=/ward-api/console, so a route
mounted anywhere else would simply never receive it.
| Method | Path | What it does |
|---|---|---|
POST | /console/login | Superuser sign-in. Separate credential, separate cookie. |
POST | /console/logout | End the console session. |
GET | /console/session | Whether the console session is live. |
GET | /console/apps | List apps. |
POST | /console/apps | Create an app. |
GET | /console/apps/:slug | One app. |
PATCH | /console/apps/:slug | Change name, registration flag, baseline role. |
DELETE | /console/apps/:slug | Delete an app — cascades to every grant into it. |
PUT | /console/apps/:slug/oidc | Set the app's OpenID Connect client: redirect URIs, sign-out return URIs, public key. |
GET | /console/accounts | List accounts. |
POST | /console/accounts | Create an account. |
GET | /console/accounts/:subject | One account. |
POST | /console/accounts/:subject/enable | Re-enable a disabled account. |
POST | /console/accounts/:subject/disable | Disable. Existing sessions stop answering as active. |
POST | /console/accounts/:subject/password | Set a password on behalf of an account. |
POST | /console/accounts/:subject/username | Rename. The subject, grants and sessions stay. |
DELETE | /console/accounts/:subject | Delete outright: grants and sessions go with it, the subject is retired. |
GET | /console/accounts/:subject/sessions | Live refresh families for an account. |
POST | /console/accounts/:subject/sessions/revoke | Revoke all of them. |
DELETE | /console/accounts/:subject/sessions/:familyId | Revoke one. |
GET | /console/grants | Grants, filterable. |
POST | /console/grants | Grant a role. |
DELETE | /console/grants | Remove a grant. |
GET | /console/audit | The audit log, newest first. |
The five admin plugins each attach the console guard as a plugin-scope
preHandler, so registering them opens nothing — they gate themselves.
Several console plugins mount paths under /console/accounts/:subject and
/console/apps/:slug. Fastify merges those into one radix tree only while every
plugin spells the parameter the same way. Rename :subject to :sub in one
place and Fastify refuses to boot with a parametric-conflict error — which is
the good outcome, but it is a boot failure, not a test failure.