# Server API: accounts

Source: https://docs.neode.sk/development/api-reference/server-accounts/
Last updated: 2026-12-03

> 9 operations. Console accounts as the server API keeps them: create, change, delete, two-factor sign-in and organizations.

These routes are on the server API, port 21114 (21121 in Docker). They take an API key in `X-API-Key` or a sign-in token; see [The HTTP API](https://docs.neode.sk/development/api.md#signing-in).

Console accounts as the server API keeps them: create, change, delete, two-factor sign-in and organizations.

## GET /api/users

List console accounts.

With ?accessible or ?pageSize in the query this is the RustDesk client's user list instead, which any signed-in account and client token may call: {total, data} with name, display_name, guid, email, note, status and is_admin per account, every account for one with user.view, else only its own when it has devices.

On the server API, port 21114. Needs `user.view`.

| Parameter | In | Type | What it is |
|---|---|---|---|
| `accessible` | query | string | Any value: the RustDesk client's list |
| `pageSize` | query | integer | Any value: the RustDesk client's list |

**200**: Done (`application/json`)

Array of object or object.

| Error | When |
|---|---|
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |

## POST /api/users

Create a console account.

The password takes 8 to 128 characters. You can only give a role whose permissions you have yourself. The account is local; the username is not checked for its form here, unlike in the console.

On the server API, port 21114. Needs the sign-in token of a person; API keys are refused. Needs `user.create`.

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `username` | string | yes |  |
| `password` | string | yes | at least 8 characters, at most 128 characters, write only |
| `role` | string, one of `super_admin`, `admin`, `global_admin`, `server_admin`, `operator`, `viewer`, `guest_issuer`, `pro` |  | Default viewer |

**201**: Created (`application/json`)

| Field | Type |
|---|---|
| `id` | integer |
| `username` | string |
| `role` | string |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | An API key, or a role you may not give |
| 409 | The username is taken, or the database failed |

## PUT /api/users/{id}

Change an account's username, password or role.

Give only what changes. Only an account whose role you could give. LDAP and single sign-on accounts keep their username and have no local password. You cannot lower your own role, and the last active Super admin keeps the role; only server admins change other server admins' roles. Unlike the console, this ends none of the account's sessions.

On the server API, port 21114. Needs the sign-in token of a person; API keys are refused. Needs `user.edit`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | integer | yes | The account ID; at least 1 |

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `username` | string | Letters, digits and _ . @ - |
| `password` | string | at least 8 characters, at most 128 characters, write only |
| `role` | string, one of `super_admin`, `admin`, `global_admin`, `server_admin`, `operator`, `viewer`, `guest_issuer`, `pro` |  |

**200**: Done (`application/json`)

| Field | Type |
|---|---|
| `status` | `"updated"` |
| `id` | integer |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | An API key, an account or role you may not change, or your own demotion |
| 404 | There is no such item |
| 409 | The username is taken, or the account is the last active Super admin |

## DELETE /api/users/{id}

Delete an account.

Only an account whose role you could give; only server admins delete server admins, and the last active Super admin stays. Use the console's DELETE /api/users/{id} to hand its things over first.

On the server API, port 21114. Needs the sign-in token of a person; API keys are refused. Needs `user.delete`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | integer | yes | The account ID; at least 1 |

**200**: Done (`application/json`)

| Field | Type |
|---|---|
| `status` | `"deleted"` |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 404 | There is no such item |
| 409 | The account is the last active Super admin |

## GET /api/users/{id}/organizations

List the organizations an account belongs to.

On the server API, port 21114. Needs `user.view`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | integer | yes | The account ID; at least 1 |

**200**: Done (`application/json`)

| Field | Type |
|---|---|
| `organizations` | array of [AccountOrganization](https://docs.neode.sk/development/api-reference/schemas.md#accountorganization) |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |

## POST /api/users/{id}/organizations

Add an account to an organization.

The membership gets the role user; a role in the body is not read. Unless you are a Super admin or Global admin you must be a member of the organization yourself.

On the server API, port 21114. Needs `org.manage_users`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | integer | yes | The account ID; at least 1 |

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `org_id` | string or integer | yes | The organization's ID |

**201**: The new membership (`application/json`)

[OrgMembership](https://docs.neode.sk/development/api-reference/schemas.md#orgmembership).

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | You are not a member of the organization |
| 404 | There is no such organization or account |
| 409 | The account is a member already |

## DELETE /api/users/{id}/totp

Turn off an account's two-factor sign-in.

The secret and the recovery codes go. The account's sessions go on.

On the server API, port 21114. Needs the sign-in token of a person; API keys are refused. Only for the role `admin`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | integer | yes | The account ID; at least 1 |

**200**: Done (`application/json`)

| Field | Type |
|---|---|
| `status` | `"totp_disabled"` |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 404 | There is no such item |

## POST /api/users/{id}/totp/confirm

Turn on an account's two-factor sign-in with a code from its secret.

On the server API, port 21114. Needs the sign-in token of a person; API keys are refused. Only for the role `admin`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | integer | yes | The account ID; at least 1 |

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `code` | string | yes | Six digits from the authenticator app |

**200**: Done (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `status` | `"totp_enabled"` |  |
| `recovery_codes` | array of string | Shown this once |

| Error | When |
|---|---|
| 400 | The body is no JSON, the ID is wrong, or setup was not called |
| 401 | The code is wrong, or no valid sign-in |
| 403 | The credential's role lacks the permission |
| 404 | There is no such item |

## POST /api/users/{id}/totp/setup

Start two-factor sign-in for an account: make its secret.

The secret is stored but not on until POST /api/users/{id}/totp/confirm takes a code made with it. Any account of a role up to admin's may call it for any account.

On the server API, port 21114. Needs the sign-in token of a person; API keys are refused. Only for the role `admin`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | integer | yes | The account ID; at least 1 |

**200**: Done (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `secret` | string | Base32 |
| `uri` | string | otpauth:// address for a QR code |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 404 | There is no such item |
| 409 | Two-factor sign-in is on already |
