Search the docs
Menu
Updated Edit on GitHub

Server API: connection

Copy as Markdown

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.

How devices connect: peer to peer first or always through the relay, and who may start a connection.

GET /api/connection/config

Show the connection policy.

On the server API, port 21114. Needs server.config.

200: The policy (application/json)

ConnectionSettings.

Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
503 The connection configuration is not available

PUT /api/connection/config

Change the connection policy.

Saves the policy in the database and applies it at once, without a restart. The change is written in the audit log.

On the server API, port 21114. Needs server.config.

Request body, application/json:

Only these fields; any other field, a null boolean or a second JSON value is refused.

Field Type Required What it is
mode string, one of p2p_first, relay_only yes
p2p_fallback_ms integer yes at least 0, at most 30000
same_nat_relay boolean keeps its value when missing
allow_shared_nat_initiator boolean keeps its value when missing
logged_in_only_initiator boolean keeps its value when missing
operator_only_outbound boolean keeps its value when missing

200: Saved and applied (application/json)

Field Type
config ConnectionSettings
Error When
400 The body has an unknown field or a bad value, or mode or p2p_fallback_ms is missing
401 No credential, or one that is not valid
403 The credential's role lacks the permission
503 The connection configuration is not available

Type to search pages, sections, commands and settings.