dbtrail

Backups & PITR

Manage backup schedules, trigger on-demand backups, and generate point-in-time recovery dumps

Manage backup schedules, trigger on-demand backups, view backup history, and generate point-in-time recovery (PITR) dumps. See the backup strategy guide for background and the PITR guide for a walkthrough.

Backups

Trigger backup

MethodEndpointPermissionDescription
POST/backupbackup:createTrigger an on-demand full backup

Request body:

{
  "server_id": "uuid"
}

Response (202 Accepted):

{
  "backup_id": "uuid",
  "status": "running"
}

The backup runs asynchronously. Poll the history endpoint to track progress.

List schedules

MethodEndpointPermissionDescription
GET/backup/schedulesbackup:createList all backup schedules

Response:

[
  {
    "id": "uuid",
    "server_id": "uuid",
    "server_name": "production-db",
    "schedule_cron": "0 2 * * *",
    "backup_tool": "mydumper",
    "retention_days": 30,
    "s3_prefix": null,
    "enabled": true,
    "last_run": "2026-04-13T02:00:00Z",
    "last_status": "completed",
    "created_at": "2026-04-01T10:00:00Z"
  }
]

Create schedule

MethodEndpointPermissionDescription
POST/backup/schedulesbackup:createCreate a new backup schedule

Request body:

{
  "server_id": "uuid",
  "schedule_cron": "0 2 * * *",
  "backup_tool": "mydumper",
  "retention_days": 30,
  "s3_prefix": null
}
FieldRequiredDefaultDescription
server_idyesServer to back up
schedule_cronyesCron expression (e.g. 0 2 * * * for 2 AM daily)
backup_toolnomydumperBackup tool (mydumper)
retention_daysno30Days to retain backups (1–365)
s3_prefixnoCustom S3 path prefix

Response (201 Created): The created schedule object.

Update schedule

MethodEndpointPermissionDescription
PATCH/backup/schedules/{schedule_id}backup:createUpdate a backup schedule

All fields are optional. Only provided fields are updated.

{
  "enabled": false,
  "retention_days": 7,
  "schedule_cron": "0 3 * * 0"
}

Delete schedule

MethodEndpointPermissionDescription
DELETE/backup/schedules/{schedule_id}backup:createDelete a backup schedule

Response: 204 No Content.

List backup history

MethodEndpointPermissionDescription
GET/backup/historybackup:createList backup history

Query parameters:

ParameterRequiredDefaultDescription
server_idnoFilter by server UUID
statusnoFilter by status (running, completed, failed)
sincenoISO 8601 start date
untilnoISO 8601 end date
limitno50Results per page (1–200)

Response:

[
  {
    "id": "uuid",
    "schedule_id": "uuid",
    "server_id": "uuid",
    "server_name": "production-db",
    "backup_tool": "mydumper",
    "status": "completed",
    "phase": "complete",
    "s3_path": "s3://bucket/backups/tenant/server/2026-04-13/020000/",
    "size_bytes": 26000000,
    "duration_ms": 4500,
    "error_message": null,
    "started_at": "2026-04-13T02:00:00Z",
    "completed_at": "2026-04-13T02:00:04Z"
  }
]

Get backup entry

MethodEndpointPermissionDescription
GET/backup/history/{history_id}backup:createGet a specific backup entry

Response: A single backup history object (same shape as above).


Point-in-Time Recovery (PITR)

Trigger PITR

MethodEndpointPermissionDescription
POST/servers/{server_id}/pitrbackup:createTrigger a PITR backup

Request body:

{
  "target_time": "2026-04-10T14:30:00Z",
  "tables": "mydb.orders,mydb.customers",
  "allow_gaps": false
}
FieldRequiredDefaultDescription
target_timeyesISO 8601 timestamp to recover to
tablesnoall tablesComma-separated schema.table list. When omitted, all indexed tables are auto-discovered and reconstructed.
allow_gapsnofalseProceed even if there are gaps in the binlog event stream

Response (202 Accepted):

{
  "pitr_id": "uuid",
  "status": "running"
}

PITR runs asynchronously. Phases progress through: preparingreconstructinguploadingcomplete.

One at a time

Only one PITR can run per server at a time. Triggering a second PITR while one is running returns 409 Conflict.

List PITR history

MethodEndpointPermissionDescription
GET/servers/{server_id}/pitrbackup:createList PITR history for a server

Query parameters:

ParameterRequiredDefaultDescription
statusnoFilter by status (running, completed, failed)
limitno50Results per page (1–200)

Response:

[
  {
    "id": "uuid",
    "server_id": "uuid",
    "server_name": "production-db",
    "target_time": "2026-04-10T14:30:00Z",
    "tables_filter": null,
    "status": "completed",
    "phase": "complete",
    "s3_path": "s3://bucket/pitr/tenant/server-id/20260410T143000/2026-04-13/141500/",
    "size_bytes": 124000,
    "file_count": 75,
    "duration_ms": 33000,
    "error_message": null,
    "started_at": "2026-04-13T14:14:30Z",
    "completed_at": "2026-04-13T14:15:03Z"
  }
]

Get PITR coverage

MethodEndpointPermissionDescription
GET/servers/{server_id}/pitr/coveragebackup:createCheck the PITR coverage window

Returns the time range where PITR is possible — based on the oldest and latest indexed binlog events.

Response:

{
  "oldest_event": "2026-03-16T01:00:00",
  "latest_event": "2026-04-13T14:12:38",
  "total_events": 132193,
  "available": true
}

available is false when the agent is unreachable.

Coverage vs. baselines

The coverage window tells you the binlog event range. PITR also requires a baseline snapshot (from a backup) taken before the target time. If the oldest baseline is from April 1st, PITR to March 20th will fail even if binlog events exist back to March 16th.

Get PITR entry

MethodEndpointPermissionDescription
GET/servers/{server_id}/pitr/{pitr_id}backup:createGet details of a specific PITR run

Response: A single PITR history object (same shape as the list response).

On this page