# Server-API: time sync

Quelle: https://docs.neode.sk/de/development/api-reference/server-time-sync/
Zuletzt geändert: 2026-12-03

> 4 Operationen. The server's clock check against NTP, which billing relies on.

Diese Routen liegen auf der Server-API, Port 21114 (21121 in Docker). Sie nehmen einen API-Schlüssel in `X-API-Key` oder ein Anmelde-Token; siehe [Die HTTP-API](https://docs.neode.sk/de/development/api.md#signing-in). Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

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](https://docs.neode.sk/de/development/api-reference/schemas.md#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](https://docs.neode.sk/de/development/api-reference/schemas.md#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](https://docs.neode.sk/de/development/api-reference/schemas.md#timesyncconfig) |
| `status` | [TimeSyncStatus](https://docs.neode.sk/de/development/api-reference/schemas.md#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](https://docs.neode.sk/de/development/api-reference/schemas.md#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 |
