REST API
Module api.rest (on by default). Served on the agent listener, agent.listen (default 127.0.0.1:8420), over HTTPS when the panel uses TLS (agent., the default for package installs, or your own certificate; TLS is required for any non-loopback address). JSON in and out; times are RFC 3339 UTC.
AI agents use the same tokens through the MCP server: see AI agents (MCP).
Authentication
Every request needs a bearer token:
sudo restorly token create grafana --scope read # prints the token once
restorly panel cert # the certificate's fingerprint, to pin
curl -k -H "Authorization: Bearer rst_..." https://127.0.0.1:8420/api/v1/targets
| Scope | Allows |
|---|---|
read | status, targets, runs, reports, modules, notification deliveries |
operate | everything in read, plus starting runs and reading and validating the config |
admin | everything in operate, plus setting and deleting secrets and reading the audit log |
Only a SHA-256 of each token is stored. restorly token list shows names, scopes and last use; restorly token revoke NAME revokes. Token creation, revocation and every write through the API are recorded in the audit log with the token name (api:<name>).
Errors are {"error": "message"} with the usual status codes: 401 (no, unknown or revoked token), 403 (scope too low), 404, 409 (conflict, e.g. a run already in progress or a skipped target).
Endpoints
| Method and path | Scope | Description |
|---|---|---|
GET /api/v1/status | read | Agent version, host, start time; licence status, plan, limits (max_databases; max_users and max_custom_checks when the licence sets them) and warning; ended: true when the licence server ended the licence (a revocation: status restricted, nothing to renew). |
GET /api/v1/targets | read | Every configured target: engine, location, schedule, skipped reason, next_run, running, last_run; recovery_point (the time the data of the newest backup that passed validation is from), restore_typical_ms (the median of the latest ten restores) and objectives (rpo, rto) when set. |
GET /api/v1/targets/{id} | read | One target. |
POST /api/v1/targets/{id}/run | operate | Start a run now. 202 when started; 409 if one is in progress, the target is skipped, or the licence has lapsed. The run takes the target lock and a parallel slot like a scheduled run. |
POST /api/v1/targets/{id}/rehearse | operate | Start an upgrade rehearsal now: the backup of the database's latest restore that passed, restored on the next major version Restorly supports. 202 with from, to, image and base_run when started; 409 when there is nothing to rehearse (with the reason: the database does not take part, no restore passed yet, physical backups, the newest version already, module addon.upgrade off), while a run of it is in progress, when it is skipped, or when the licence has lapsed. A target that takes part has upgrade_rehearsal in GET /api/v1/targets/{id}: schedule, next_run, what the next one restores on (from, to, image) or not_possible, and the latest rehearsal; runs that are rehearsals carry rehearsal (the version), and are never the target's last_run. |
POST /api/v1/targets/{id}/run-anyway | admin | Start a run now without the disk check (Run anyway): when the restore's need does not fit, it takes all the free disk there is instead of failing with "not enough disk"; the restore is still stopped if the disk fills. The check restore.space warns that it was skipped, and the audit log records run.anyway. 202 when started; 409 as for run. |
POST /api/v1/targets/{id}/drill | operate | Start a point-in-time drill with {"to": "2026-10-02T14:30:00Z"}: the newest backup taken before that time is restored and the WAL or binary logs replayed up to it. 202 when started; 400 for a time that is malformed or in the future; 409 without the database's pitr settings and module addon.pitr, while a run of it is in progress, when it is skipped, or when the licence has lapsed. |
POST /api/v1/targets/{id}/backup | operate | Backup mode: take a backup now (then validate it if validate_after). 202; 409 when backup mode is not active for the target or a backup is running. |
GET /api/v1/targets/{id}/retention | read | Backup mode: what the retention policy does with each backup Restorly took, before anything is deleted: enabled, policy, confirmed (with confirmed_by, confirmed_at), paused (why nothing is deleted now), deletes, frees_bytes, and backups[] with key, location, started_at, size_bytes, keep, reason. Never deletes. 404 for a target not in backup mode. |
GET /api/v1/capacity | read | Whether the schedules fit in a day on the runners online (module capacity): verdict (fits, tight over 80%, over, none), utilization, slots, slot_hours_per_day, restore_hours_per_day, slots_needed, advice, the databases by load (runs a day, typical run, too long for their interval), runner-label groups that do not fit, and the last 24 hours (runs, busiest runner, longest wait), and sizing: the databases too large for a shared runner with their size (large, very large), what their last restore put on disk and took, the disk their restores reserve, the host and sandbox to give them, and the advice in words. 404 when the module is off. restorly capacity prints the same. |
POST /api/v1/targets/{id}/acknowledge | operate | Acknowledge the database's known failure: {"note": "...", "until": "pass" | "24h" | "72h"} (pass, until it passes, is the default). Its failure and warn alerts are held until then; the recovery alert is still sent and a pass ends it. 201 with note, by, at, until (absent: until it passes) and run_id; 400 for a missing note or another time; 409 when its last run did not fail or warn, or module alerts. is off. GET /api/v1/targets/{id} carries it as acknowledged while it lasts. |
DELETE /api/v1/targets/{id}/acknowledge | operate | End the acknowledgement: alerts resume. 204; 404 when it is not acknowledged. |
GET /api/v1/kept | read | Restores kept for inspection now, on every host: run_id, target, runner, engine, container, size, kept_at, until and the commands that open one on its host. GET /api/v1/runs/{id} carries the run's kept, also once it was removed (ended_at, reason: expired, deleted, cleanup, replaced, disk with for_run, gone; by). |
DELETE /api/v1/kept/{run} | operate | Delete now: remove a run's kept restore at once, on this host or by a job on its runner. 204; 404 when it is not kept; 409 with the reason when it cannot be removed now (its runner is offline: a runner removes its kept restores itself when their time is up). Needs no licence. |
POST /api/v1/runners/{id}/cleanup | operate | Clean up a runner's host (hub-local for this one): every kept restore and Restorly's own leftovers; never a running job's resources, nor anything without Restorly's labels. 200 with kept and leftovers removed; 404 for an unknown runner; 409 when the runner is offline or too old. Needs no licence. |
GET /api/v1/readiness | read | The host readiness check (module readiness): for each runner and database image, ok, what failed (kind: image, arch, cpu, kernel, start), the message, checked_at, the targets that need the image and the rehearsals (databases whose upgrade rehearsal, restores on it). 404 when the module is off. |
GET /api/v1/runs?target=&limit= | read | Runs, newest first (limit default 50, max 500). |
GET /api/v1/runs/{id} | read | One run with its checks. |
GET /api/v1/runs/{id}/report | read | The report file, byte for byte, so its signature verifies (X-Restorly-Report-SHA256 header). |
GET /api/v1/runs/{id}/report.pdf | read | PDF rendering of the report (module report.pdf; 409 when it is off). |
POST /api/v1/runs/{id}/inspect | admin | Run one read-only query in a run's kept restore, as the panel's Inspect: {"query": "SELECT …", "database": "optional"} (SQL, or a mongosh expression for MongoDB; 8 KiB at most). It runs as the read-only check user with a statement timeout. 200 with database, columns, rows (text; null for NULL; the first 100) and truncated; 400 for an empty query or a database the restore does not hold; 409 when the run has no kept restore on this host or keeping restores is off; 422 with the engine's error. Recorded in the audit log (kept.inspect) with the query. |
GET /api/v1/monthly.pdf?month=YYYY-MM&target=&client= | read | Monthly summary PDF; target repeatable, default all targets; month defaults to the previous one. With client (module multisite) the report names the client and covers its databases only. |
GET /api/v1/evidence.pdf?from=YYYY-MM&to=YYYY-MM&target=&client=&max_gap_days= | read | Backup controls evidence PDF for NIS2, ISO 27001, DORA and BSI IT-Grundschutz (module report.) for whole months, at most 12; both default to the previous month (to defaults to from). Scoped like monthly.pdf. max_gap_days (1–366, default 8) is the longest time without a validation that still counts as regular testing. 400 for an invalid period, 409 when the module is off. |
GET /api/v1/modules | read | Module states: entitled, enabled, effective, reason. |
GET /api/v1/notifications?limit= | read | Notification deliveries (channel keys hold secret references, never secrets). |
GET /api/v1/config | operate | The running configuration as YAML (secret references only). |
POST /api/v1/config/validate | operate | Validate a YAML body (max 1 MiB) against this agent's modules: valid, issues, skipped. Nothing is applied. |
GET /api/v1/secrets | admin | Secret names and update times. Values are never returned. |
PUT /api/v1/secrets/{name} | admin | Set a secret: body {"value": "..."}. 204. Needs a master key. |
DELETE /api/v1/secrets/{name} | admin | Delete a secret. 204. |
GET /api/v1/audit?limit= | admin | Audit log, newest first. |
/metrics (module metrics.) is on the same listener and needs no token. Per database it reports the last outcome, last run and last success times, restore duration, backup age and size, run counts and whether a run is in progress (restorly_target_*), plus the licence and update state. What each database can be restored to:
restorly_target_recovery_point_timestamp_seconds: when the data of the newest backup that passed validation is from (with the point-in-time test, the last transaction replayed on it). Alert ontime() - restorly_target_recovery_point_timestamp_seconds > <your RPO in seconds>; the panel does the same withtargets[].. objectives. rpo restorly_target_restore_typical_seconds: the median of the latest ten restores.
Two come from the newest report when those checks run:
restorly_target_pitr_last_replay_timestamp_seconds: the last transaction the point-in-time restore test reached. Alert ontime() - restorly_target_pitr_last_replay_timestamp_seconds > <your RPO in seconds>.restorly_target_copies_rule_met: 1 when the 3-2-1 rule was met, else 0.
Host readiness (module readiness): restorly_runner_image_ready{runner, image} is 1 when the runner can restore the database image, else 0. Alert on restorly_runner_image_ready == 0.
Upgrade rehearsals (module addon.upgrade): restorly_upgrade_rehearsal_outcome{target, to} is the newest rehearsal's outcome on the next major version (0 pass, 1 warn, 2 fail, 3 skipped), and restorly_upgrade_rehearsal_timestamp_seconds{target} when it finished. They are not the databases' own results: restorly_target_last_run_outcome and the run counts leave rehearsals out.
Capacity (module capacity): restorly_capacity_slots (validations at once on all online runners), restorly_capacity_running, restorly_capacity_waiting (runs waiting for a free slot now), restorly_capacity_demand_hours (restore hours a day the schedules ask for) and restorly_capacity_utilization_ratio (demand over what the runners offer: above 0.8 is tight, above 1 does not fit). Alert on restorly_capacity_utilization_ratio > 0.8.
For the licence: restorly_license_expires_timestamp_seconds and restorly_license_days_left (whole days, negative once it ended). Licence files last 30 days at most, and with online licensing the host renews its file every ten days, so the number stays between 20 and 30 while renewals work. Alert on restorly_license_days_left < 14: renewals have failed for days, or the licence really ends; a renewal can be installed early without losing days.
Not yet
Changing module state and applying a new configuration through the API will use the same write path as the panel's Settings → Configuration (see Using the panel). Until then, use the panel or edit /etc/ and run systemctl reload restorly.