Preview databases are available on Pro and Business.
CI key
Create a preview CI key under Settings → API keys. Each key starts withdbhci_ and is limited to one namespace,
for example your repository. A normal dbh_ API key cannot manage previews,
and a CI key cannot manage other databases.
Lease
Create a preview with
POST /api/v1/previews and a ref such as pull/42.
Repeating the same ref with the same choices returns the same preview, so a
re-run CI job does not create a second database. Renew with
POST /api/v1/previews/{databaseId}/extend. An expired lease cannot be
renewed.
Backup choice
Change it while the preview is active with
PATCH /api/v1/previews/{databaseId}/backup-policy. Infrastructure snapshots
of the host can still contain preview data; see
Backups and retention.
Delete and recover
Delete a preview withDELETE /api/v1/previews/{databaseId}, or let the lease
expire. DBHost takes a verified deletion backup, and the preview can be
recovered for 7 days. Recovery needs the account owner and a full-account key
(POST /api/v1/databases/{id}/recover); the CI key cannot recover. A
recovered preview starts a new 24-hour lease. After 7 days the preview and its
deletion backup are deleted permanently.
Full request and response details are in the
Preview CI lifecycle reference.