> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dbhost.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview CI lifecycle

> Create, inspect, renew, change backup policy and delete a namespace-bound preview.

<Note>
  Preview CI is available only after account activation. Use a namespace-bound
  `dbhci_` key for these endpoints. A full-account `dbh_` key cannot substitute
  for a preview CI key. Previews are for synthetic test data; do not put
  production or personal data in them.
</Note>

## Create or replay

`POST /api/v1/previews` accepts `ref`, optional `ttlHours` (1–72, default 24)
and optional `scheduledBackup` (`none` or `daily`, default `none`). The server
derives the internal name and idempotency key from the CI namespace and ref.
Repeating the same ref and choices returns the same preview; changing the
choices for that ref conflicts. Creation counts against the existing total
database quota.

```json theme={null}
{ "ref": "pull/42", "ttlHours": 24, "scheduledBackup": "none" }
```

No daily logical backup means there is no daily dump. Infrastructure VM backups
and manually retained snapshots may still contain the preview; they do not
expire with the preview lease. Manual snapshots are reviewed weekly and
normally removed within 30 days unless a documented, time-limited incident or
rollback hold applies. Both backup choices require a verified deletion backup
and preserve a seven-day recovery window when the preview is deleted.

## Inspect and renew

`GET /api/v1/previews/{databaseId}` returns the database and namespace IDs,
lease status and generation, expiry, backup choice and, after deletion, the
recovery deadline. The response contains no credentials.

`POST /api/v1/previews/{databaseId}/extend` accepts
`{ "ttlHours": 24 }`. The value may be up to 72 hours per renewal. An expired
or deleting lease cannot be renewed. To switch between `none` and `daily`, use
`PATCH /api/v1/previews/{databaseId}/backup-policy` with
`{ "scheduledBackup": "daily" }`.

## Delete and recover

`DELETE /api/v1/previews/{databaseId}` takes no body. Deletion must finish
with its own verified backup before the seven-day recovery window begins.
Unknown agent outcomes remain held rather than creating a second deletion.
The CI key cannot recover a deleted preview. An owner with a full-account key
uses `POST /api/v1/databases/{databaseId}/recover` within seven days. A
successful recovery starts a new 24-hour lease; later renewals can again be
up to 72 hours.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.