Appearance
Accounts and audit API Since v0.1
Sign-in and session routes work without an existing session. Token, account and audit routes need the admin role with access to every application. For the role model, see Accounts and roles. For the log, see Audit log.
For the base URL, sign-in, roles and error format, see Management API. Except sign-in, a route answers 401 without credentials and 403 when the role is too low.
Routes
Sign-in and sessions
| Method | Path | Minimum role | What it does | Main fields |
|---|---|---|---|---|
POST | /v1/auth/login | none (signs in) | Signs in and sets the session cookie. | Body: username, password. Response: principal, csrf_token, expires. |
POST | /v1/auth/logout | none | Ends the session. | none |
GET | /v1/auth/session | any signed-in role | Returns the current session's principal, csrf_token and expiry. | none |
POST | /v1/auth/password | any signed-in role | Changes the caller's own password. | Body: current, new. |
API tokens
| Method | Path | Minimum role | What it does | Main fields |
|---|---|---|---|---|
GET | /v1/tokens | admin, all applications | Lists tokens (secrets are never returned). | Response: tokens. |
POST | /v1/tokens | admin, all applications | Creates a token; the secret is shown once. | Body: name, role, apps, expires_in (duration, for example 720h). |
DELETE | /v1/tokens/{id} | admin, all applications | Revokes a token. | none |
Accounts
| Method | Path | Minimum role | What it does | Main fields |
|---|---|---|---|---|
GET | /v1/accounts | admin, all applications | Lists accounts. | Response: accounts. |
POST | /v1/accounts | admin, all applications | Creates an account. | Body: name, password, role, apps. |
PATCH | /v1/accounts/{name} | admin, all applications | Changes an account's role, applications or disabled state. | Body: role, apps, disabled (any of them). |
DELETE | /v1/accounts/{name} | admin, all applications | Deletes an account. The last administrator cannot be deleted. | none |
POST | /v1/accounts/{name}/password | admin, all applications | Sets a new password for an account. | Body: password. |
Audit log
| Method | Path | Minimum role | What it does | Main fields |
|---|---|---|---|---|
GET | /v1/audit | admin, all applications | Lists audit records. | Query: actor, action, since (a duration such as 24h), limit. Response: records. |
GET | /v1/audit/verify | admin, all applications | Checks the audit log's integrity chain. | none |
Example
sh
curl -sk -X POST -H "Authorization: Bearer waap_EXAMPLE" -H "Content-Type: application/json" -d '{"name":"ci","role":"viewer","expires_in":"720h"}' https://127.0.0.1:9443/v1/tokensThe owner-only admin socket also serves GET /v1/local/accounts, POST /v1/local/accounts and POST /v1/local/accounts/{name}/password, which create the first administrator and recover a password without signing in. They are not on the management listener.