Skip to content

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 ​

MethodPathMinimum roleWhat it doesMain fields
POST/v1/auth/loginnone (signs in)Signs in and sets the session cookie.Body: username, password. Response: principal, csrf_token, expires.
POST/v1/auth/logoutnoneEnds the session.none
GET/v1/auth/sessionany signed-in roleReturns the current session's principal, csrf_token and expiry.none
POST/v1/auth/passwordany signed-in roleChanges the caller's own password.Body: current, new.

API tokens ​

MethodPathMinimum roleWhat it doesMain fields
GET/v1/tokensadmin, all applicationsLists tokens (secrets are never returned).Response: tokens.
POST/v1/tokensadmin, all applicationsCreates a token; the secret is shown once.Body: name, role, apps, expires_in (duration, for example 720h).
DELETE/v1/tokens/{id}admin, all applicationsRevokes a token.none

Accounts ​

MethodPathMinimum roleWhat it doesMain fields
GET/v1/accountsadmin, all applicationsLists accounts.Response: accounts.
POST/v1/accountsadmin, all applicationsCreates an account.Body: name, password, role, apps.
PATCH/v1/accounts/{name}admin, all applicationsChanges an account's role, applications or disabled state.Body: role, apps, disabled (any of them).
DELETE/v1/accounts/{name}admin, all applicationsDeletes an account. The last administrator cannot be deleted.none
POST/v1/accounts/{name}/passwordadmin, all applicationsSets a new password for an account.Body: password.

Audit log ​

MethodPathMinimum roleWhat it doesMain fields
GET/v1/auditadmin, all applicationsLists audit records.Query: actor, action, since (a duration such as 24h), limit. Response: records.
GET/v1/audit/verifyadmin, all applicationsChecks 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/tokens

The 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.