Skip to content
Drydock
API

Users API

Create, disable, delete and change the role of database users.

Pre-release docs

These docs cover v1.9, a release candidate that isn't generally available yet. Running the stable release? Read the docs for v1.7.

Database users sign in with a username and password like a Basic user, but they live in the Drydock store and an admin manages them at runtime. Every route below needs the admin role and a signed-in session. An API key gets 403 whatever its scopes, and so does an anonymous caller or a recovery-code session on any write.

A user's role is read on every request, so a role change, disable or delete takes effect on that user's next request. Disabling a user, resetting a password and deleting a user also end that user's open sessions. API keys the user created are not tied to the account and keep working, so revoke a removed admin's keys under API Keys as well.

Users defined with DD_AUTH_BASIC_* are listed here read-only. They win a name collision: a database user whose name matches an environment user (ignoring case) is marked shadowed and cannot sign in.

List users

curl http://drydock:3000/api/v1/users

{
  "data": [
    {
      "id": "basic.ops",
      "username": "ops",
      "role": "admin",
      "disabled": false,
      "source": "environment",
      "createdAt": null,
      "updatedAt": null,
      "twoFactor": false
    },
    {
      "id": "6f1c2b0e-8a4d-4e0b-9a52-3f0f7c1d2e11",
      "username": "vera",
      "role": "viewer",
      "disabled": false,
      "source": "database",
      "createdAt": "2026-12-02T12:00:00.000Z",
      "updatedAt": "2026-12-02T12:00:00.000Z",
      "twoFactor": false
    }
  ]
}

The password hash is never returned.

Create a user

curl -X POST http://drydock:3000/api/v1/users \
  -H "Content-Type: application/json" \
  -d '{"username":"vera","password":"a-long-password","role":"viewer"}'
FieldRequiredDescription
username🔴1 to 64 characters from A-Z a-z 0-9 . _ @ -. Unique ignoring case
password🔴12 to 1024 characters, no : (HTTP Basic cannot carry one). Stored as an argon2id hash
role🔴viewer, operator or admin

Answers 201 with the new user. A taken name answers 409 with details.reason of username-taken, or managed-by-environment when an environment user holds it.

Change a user

curl -X PATCH http://drydock:3000/api/v1/users/6f1c2b0e-8a4d-4e0b-9a52-3f0f7c1d2e11 \
  -H "Content-Type: application/json" \
  -d '{"role":"operator"}'

Send at least one of role, disabled or password. Any other field is a 400. Answers 200 with the updated user.

Delete a user

curl -X DELETE http://drydock:3000/api/v1/users/6f1c2b0e-8a4d-4e0b-9a52-3f0f7c1d2e11

Answers 204. The user's second factor and any pending enrollment are removed with it.

Refusals

These answer 409 with a details.reason:

ReasonWhen
self-modificationYou disable, demote or delete your own account
last-adminThe change would leave no enabled admin able to sign in
managed-by-environmentThe id is an environment user

An unknown id is 404.

Audit

Every write is recorded: user-created, user-updated (with the field names changed, never the password) and user-deleted.