Search the docs
Menu
Updated Edit on GitHub

Server API: time sync

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 clock check against NTP, which billing relies on.

POST /api/timesync/check

Check the server clock now.

Asks the NTP servers now and answers the result.

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

200: The check (application/json)

TimeSyncStatus.

Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
503 The clock check is not set up

GET /api/timesync/config

Show the clock check settings.

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

200: The settings (application/json)

TimeSyncConfig.

Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
503 The clock check is not set up

PUT /api/timesync/config

Change the clock check settings.

Saves the settings in the database, applies them without a restart and checks the clock at once. The change is written in the audit log.

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

Request body, application/json:

All settings: require_synced_clock and trust_os_ntp are false when missing.

Field Type Required What it is
ntp_servers string yes NTP servers, separated by commas: host names or IP addresses
max_skew_ms integer yes The largest offset that counts as synced, in milliseconds; at least 1, at most 600000
require_synced_clock boolean Whether billing needs a synced clock
trust_os_ntp boolean Whether the operating system's NTP sync counts
server_timezone string The server's time zone (SERVER_TIMEZONE), an IANA name; missing or empty is UTC

200: Saved, with the new check (application/json)

Field Type
config TimeSyncConfig
status TimeSyncStatus
Error When
400 The body is not valid JSON, or a server name, max_skew_ms or server_timezone is not valid
401 No credential, or one that is not valid
403 The credential's role lacks the permission
503 The clock check is not set up

GET /api/timesync/status

Show whether the server clock is synced.

On the server API, port 21114. Needs billing.view.

200: The last check (application/json)

TimeSyncStatus.

Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
503 The clock check is not set up

Type to search pages, sections, commands and settings.