Users API

Accounts are managed under /api/db-devops/users, invitations under /api/onboarding, and passwords set from a link under /api/auth. Changes need the admin role. Errors are JSON with error and code.

Routes

MethodEndpointWhoPurpose
GET/api/db-devops/usersAnyone signed inAdmins get every account; others get only their own
GET/api/db-devops/users/:idAnyone signed inOne account; another account is 404 to a non-admin
POST/api/db-devops/usersAdminCreate an account with a password
PUT/api/db-devops/users/:idAdminChange name, email or role
PUT/api/db-devops/users/:id/passwordAdmin, or the account itselfSet a new password
POST/api/db-devops/users/:id/deactivate, /activateAdminStop or allow sign-in
DELETE/api/db-devops/users/:idAdminDelete an account
POST/api/onboarding/provision-userAdminInvite: create the account and a setup link
POST/api/onboarding/resend-inviteAdminNew setup link for an invite that is still pending (reactivates a deactivated invite)
POST/api/auth/reset-passwordHolder of a setup or reset linkSet the password from the link's token
GET/api/auth/password-policyAnyone{ "minLength", "complexity", "rule" }: the rule every new password must meet
GET/api/auth/idp/statusAnyoneThe providers turned on, and passwordSignIn: everyone, or administrators when local authentication is off

/api/auth/register, GET /api/auth/users, PUT /api/auth/users/:id/role and DELETE /api/auth/users/:id (which deactivates) apply the same checks.

Accounts

{ "id": "…", "email": "dba@example.com", "name": "Dana", "role": "approver", "is_active": true,
  "last_login": "2026-10-08T14:02:11Z", "invite_pending": false, "created_at": "…", "updated_at": "…" }

invite_pending is true for an invited account that has not set its password yet. No route returns passwords, password hashes, MFA secrets, backup codes or reset tokens.

Creating and changing accounts

POST /api/db-devops/users
{ "email": "dba@example.com", "name": "Dana", "role": "approver", "password": "Strong-pass-2026!" }

PUT /api/db-devops/users/:id
{ "role": "release_manager" }

PUT /api/db-devops/users/:id/password
{ "new_password": "Another-pass-2026!", "current_password": "…" }

POST /api/onboarding/provision-user
{ "email": "dba@example.com", "name": "Dana", "role": "user", "notify": true }
→ 201 { "success": true, "user": { … }, "setupUrl": "https://…/setup?token=…", "emailed": true }

Sessions

Every request checks the account behind the session token. A deactivated or deleted account, or a session issued before a password reset, gets 401:

{ "error": "Your session has ended because the account was deactivated. Sign in again.", "code": "SESSION_ENDED" }

A role change applies to the account's next request.

Error codes

StatusCodeMeaning
400INVALID_USERAn email, name or role is missing or invalid, or a field cannot be changed; the message names it
400WEAK_PASSWORDThe password does not meet the rule; the message states it
401SESSION_ENDEDThe account was deactivated or deleted, its password was reset, or it no longer holds a license seat
403CURRENT_PASSWORD_WRONGChanging your own password without your current one
404USER_NOT_FOUNDNo such account, a malformed id, or another account read by a non-admin
409EMAIL_TAKENAnother account has that email
409LAST_ADMINThe change would leave no active admin
409OWN_ACCOUNTDeactivating or deleting your own account
409USER_IN_USEThe account is still referred to by records that must be kept; deactivate it instead
409NO_FREE_SEATCreating, inviting or reactivating a user when every license seat is taken
500USER_CHANGE_FAILED, USERS_UNREADABLE, INVITE_FAILEDThe change, the read or the invitation failed; the server log has the cause