# Console: sites

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

> 11 operations. Sites with their networks and relay nodes, and pinning devices and folders to a site.

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

Sites with their networks and relay nodes, and pinning devices and folders to a site.

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

Pin a device to a site.

The device is at that site whatever its address says. Only a site of the device's organization takes it. "" or null takes the pin away.

Needs `device.edit`. `neodesk sites pin-device` calls it.

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

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `site_id` | string or null | The site; "" or null takes the pin away |

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

| Field | Type | Required | What it is |
|---|---|---|---|
| `success` | `true` | yes |  |
| `data` | object | yes |  |
| `data.pin` | object or null | yes | The pinned site, null when the pin was taken away |
| `data.pin.id` | string |  |  |
| `data.pin.name` | string |  |  |
| `data.site` | object |  | The site the device is at now, from its pin, its folder's pin or its address; left out for none |
| `data.site.id` | string |  |  |
| `data.site.name` | string |  |  |

| Error | When |
|---|---|
| 400 | site_id is not text, or the site is of another organization |
| 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, or does not see the device |
| 404 | There is no such device or site, or the account does not see the site |
| 503 | Sites are not available on this server |

## PATCH /api/folders/{id}/site

Pin a folder to a site.

The folder's devices are at that site unless a device has its own pin. "" or null takes the pin away.

Needs `device.edit`. `neodesk sites pin-folder` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The folder's ID, a number |

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `site_id` | string or null | The site; "" or null takes the pin away |

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

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

| Error | When |
|---|---|
| 400 | site_id is not text, or the site is of another organization |
| 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 folder or site, or the account does not see the site |
| 503 | Sites are not available on this server |

## PATCH /api/relay-nodes/{id}

Rename a relay node.

Needs `server.config or org.edit`. `neodesk sites node-rename` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The relay node's ID |

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `name` | string | yes | at most 100 characters |

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | [RelayNode](https://docs.neode.sk/development/api-reference/schemas.md#relaynode) | 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 relay node, or the account does not see it |
| 503 | Sites are not available on this server |

## POST /api/relay-nodes/{id}/revoke

Revoke a relay node.

The node gets no more sessions and its connection is closed. Revoking a revoked node changes nothing.

Needs `server.config or org.edit`. `neodesk sites node-revoke` calls it. It cannot be undone.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The relay node's ID |

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | 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 |
| 404 | There is no such relay node, or the account does not see it |
| 503 | Sites are not available on this server |

## GET /api/sites

List sites with their networks and relay nodes.

Lists the sites of the organizations the account sees, by name.

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

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

| Field | Type | Required | What it is |
|---|---|---|---|
| `success` | `true` | yes |  |
| `data` | object | yes |  |
| `data.sites` | array of [Site](https://docs.neode.sk/development/api-reference/schemas.md#site) | yes |  |
| `data.nodes_enabled` | boolean | yes | Whether the relay node hub runs: enrollment tokens can be made and nodes come online |
| `data.organizations` | array of object | yes | The organizations the account may make sites for |
| `data.organizations[].id` | string | yes |  |
| `data.organizations[].name` | string | yes |  |
| `data.unassigned` | boolean | yes | Whether the account may make sites of no organization |

| 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 |
| 503 | Sites are not available on this server |

## POST /api/sites

Create a site.

An account that sees one organization only makes sites of it when org_id is left out.

Needs `server.config or org.edit`. `neodesk sites create` calls it.

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `name` | string | yes | at most 100 characters |
| `vpn_group` | string |  | A label that joins sites by a VPN; at most 100 characters |
| `org_id` | string |  | The organization; "" for none, where the account may |

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | [Site](https://docs.neode.sk/development/api-reference/schemas.md#site) | yes |

| Error | When |
|---|---|
| 400 | The name or VPN group is not valid, or the account may not make sites of the organization |
| 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 |
| 503 | Sites are not available on this server |

## GET /api/sites/reachability

Show whether relay nodes reach each other.

The last probe result for each pair of relay nodes whose sites the account sees.

Needs `device.view`. `neodesk sites reachability` calls it.

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

| Field | Type | Required | What it is |
|---|---|---|---|
| `success` | `true` | yes |  |
| `data` | object | yes |  |
| `data.results` | array of object | yes |  |
| `data.results[].from` | string |  | The probing node's ID |
| `data.results[].to` | string |  | The probed node's ID |
| `data.results[].via` | string, one of `private`, `public` |  |  |
| `data.results[].ok` | boolean |  |  |
| `data.results[].rtt_ms` | integer |  |  |
| `data.results[].checked_at` | string (date-time) |  |  |

| 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 |
| 503 | Sites are not available on this server |

## PATCH /api/sites/{id}

Rename a site or change its VPN group.

Needs `server.config or org.edit`. `neodesk sites update` calls it.

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

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `name` | string | at most 100 characters |
| `vpn_group` | string | "" takes the site out of its VPN group; at most 100 characters |

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | [Site](https://docs.neode.sk/development/api-reference/schemas.md#site) | 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 site, or the account does not see it |
| 503 | Sites are not available on this server |

## DELETE /api/sites/{id}

Delete a site.

The site goes with its networks, pins and enrollment tokens, and its relay nodes are refused from then on.

Needs `server.config or org.edit`. `neodesk sites delete` calls it. It cannot be undone.

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

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

| Field | Type | Required |
|---|---|---|
| `success` | `true` | 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 |
| 404 | There is no such site, or the account does not see it |
| 503 | Sites are not available on this server |

## POST /api/sites/{id}/enrollment-tokens

Make a token that enrolls a relay node into a site.

The token enrolls one relay node within 24 hours. The token and the enrollment string are in this answer only.

Needs `server.config or org.edit`. `neodesk sites node-token` calls it.

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

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

| Field | Type | Required | What it is |
|---|---|---|---|
| `success` | `true` | yes |  |
| `data` | object | yes |  |
| `data.token` | string | yes |  |
| `data.join` | string | yes | The enrollment string: nd1. and the control address, the certificate pin and the token |
| `data.server` | string | yes | The control address in join, host:port |
| `data.command` | string | yes | The one-line Linux install, as in commands.linux |
| `data.commands` | object | yes |  |
| `data.commands.linux` | string | yes |  |
| `data.commands.docker` | string | yes |  |
| `data.commands.windows` | string | yes |  |
| `data.expires_at` | string (date-time) | 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 |
| 404 | There is no such site, or the account does not see it |
| 503 | Sites are not available, or relay nodes are off on this server |

## PUT /api/sites/{id}/networks

Replace a site's networks.

The list becomes the site's networks. A private network must be a private range and a public one must not. One entry that can't be stored changes nothing.

Needs `server.config or org.edit`. `neodesk sites networks-set` calls it.

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

Request body, `application/json`:

| Field | Type | Required |
|---|---|---|
| `networks` | array of [SiteNetwork](https://docs.neode.sk/development/api-reference/schemas.md#sitenetwork) | yes |

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

| Field | Type | Required | What it is |
|---|---|---|---|
| `success` | `true` | yes |  |
| `data` | object | yes |  |
| `data.networks` | array of [SiteNetwork](https://docs.neode.sk/development/api-reference/schemas.md#sitenetwork) | yes | The networks as stored, in canonical CIDR form |

| Error | When |
|---|---|
| 400 | networks is no list, or an entry is not valid: index names the entry, counted from 0 |
| 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 site, or the account does not see it |
| 503 | Sites are not available on this server |
