/v1/databases/{uid}/snapshotsQueues a point-in-time snapshot of the database's data volume and returns 202 Accepted.
The snapshot is listed straight away with status creating and becomes available when
the operation succeeds. If the operation fails, the snapshot is removed. Follow it with
Get an operation.
- The database must be
ready. - Only container-runtime databases support snapshots. Others return
400. - The new snapshot's UID is in
snapshot_uid. The response'snameis the database's name. - Snapshots are kept when the database is deleted.
X-Idempotency is optional. A retry with the same key and the same name returns the
original operation with 200 OK, before the database's state is checked. The same key with
a different name, or for a different database, returns 409
(action: idempotency_key_reused).
Authentication
Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.
Path parameters
uidstringRequiredThe database's uid.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
X-IdempotencystringOptional unique key for this request, such as a UUID. Leading and trailing spaces are
trimmed. If you send a key you already used for the same action on the same resource, the
original operation is returned with 200 OK, is_replay: true and the
X-Idempotency-Replay header, and nothing new is queued. The replay is checked before the
resource's current state, so a retry after the first request finished still gets the
original result. Reusing a key for a different action or resource returns 409 with
action: idempotency_key_reused. Keys are scoped to you and the workspace and shared by
every resource type. Without a key, every request queues a new operation.
Request body
namestringRequiredName of the snapshot.
min length 1 · max length 100
Response
The snapshot operation was queued.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredUID of the queued operation. Poll it with Get an operation.
database_uidstringRequiredUID of the database (for deletes, the snapshot's source database).
snapshot_uidstringUID of the snapshot the operation acts on. Omitted when it is not known.
namestringRequiredThe database's name for create and restore. The snapshot's name for deletes, except on a replayed delete made through Delete a snapshot of a database, which returns the database's name.
actionstringRequiredThe queued action.
One ofdatabase_snapshot.createdatabase_snapshot.restoredatabase_snapshot.delete
statusstringRequiredStatus of the operation. queued for a new request; the original operation's status on a replay.
One ofqueuedrunningsucceededfailed
events_urlstringRequiredPath of the server-sent events stream with the operation's progress.
is_replaybooleanRequiredtrue when an existing operation was returned for a reused X-Idempotency key.
is_completedbooleanRequiredtrue when a replayed operation has already finished.
Response
Replay. The X-Idempotency key was already used for this action, so the existing operation is returned and nothing is queued. status is then the operation's status.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredUID of the queued operation. Poll it with Get an operation.
database_uidstringRequiredUID of the database (for deletes, the snapshot's source database).
snapshot_uidstringUID of the snapshot the operation acts on. Omitted when it is not known.
namestringRequiredThe database's name for create and restore. The snapshot's name for deletes, except on a replayed delete made through Delete a snapshot of a database, which returns the database's name.
actionstringRequiredThe queued action.
One ofdatabase_snapshot.createdatabase_snapshot.restoredatabase_snapshot.delete
statusstringRequiredStatus of the operation. queued for a new request; the original operation's status on a replay.
One ofqueuedrunningsucceededfailed
events_urlstringRequiredPath of the server-sent events stream with the operation's progress.
is_replaybooleanRequiredtrue when an existing operation was returned for a reused X-Idempotency key.
is_completedbooleanRequiredtrue when a replayed operation has already finished.
Errors
| Status | Meaning |
|---|---|
400 | Validation failed. Possible messages: invalid request payload (malformed JSON, or name missing or longer than 100 characters) and snapshots are only supported for container-runtime databases. |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
404 | The resource does not exist or you cannot access it. |
409 | The database is not ready (database must be ready before taking a snapshot, database is not available for snapshots), or the X-Idempotency key was used for a different operation (action: idempotency_key_reused). |
Errors use the standard error format.