Conventions

All routes are versioned under /api/v1. Requests and responses are JSON. Authenticated routes take an Authorization: Bearer <token> header.

Responses use { "ok": true, ... } for success and a non-2xx status with { "ok": false, "error": "..." } for failure. CORS allows the configured origin with the content-type and authorization headers.

Endpoints

GET /api/v1/config

Public. Returns captchaProvider, captchaSiteKey, and allowRegistration. Use it to render the captcha widget.

POST /api/v1/signup

Create an account. Body: { username, password, email?, captcha? }. Returns 201 on success.

POST /api/v1/signin

Body: { username, password, captcha? }. Returns { token, refreshToken, user }.

POST /api/v1/signout

Revokes the current session. Authenticated.

GET /api/v1/session

Returns the current user. Authenticated. A 401 triggers a client refresh.

POST /api/v1/refresh

Body: { refreshToken }. Returns a new { token, refreshToken } pair.

POST /api/v1/forgot-password

Body: { username, captcha? }. Issues a reset token and emails a link. Always returns success so the endpoint cannot enumerate accounts.

POST /api/v1/reset-password

Body: { token, password }. Sets the new password and marks the token used.

Errors

StatusMeaning
400Malformed request or invalid input
401Missing or invalid credentials or token
403Insufficient permission
409Conflicting state, such as an existing username
429Rate limit exceeded
500Server error

Error strings are stable and safe to display. Never log tokens or passwords.