# Console: folders

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

> 6 operations. Folders that sort devices.

These routes are on the console, port 3375. They take an API token as `Authorization: Bearer ndt_...`; see [API tokens](https://docs.neode.sk/command-line/api-tokens.md).

Folders that sort devices.

## PATCH /api/devices/{id}/folder

Put one device into a folder, or take it out.

Needs `device.edit`. `neodesk folders move-device` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The device ID (see devices list) |

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `folderId` | integer or string or null | The folder ID; null or left out takes the device out of its folder; at least 0, at most 2147483647 |

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |

## GET /api/folders

List folders with how many devices each holds.

Needs `device.view`. `neodesk folders list` calls it.

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | object | yes |
| `data.folders` | array of [DeviceFolder](https://docs.neode.sk/development/api-reference/schemas.md#devicefolder) | yes |
| `data.total` | integer | yes |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |

## POST /api/folders

Create a folder.

Setting the access lists needs the right to change a group's access.

Needs `device.edit`. `neodesk folders create` calls it.

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `name` | string | yes | Trimmed; at most 50 characters |
| `color` | string |  | default `"#6366f1"` |
| `icon` | string |  | default `"folder"` |
| `allowed_users` | array of string |  | Usernames that may see the folder's devices; at most 100 items |
| `allowed_groups` | array of string |  | GUIDs of the user groups whose members may see the folder's devices; at most 100 items |

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | object | yes |
| `data.id` | integer |  |
| `data.name` | string |  |
| `data.color` | string |  |
| `data.icon` | string |  |
| `data.allowed_users` | array of string |  |
| `data.allowed_groups` | array of string |  |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |

## PATCH /api/folders/{id}

Rename a folder, change its color or icon, or who may see its devices.

Give only what changes. Changing the access lists needs the right to change the folder's access.

Needs `device.edit`. `neodesk folders update` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The folder ID |

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `name` | string | Trimmed; at most 50 characters |
| `color` | string |  |
| `icon` | string |  |
| `allowed_users` | array of string | Usernames that may see the folder's devices; at most 100 items |
| `allowed_groups` | array of string | GUIDs of the user groups whose members may see the folder's devices; at most 100 items |

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |

## DELETE /api/folders/{id}

Delete a folder; its devices stay, without a folder.

Needs `device.edit`. `neodesk folders delete` calls it. It cannot be undone.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The folder ID |

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |

## POST /api/folders/{id}/devices

Put devices into a folder (folder 0 takes them out of theirs).

Every device must exist and be one the account may see, or none is moved.

Needs `device.edit`. `neodesk folders add-devices` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The folder ID, or 0 to take the devices out of their folders |

Request body, `application/json`:

| Field | Type | Required |
|---|---|---|
| `deviceIds` | array of string | yes |

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

| Field | Type | Required | What it is |
|---|---|---|---|
| `success` | `true` | yes |  |
| `data` | object | yes |  |
| `data.count` | integer |  | How many devices moved |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | The folder does not exist, or a device of the list does not; the answer then names it in id |
