Search the docs
Menu
Updated Edit on GitHub

Server API: keys

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.

The server's public key, which clients need to trust it.

GET /api/server-key

Show the server's public key in base64.

Answers everyone. The key is empty while the server has no key pair.

On the server API, port 21114.

200: Done (application/json)

Field Type Required What it is
key string yes The Ed25519 public key in base64

GET /api/server-key-check

Show whether devices need the server's key to connect.

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

200: Done (application/json)

Field Type Required What it is
enforced boolean yes Punch-hole and relay requests without the server's key are refused
devices_without_key integer yes How many devices connected without the key since counting_since
counting_since string or null (date-time) yes null while nothing is counted
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission

PUT /api/server-key-check

Require the server's key from connecting devices, or stop requiring it.

Stores the setting and applies it at once. The change is written in the audit log.

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

Request body, application/json:

Field Type Required
enforced boolean yes

200: Saved and applied (application/json)

The check after the change, as GET answers it

Field Type Required
enforced boolean yes
devices_without_key integer yes
counting_since string (date-time) yes
Error When
400 enforced is missing or not true or false (enforced must be true or false)
401 No credential, or one that is not valid
403 The credential's role lacks the permission

GET /api/server-key/fingerprint

Show the SHA-256 fingerprint of the server's public key.

Answers everyone. The fingerprint is empty while the server has no key pair.

On the server API, port 21114.

200: Done (application/json)

Field Type Required What it is
fingerprint string yes Upper-case hex pairs separated by colons
algorithm "SHA-256" yes

GET /api/server/pubkey

Show the server's public key in base64 and hex.

Answers everyone. The base64 key is the key clients need.

On the server API, port 21114.

200: Done (application/json)

Field Type Required What it is
key string yes The Ed25519 public key in base64
key_hex string yes The same key in hex
Error When
500 The server has no key pair yet

Type to search pages, sections, commands and settings.