Restore
Backup and point-in-time restores, restore points.
AuthorizationBearer <token>Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.
projectID*stringProject id.
application/json- body
Exactly one of backup_key, restore_time, or restore_point_id must be provided.
allow_unverified_backup?booleanPermit restoring from a backup whose verification has not passed.
backup_key?stringBackup to restore from. May be empty when restore_point_id or restore_time is given.
approval_token?stringSingle-use approval token (action project.restore_overwrite) required when target_kind is "project" (overwrites the live database in place). Mint one via POST /v1/projects/{projectID}/approvals; presenting an already-consumed token returns the restore job it authorized.
preview_id?stringExisting preview database to restore into.
preview_name?stringName for a new preview database to restore into.
recreate?booleanDrop and recreate the target project database before restoring. Applies to backup-based restores with target_kind "project"; preview targets and point-in-time restores always land in a fresh instance. The existing database is backed up first, labeled pre-restore-<job id>; if that backup fails or fails its restore verification, the job fails with nothing dropped. The backup appears in the project's backup list, and its id is recorded in the job result (pre_operation_backup_id) and in a project.pre_operation_backup_created audit event, so the previous contents can be restored if the restore itself fails.
restore_point_id?stringRestore from a named restore point instead of a raw backup key.
restore_time?stringPoint-in-time recovery target timestamp (RFC 3339). A time later than the latest restorable point restores to the latest restorable point instead of failing (see pitr in the response and the job result). A time before the earliest restorable point - the start of the point-in-time recovery window, or the project's creation if later - is a 400 that names the restorable range.
target_kind?stringRestore target: a preview database (default) or "project" to overwrite production.
"project""preview""new_preview"ttl_hours?integerTTL for a newly created preview target.
Restore job enqueued.
application/json- response
The enqueued restore job. A point-in-time restore also carries pitr: the target it runs to.
job*pitr?How a requested point-in-time target became the one the restore runs to. A time later than the latest restorable point is not an error: the restore runs to the latest restorable point instead and restore_time_clamped is true. At request time that point is bounded by now; the data node may find the last replayable commit earlier still, and the completed job's result reports the time the restore actually reached.
curl -X POST 'https://capydb.dev/api/capydb/v1/projects/string/restores' \ -H 'Content-Type: application/json' \ -d '{}'{ "job": { "attempts": 0, "claimed_at": "2019-08-24T14:15:22Z", "claimed_by": "string", "host_id": "string", "instance_id": "string", "completed_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", "error": "string", "id": "string", "last_exit_code": 0, "last_stderr": "string", "last_stdout": "string", "locked_resource": "string", "max_attempts": 0, "organization_id": "string", "preview_database_id": "string", "project_id": "string", "result": null, "retry_classification": "string", "started_at": "2019-08-24T14:15:22Z", "state": "pending", "type": "project.apply_plan", "updated_at": "2019-08-24T14:15:22Z" }, "pitr": { "requested_restore_time": "2019-08-24T14:15:22Z", "restore_time": "2019-08-24T14:15:22Z", "restore_time_clamped": true }}AuthorizationBearer <token>Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.
projectID*stringProject id.
Restore points.
application/json- response
restore_points*array<>pitr_window_days*integerHow many days back point-in-time recovery reaches. Times older than this window (and PITR restore points pinned past it) cannot be restored.
curl -X GET 'https://capydb.dev/api/capydb/v1/projects/string/restore-points'{ "restore_points": [ { "backup_id": "string", "backup_key": "string", "created_at": "2019-08-24T14:15:22Z", "created_by_actor_id": "string", "created_by_actor_kind": "string", "id": "string", "kind": "backup", "label": "string", "note": "string", "organization_id": "string", "pitr_time": "2019-08-24T14:15:22Z", "project_id": "string", "state": "active", "updated_at": "2019-08-24T14:15:22Z" } ], "pitr_window_days": 0}AuthorizationBearer <token>Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.
projectID*stringProject id.
application/json- body
backup_key?stringBackup to pin (kind "backup").
kind?string"backup""pitr"label*stringnote?stringpitr_time?stringPITR timestamp to pin (kind "pitr", RFC 3339).
Restore point created.
application/json- response
restore_point*curl -X POST 'https://capydb.dev/api/capydb/v1/projects/string/restore-points' \ -H 'Content-Type: application/json' \ -d '{ "label": "string"}'{ "restore_point": { "backup_id": "string", "backup_key": "string", "created_at": "2019-08-24T14:15:22Z", "created_by_actor_id": "string", "created_by_actor_kind": "string", "id": "string", "kind": "backup", "label": "string", "note": "string", "organization_id": "string", "pitr_time": "2019-08-24T14:15:22Z", "project_id": "string", "state": "active", "updated_at": "2019-08-24T14:15:22Z" }}AuthorizationBearer <token>Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.
projectID*stringProject id.
restorePointID*stringRestore point id.
Restore point deleted.
application/json- response
deleted*booleancurl -X DELETE 'https://capydb.dev/api/capydb/v1/projects/string/restore-points/string'{ "deleted": true}