# Konsole: mesh

Quelle: https://docs.neode.sk/de/development/api-reference/console-mesh/
Zuletzt geändert: 2026-12-03

> 16 Operationen. MeshCentral devices, groups and recordings.

Diese Routen liegen auf der Konsole, Port 3375. Sie nehmen ein API-Token als `Authorization: Bearer ndt_...`; siehe [API-Tokens](https://docs.neode.sk/de/command-line/api-tokens.md). Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

MeshCentral devices, groups and recordings.

## POST /api/mesh/devices/{id}/exec

Run a command on a MeshCentral device.

Hands the command to the mesh agent and answers at once; the output does not come back here. Refused when the account has the terminal turned off. The answer is the API server's, as it is.

Needs `mesh.terminal`. `neodesk mesh exec` calls it.

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

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `command` | string |  |
| `shell` | boolean | run it in the shell (type 1 of the agent) |

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

| Field | Type |
|---|---|
| `status` | `"sent"` |

| Error | When |
|---|---|
| 400 | The mesh agent is not connected, or the agent refused (the API server's answer) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, does not see the device, or has the terminal turned off |
| 404 | MeshCentral support is off (the API server's answer) |

## POST /api/mesh/devices/{id}/files

Open the files of a MeshCentral device.

Asks the mesh agent to open a file relay and answers its address. Refused when the account has file transfer turned off. The answer is the API server's, as it is.

Needs `mesh.files`. `neodesk mesh files` calls it.

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

**200**: The relay (`application/json`)

[MeshTunnel](https://docs.neode.sk/de/development/api-reference/schemas.md#meshtunnel).

| Error | When |
|---|---|
| 400 | The mesh agent is not connected, or the agent refused (the API server's answer) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, does not see the device, or has file transfer turned off |
| 404 | MeshCentral support is off (the API server's answer) |

## POST /api/mesh/devices/{id}/group

Move a MeshCentral device to another group.

The answer is the API server's, as it is.

Needs `server.config`. `neodesk mesh move` calls it.

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

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `group_id` | string | yes | the group ID; empty removes the device from its group |

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

| Field | Type |
|---|---|
| `status` | `"ok"` |
| `group_id` | string |

| Error | When |
|---|---|
| 400 | The mesh agent is not connected, or the agent refused (the API server's answer) |
| 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 | MeshCentral support is off (the API server's answer) |

## POST /api/mesh/devices/{id}/power

Wake, sleep, restart or turn off a MeshCentral device.

Sends the power action to the mesh agent. A wake for a device whose agent is offline goes out as a Wake-on-LAN packet when a MAC address is known. Actions other than wake are refused when the account has remote reboot turned off. The answer is the API server's, as it is.

Needs `mesh.power`. `neodesk mesh power` calls it.

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

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `action` | string | yes | wake (or wakeup, on), sleep, off (or poweroff, shutdown) or reset (or reboot); any letter case |
| `forced` | boolean |  | force the action on the agent |
| `mac` | string |  | for wake of a device whose agent is offline: the MAC address for Wake-on-LAN; else the one the server knows of the device or its linked device |

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

| Field | Type | What it is |
|---|---|---|
| `status` | `"sent"` |  |
| `action` | string |  |
| `transport` | `"wol"` | wol when the device was offline and a Wake-on-LAN packet went out |
| `mac` | string | The MAC address the Wake-on-LAN packet went to |

| Error | When |
|---|---|
| 400 | The mesh agent is not connected, or the agent refused (the API server's answer) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, does not see the device, or has remote reboot turned off |
| 404 | MeshCentral support is off (the API server's answer) |
| 500 | The Wake-on-LAN packet could not be sent (the API server's answer) |

## POST /api/mesh/devices/{id}/share

Make a share link for a MeshCentral device.

Makes a link to the device's desktop over MeshCentral. The link of an account without remote control is view only, whatever view_only says. A link made with an API token ends with the token. The answer is the API server's, as it is.

Needs `device.connect`. `neodesk mesh share` calls it.

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

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `ttl_minutes` | integer | how long the link works; 60 when missing or 0, at most 1440; at most 1440 |
| `view_only` | boolean |  |

**200**: The link (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `token` | string |  |
| `path` | string | The console page for the link: /remote/&lt;id>?transport=mesh&mesh_share=&lt;token> |
| `view_only` | boolean |  |
| `ttl_minutes` | integer | ttl_minutes as the request gave it |

| Error | When |
|---|---|
| 400 | The mesh agent is not connected, or the agent refused (the API server's answer) |
| 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 | MeshCentral support is off (the API server's answer) |

## POST /api/mesh/devices/{id}/tcp

Open a TCP tunnel to a MeshCentral device.

Asks the mesh agent to relay a TCP port it can reach. Refused when the account has tunnels turned off. The answer is the API server's, as it is.

Needs `device.connect`. `neodesk mesh tcp` calls it.

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

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `host` | string |  | the address the agent connects to; 127.0.0.1 when missing |
| `port` | integer | yes | at least 1, at most 65535 |

**200**: The relay (`application/json`)

[MeshTunnel](https://docs.neode.sk/de/development/api-reference/schemas.md#meshtunnel).

| Error | When |
|---|---|
| 400 | The mesh agent is not connected, or the agent refused (the API server's answer) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, does not see the device, or has tunnels turned off |
| 404 | MeshCentral support is off (the API server's answer) |

## POST /api/mesh/devices/{id}/terminal

Open a terminal on a MeshCentral device.

Asks the mesh agent to open a terminal relay and answers its address. Refused when the account has the terminal turned off in its client features. The answer is the API server's, as it is.

Needs `mesh.terminal`. `neodesk mesh terminal` calls it.

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

**200**: The relay (`application/json`)

[MeshTunnel](https://docs.neode.sk/de/development/api-reference/schemas.md#meshtunnel).

| Error | When |
|---|---|
| 400 | The mesh agent is not connected, or the agent refused (the API server's answer) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, does not see the device, or has the terminal turned off |
| 404 | MeshCentral support is off (the API server's answer) |

## POST /api/mesh/devices/{id}/udp

Open a UDP tunnel to a MeshCentral device.

Asks the mesh agent to relay a UDP port it can reach. Refused when the account has tunnels turned off. The answer is the API server's, as it is.

Needs `device.connect`. `neodesk mesh udp` calls it.

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

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `host` | string |  | the address the agent connects to; 127.0.0.1 when missing |
| `port` | integer | yes | at least 1, at most 65535 |

**200**: The relay (`application/json`)

[MeshTunnel](https://docs.neode.sk/de/development/api-reference/schemas.md#meshtunnel).

| Error | When |
|---|---|
| 400 | The mesh agent is not connected, or the agent refused (the API server's answer) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, does not see the device, or has tunnels turned off |
| 404 | MeshCentral support is off (the API server's answer) |

## GET /api/mesh/download.msh

Download the MeshAgent settings file (.msh) for this server (use --output).

Answers the settings file a MeshAgent is installed with, as an attachment named meshagents.msh. The server it names is always the console's public address (wss://&lt;host>/agent.ashx); mesh_server is not taken.

Needs `server.config`. `neodesk mesh agent-config` calls it.

| Parameter | In | Type | What it is |
|---|---|---|---|
| `name` | query | string | the device group name; NeoDesk Mesh when missing |
| `mesh_id` | query | string | the MeshCentral group ID, 64 or 96 hexadecimal characters; the default group when missing |

**200**: The .msh file (`application/octet-stream`)

String (binary).

| Error | When |
|---|---|
| 400 | A query parameter is a list or an object, or mesh_id is not valid (the API server's answer) |
| 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 | MeshCentral support is off (the API server's answer) |

## GET /api/mesh/groups

List MeshCentral device groups.

The answer is the API server's, as it is.

Needs `server.config`. `neodesk mesh groups` calls it.

**200**: The groups (`application/json`)

| Field | Type |
|---|---|
| `groups` | array of [MeshGroup](https://docs.neode.sk/de/development/api-reference/schemas.md#meshgroup) |

| 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 |
| 404 | MeshCentral support is off (the API server's answer) |

## POST /api/mesh/groups

Make a MeshCentral device group.

Replaces all groups with the list. The default group can't be removed. The answer is the API server's, as it is.

Needs `server.config`. `neodesk mesh group-create` calls it.

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `groups` | array of [MeshGroup](https://docs.neode.sk/de/development/api-reference/schemas.md#meshgroup) | yes | All groups; the default group must be among them |

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

| Field | Type |
|---|---|
| `status` | `"ok"` |

| Error | When |
|---|---|
| 400 | The body is not valid, a group ID is not valid, or the default group is missing (the API server's answer) |
| 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 | MeshCentral support is off (the API server's answer) |

## GET /api/mesh/recordings

List MeshCentral session recordings.

Accounts outside the admin roles get the recordings of devices they see. The answer is the API server's, as it is.

Needs `device.view`. `neodesk mesh recordings` calls it.

**200**: The recordings (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `recordings` | array of [MeshRecording](https://docs.neode.sk/de/development/api-reference/schemas.md#meshrecording) or null | null when the server has no recordings folder |

| 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 |
| 404 | MeshCentral support is off (the API server's answer) |

## GET /api/mesh/recordings/{id}

Download a session recording (use --output).

Accounts outside the admin roles may download only the recordings of devices they see. The download is written in the audit log.

Needs `device.connect`. `neodesk mesh recording` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The recording ID (its file name) |

**200**: The recording (`application/octet-stream`)

String (binary).

| Error | When |
|---|---|
| 400 | The ID is . or .. (the API server's answer) |
| 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 | No such recording, or MeshCentral support is off (the API server's answer) |

## GET /api/mesh/server-id

Show the MeshCentral server's ID.

The answer is the API server's, as it is.

Needs `server.config`. `neodesk mesh server-id` calls it.

**200**: The server ID (`application/json`)

| Field | Type |
|---|---|
| `server_id` | string |

| 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 |
| 404 | MeshCentral support is off (the API server's answer) |

## GET /api/mesh/status

Show whether MeshCentral support runs.

Needs only a sign-in. Answers the API server's state without the success wrapper.

`neodesk mesh status` calls it.

**200**: The state (`application/json`)

Only enabled when MeshCentral support is off

| Field | Type | What it is |
|---|---|---|
| `enabled` | boolean |  |
| `core_version` | string |  |
| `agents_online` | integer |  |
| `server_id` | string |  |
| `cert_file` | string | The path of the agent certificate |
| `cert_present` | boolean |  |
| `cert_modified` | string or null (date-time) | When the certificate file changed, RFC 3339; empty without the file |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 502 | The API server gave no state |

## GET /api/session/recordings

List the recorded remote sessions.

Lists the recordings the server keeps; today these are the MeshCentral ones. Accounts outside the admin roles get the recordings of devices they see. The answer is the API server's, as it is.

Needs `device.view`. `neodesk mesh session-recordings` calls it.

**200**: The recordings (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `recordings` | array of [MeshRecording](https://docs.neode.sk/de/development/api-reference/schemas.md#meshrecording) |  |
| `note` | string | Says that recordings of CDAP and RustDesk sessions stay in the browser |

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