Console: server
Copy as MarkdownThese routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.
The server: health, versions, resources, services and logs.
Show the database: size and rows per table.
Counts the rows of every table. Not wrapped in success and data.
Needs server.config. neodesk server database calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
type |
string, one of SQLite, PostgreSQL |
yes | |
tables |
array of object | yes | |
tables[].name |
string | yes | |
tables[].count |
integer or string | yes | A number on SQLite, a text on PostgreSQL |
size_bytes |
integer or null | yes | The size of the database in bytes, null when unknown |
last_backup |
string (date-time) | The time of the newest file in the backup folder, left out when there is none |
| 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 |
| 429 | Too many requests: wait for the seconds in Retry-After |
| 500 | The tables could not be listed |
List the Docker containers on the machine.
Lists what docker ps -a shows. Without Docker, or when it prints nothing, the list is empty and available is false. Not wrapped in success and data.
Needs server.config. neodesk server containers calls it.
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
containers |
array of object | yes |
containers[].name |
string | yes |
containers[].image |
string | yes |
containers[].state |
string | yes |
containers[].status |
string | yes |
containers[].ports |
string | yes |
available |
boolean | 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 |
Show the console's or the server's recent log lines.
Reads the systemd journal on Linux, else the first log file that exists. Not wrapped in success and data.
Needs server.config. neodesk server logs calls it.
| Parameter | In | Type | What it is |
|---|---|---|---|
source |
query | string | go for the server's log; anything else reads the console's log; default "console" |
limit |
query | integer | How many lines. Below 1, or not a number, gives 50; default 50, at most 200 |
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
source |
string | yes | The source as it was asked for |
lines |
array of string | 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 |
| 429 | Too many requests: wait for the seconds in Retry-After |
| 500 | The log file could not be read |
List a folder on the server (read only).
Lists folders first, then files by name. Only folders below the file roots (GET /api/server-management/info) can be listed. cwd and entries repeat path and items.
Needs server.config. neodesk server files calls it.
| Parameter | In | Type | What it is |
|---|---|---|---|
path |
query | string | The folder to list; default "/" |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
path |
string | yes |
parent |
string | yes |
items |
array of object | yes |
items[].name |
string | |
items[].path |
string | |
items[].isDirectory |
boolean | |
items[].isFile |
boolean | |
items[].isSymlink |
boolean | |
items[].sizeBytes |
integer | |
items[].mtime |
string or null (date-time) | |
items[].mode |
integer or null | |
items[].uid |
integer or null | |
items[].gid |
integer or null | |
cwd |
string | yes |
entries |
array of object | yes |
entries[].name |
string | |
entries[].path |
string | |
entries[].isDirectory |
boolean | |
entries[].isFile |
boolean | |
entries[].isSymlink |
boolean | |
entries[].sizeBytes |
integer | |
entries[].mtime |
string or null (date-time) | |
entries[].mode |
integer or null | |
entries[].uid |
integer or null | |
entries[].gid |
integer or null |
| Error | When |
|---|---|
| 400 | The folder is outside the file roots, not a folder, or can't be read |
| 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 |
Read a file on the server (read only).
Only a super admin may open files, since the folders hold the server's keys and secrets; a refusal goes into the audit log. Reads the first 256 kB of a regular file of at most 8 MB below the file roots. A file with a NUL byte there is binary and its content is empty.
Needs server.config. neodesk server file calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
path |
query | string | yes | The file to read |
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
path |
string | yes | |
sizeBytes |
integer | yes | |
mtime |
string (date-time) | yes | |
mode |
integer | yes | |
isBinary |
boolean | yes | |
truncated |
boolean | yes | True when the file is longer than what was read |
content |
string | yes |
| Error | When |
|---|---|
| 400 | The file is outside the file roots, not a regular file, too large, or can't be read |
| 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 is not a super admin |
Show the machine the server runs on.
Needs server.config. neodesk server machine calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
platform |
string | yes | |
arch |
string | yes | |
nodeVersion |
string | yes | The Go version the console runs on |
pid |
integer | yes | |
fileRoots |
array of string | yes | The folders the file browser may read |
server |
object | yes | What the server API's health says |
server.running |
boolean | yes | |
server.uptimeSeconds |
integer or null | yes | |
server.version |
string or null | yes | |
beta |
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 |
Show CPU, memory and disk use.
history holds the CPU and memory samples taken before, for a chart.
Needs server.config. neodesk server resources calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
snapshot |
object | yes | |
snapshot.at |
string (date-time) | ||
snapshot.cpuPercent |
number | CPU use in percent | |
snapshot.mem |
object | Memory in bytes | |
snapshot.mem.totalBytes |
integer | ||
snapshot.mem.freeBytes |
integer | ||
snapshot.mem.usedBytes |
integer | ||
snapshot.mem.usedPercent |
number | ||
snapshot.swap |
object | Swap in bytes, zero outside Linux | |
snapshot.swap.totalBytes |
integer | ||
snapshot.swap.usedBytes |
integer | ||
snapshot.swap.freeBytes |
integer | ||
snapshot.load |
array of number | The load averages over 1, 5 and 15 minutes | |
snapshot.uptimeSeconds |
number | Seconds since the machine started | |
snapshot.nodeUptimeSeconds |
number | Seconds since the console started | |
snapshot.cpuCount |
integer | ||
snapshot.cpuModel |
string | ||
snapshot.platform |
string | ||
snapshot.arch |
string | ||
snapshot.hostname |
string | ||
snapshot.release |
string | ||
snapshot.nodeVersion |
string | The Go version the console runs on | |
snapshot.disks |
array of object | ||
snapshot.disks[].mount |
string | ||
snapshot.disks[].fstype |
string | ||
snapshot.disks[].sizeBytes |
integer | ||
snapshot.disks[].usedBytes |
integer | ||
snapshot.disks[].availBytes |
integer | ||
snapshot.network |
array of object | Addresses of the network interfaces, without loopback ones | |
snapshot.network[].name |
string | ||
snapshot.network[].family |
string | ||
snapshot.network[].address |
string | ||
snapshot.network[].mac |
string | ||
snapshot.network[].cidr |
string | ||
snapshot.history |
array of object | ||
snapshot.history[].at |
string (date-time) | ||
snapshot.history[].cpuPercent |
number | ||
snapshot.history[].memPercent |
number |
| 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 |
List the system services NeoDesk uses.
Lists the NeoDesk services the service manager knows (systemd on Linux, Windows services on Windows), under every name an install used. Elsewhere, or when the command fails, the list is empty.
Needs server.config. neodesk server services calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
platform |
string | yes | |
services |
array of object | yes | |
services[].name |
string | yes | |
services[].load |
string | systemd's load state, left out on Windows | |
services[].active |
string | yes | |
services[].sub |
string | yes | |
services[].description |
string | yes | |
services[].state |
string | yes | The active state, unknown when empty |
services[].status |
string | yes | The sub state, else the state |
| 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 |
Start, stop, restart or check a NeoDesk system service.
Runs systemctl on Linux (stopped after 15 seconds) or a PowerShell service command on Windows (20 seconds), and logs it in the audit log. Only NeoDesk's own services can be controlled. Restarting the console's own service may end the console process instead. A command that exits with an error still answers 200 with its exit code and the last 4096 characters of its output. Takes no body.
Needs server.config. neodesk server service calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
name |
path | string | yes | The service, like neodesk-server |
action |
path | string, one of start, stop, restart, reload, enable, disable, status |
yes | What to do. Windows takes start, stop, restart and status only |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
name |
string | yes |
action |
string | yes |
exitCode |
integer | yes |
stdout |
string | yes |
stderr |
string | yes |
| Error | When |
|---|---|
| 400 | An invalid or not allowed service name or action, or a platform without service control |
| 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 |
| 500 | The command could not be started |
Show the versions, the server's status and its paths.
Every signed-in account gets the console's name and version and the server's status and version. The host name, the paths, the server's health detail and the device counts need server.config.
neodesk server info calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
data |
object | yes | |
data.app |
object | yes | |
data.app.name |
string | yes | |
data.app.version |
string | yes | |
data.app.nodeVersion |
string | The Go version the console runs on (server.config only) | |
data.app.env |
string | The console's NODE_ENV (server.config only) | |
data.server |
object | The console's process (server.config only) | |
data.server.hostname |
string | ||
data.server.platform |
string | ||
data.server.arch |
string | ||
data.server.uptimeSeconds |
integer | Seconds since the console started | |
data.server.heapUsedBytes |
integer | Heap in use, in bytes | |
data.goServer |
object | yes | The server API's health as GET /api/health/detail answers it, with the backend in use. An account without server.config gets only status and version |
data.goServer.backend |
string | ||
data.goServer.billing_pending_relays |
integer | ||
data.goServer.clock_synced |
boolean | ||
data.goServer.connection |
object | ||
data.goServer.connection.allow_shared_nat_initiator |
boolean | ||
data.goServer.connection.always_use_relay |
boolean | ||
data.goServer.connection.logged_in_only_initiator |
boolean | ||
data.goServer.connection.operator_only_outbound |
boolean | ||
data.goServer.connection.p2p_fallback_ms |
integer | ||
data.goServer.connection.p2p_first |
boolean | ||
data.goServer.connection.relay_servers |
string | ||
data.goServer.connection.same_nat_relay |
boolean | ||
data.goServer.peers_critical |
integer | ||
data.goServer.peers_degraded |
integer | ||
data.goServer.peers_in_memory |
integer | ||
data.goServer.peers_online |
integer | ||
data.goServer.peers_tcp |
integer | ||
data.goServer.peers_total |
integer | ||
data.goServer.peers_udp |
integer | ||
data.goServer.peers_ws |
integer | ||
data.goServer.relay_active_sessions |
integer | ||
data.goServer.status |
string | ||
data.goServer.tls |
boolean | ||
data.goServer.uptime_seconds |
integer | Seconds since the server started | |
data.goServer.version |
string | ||
data.backend |
string | The server backend in use (server.config only) | |
data.paths |
object | The files of the database and the keys (server.config only) | |
data.paths.database |
string | ||
data.paths.publicKey |
string | ||
data.paths.apiKey |
string | ||
data.stats |
object | Device counts of the whole server (server.config only) | |
data.stats.total |
integer | ||
data.stats.online |
integer | ||
data.stats.offline |
integer | ||
data.stats.banned |
integer |
| 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 |
Show the addresses the server gives clients.
Builds the addresses for the host the request came to; a host query parameter is not read (GET /api/keys/server-info reads one). Also says where each address came from and answers the masked API key.
neodesk server addresses calls it.
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
ClientEndpoints | 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 |
Download test data to measure the speed to the console.
Answers that many bytes of the letter B, for the caller to time the download.
Needs metrics.view. neodesk server speed-test calls it.
| Parameter | In | Type | What it is |
|---|---|---|---|
size |
query | integer | How many bytes. Below 1, or not a number, gives 1 MB; default 1048576, at most 10485760 |
200: The test data (application/octet-stream)
String (binary).
| 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 |
Run one of the allowed diagnostic commands on the server, like uptime.
Runs the command, word for word from the allowed list, for at most 10 seconds. A command that fails or prints nothing answers (no output). Not wrapped in success and data.
Needs server.config. neodesk server exec calls it.
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
command |
string, one of uptime, date, hostname, whoami, df -h, free -m, uname -a, cat /etc/os-release, systemctl status neodesk-server, systemctl status neodesk-console, docker ps, docker stats --no-stream, ip addr, ss -tlnp, netstat -tlnp, top -bn1 | head -20 |
yes | The command, from the allowed list |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
output |
string | yes |
command |
string | yes |
| Error | When |
|---|---|
| 400 | No command |
| 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 the command is not in the allowed list |
Show the machine: system, memory, disks, processes.
On Linux and Windows: the 15 processes using the most CPU and the disks. The process list is empty for an account without server.config. node is the console's own process. Not wrapped in success and data.
Needs metrics.view. neodesk server system calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
processes |
array of object | yes | |
processes[].name |
string | yes | The command line, cut at 64 characters |
processes[].cpu_percent |
number or null | yes | CPU share in percent, null where the system doesn't tell (Windows) |
processes[].memory_bytes |
number | yes | Memory in bytes |
disks |
array of object | yes | |
disks[].mount |
string | yes | |
disks[].name |
string | The drive letter, on Windows only | |
disks[].total_bytes |
integer | yes | Bytes |
disks[].used_bytes |
integer | yes | Bytes |
disks[].free_bytes |
integer | yes | Bytes |
node |
object | yes | |
node.pid |
integer | yes | |
node.uptimeSeconds |
integer | yes | Seconds |
node.heapUsedBytes |
integer | yes | Bytes |
node.heapTotalBytes |
integer | yes | Bytes |
node.rssBytes |
integer | yes | Bytes |
| 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 |
Check that the console answers.
Answers everyone.
neodesk server health calls it.
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
status |
"ok" |
yes |
timestamp |
string (date-time) | yes |