HTTP API

API Reference

This reference describes the current Identity routes and the separately hosted, server-to-server Governance endpoint. Protected endpoints accept the secure session cookie or an Authorization: Bearer access token. Use the Developer Toolkit for copyable patterns and local sample tools.

The public GET /api route is a small liveness response, not this documentation. Readiness at GET /api/ready checks persistence. Neither health route authenticates a user.

Identity: health and authentication

Method and pathAccessBehavior
GET /api/healthPublicProcess liveness response; does not verify PostgreSQL.
GET /api/readyPublicChecks repository readiness; returns 503 if persistence is unavailable.
POST /api/auth/registerPublicJSON: email, password (12–128 characters), optional name. Creates an account and session; returns 201.
POST /api/auth/loginPublicJSON: email and password. Returns a short-lived access token and sets HttpOnly session cookies.
POST /api/auth/refreshRefresh cookie or tokenRotates the refresh session and issues a new access token.
GET /api/auth/meSigned-in userReturns the authenticated user after verifying the active session.
POST /api/auth/logoutSigned-in userRevokes the current session and clears session cookies.

Account: own profile, sessions, and activity

Method and pathBehavior
GET /api/account/profileRead the signed-in user's profile.
PATCH /api/account/profileJSON: {"name":"New display name"}. Updates the display name only.
GET /api/account/sessionsList up to 50 of the user's recent sessions and active count.
POST /api/account/sessions/{sessionId}/revokeRevoke a session belonging to the signed-in user.
GET /api/account/activity?limit=20Read recent account audit activity; limit is 1–50.
GET /api/account/securityRead session counts, last login, membership date, and MFA flag. MFA enrollment is not available in this release.

Administrator: restricted operations

All /api/admin/* endpoints require an authenticated account with the administrator role. Do not expose administrator credentials or use these endpoints from public client-side code.

Method and pathBehavior
GET /api/admin/overviewRead operational account/session/audit/quarantine totals.
GET /api/admin/users?limit=25&offset=0&search=Search and page through users.
PATCH /api/admin/users/{userId}/roleChange a user role through audited maker-checker protections.
GET /api/admin/sessions?limit=25&offset=0&active=truePage through sessions; active filter is optional.
POST /api/admin/sessions/{sessionId}/revokeRevoke a session by administrator action.
GET /api/admin/audit-logs?limit=50&offset=0Page through audit events, optionally filtered by event type.
GET /api/admin/quarantine?limit=25&offset=0Page through quarantine records; optional status filter is QUARANTINED or COMMITTED.

Governance: server-to-server evaluation

The Governance service listens separately (default local port 4000). It is not a public browser API. The calling API must authenticate to Identity first, then call Policy with a server-only bearer token, a verified subject role, a server-selected target domain, action, and SHA-256 payload hash.

Method and pathAccessRequest fieldsResult
POST /api/v1/governance/evaluateConfigured service principal bearer tokenrequestId, targetDomainId, action (READ/WRITE/EXECUTE), payloadHash (64 lowercase hex), optional verified subjectId and mapped subjectRole.Signed verdict with allowed, reason, enforced rule, proof hash, timestamp, and signature. Unknown/malformed requests fail; callers must fail closed.

Example: sign in without putting credentials in source control

curl -i "$IDENTITY_URL/api/auth/login" \
  -H 'Content-Type: application/json' \
  --data '{"email":"you@example.test","password":"REPLACE_WITH_YOUR_PASSWORD"}'

Use HTTPS and the HttpOnly session cookie in browser flows. Treat any access token returned in the JSON body as a secret; never commit it, place it in a URL, or store it in browser local storage. Authentication writes are origin-checked and rate-limited.

Typical responses: 400 invalid input, 401 invalid or expired credentials, 403 rejected cross-site write or policy denial, 409 duplicate registration, 429 rate limit, and 503 unavailable persistence/upstream service. See troubleshooting, Quickstart, and trust boundaries.