Skip to main content
The DBHost REST API (https://dbhost.app/api/v1/) is authenticated with API keys. Use it from your applications, scripts, and CI/CD pipelines. Paid users can issue either selected-database keys or full-account keys.

API key scope model

Paid users can create two API key scope types:
  • Selected databases — Recommended least-privilege option. The key only sees and operates on its assigned databases.
  • Full account access — Can create and manage every database in the owning account.
Selected-database keys only list their assigned databases. For database-specific routes, out-of-scope access behaves like a missing resource and returns DATABASE_NOT_FOUND. Full-account-only routes, such as database creation, return KEY_SCOPE_DENIED when used with a selected-database key.

Base URL

Common cURL examples

List databases visible to the authenticated key:
Create a database with a full-account key:
Trigger a backup:

Response format

Most successful responses return JSON. File downloads such as backup exports return the raw attachment body, and some delete routes return 204 No Content. Asynchronous v1 operations return 202 Accepted, preserve a human-readable message, and include an operation object. Read status with GET /api/v1/operations/{id}. Operation types are backup, restore, delete, recover, and clone. Statuses are queued, running, succeeded, failed, and canceled. Errors use a standard envelope:
Capacity and pause codes you may see on create, start and connection-cap requests:

Rate limits

The v1 API applies route-aware limits after authentication and uses shared control-plane PostgreSQL buckets so limits remain consistent across serverless instances. A limited response uses 429 RATE_LIMITED and includes Retry-After plus the applicable rate-limit headers. Clients should honor Retry-After, add jitter, and avoid retrying non-idempotent requests without an idempotency key. Requests are authenticated and rate-limited before their bodies are read.

Resource overview

Account, access and lifecycle:
  • POST /api/v1/databases/{id}/lifecycle
  • PATCH /api/v1/databases/{id}/environment
  • GET|POST /api/v1/databases/{id}/network/allowlist
  • DELETE /api/v1/databases/{id}/network/allowlist/{entryId}
  • GET|POST /api/v1/databases/{id}/members
  • PATCH|DELETE /api/v1/databases/{id}/members/{membershipId}
  • GET /api/v1/databases/{id}/invitations
  • POST /api/v1/databases/{id}/invitations/{invitationId}/resend
  • DELETE /api/v1/databases/{id}/invitations/{invitationId}
  • GET /api/v1/operations/{id}
  • GET|POST /api/v1/webhooks
  • POST /api/v1/webhooks/{id}/rotate
  • DELETE /api/v1/webhooks/{id}
Deletion and recovery (see Delete database and Deleted databases):
  • DELETE /api/v1/databases/{id}
  • GET /api/v1/databases/deleted
  • GET /api/v1/databases/{id}/deletion-backup
  • POST /api/v1/databases/{id}/recover
A deleted database can be recovered for seven days. After that, DBHost permanently deletes it and its deletion backup automatically. Restore from a DBHost backup of the same database (see Restore from a DBHost backup):
  • POST /api/v1/databases/{id}/backups/{filename} for a single-login database
  • POST /api/v1/databases/{id}/legacy-overlay-restores for a single-login database with additional roles
  • POST /api/v1/databases/{id}/managed-restores for a database with managed SQL roles
Clone:
  • POST /api/v1/databases/{id}/clone clones a single-login database. A database with additional roles is rejected with 409 LEGACY_OVERLAY_REQUIRES_V4.
Customer-uploaded SQL and dump restore endpoints are disabled and return 409 CUSTOM_RESTORE_UPLOAD_DISABLED for an authorized database. Use the database owner role with psql or pg_restore over TLS instead; see Restore your own dump. Database creation, collaborator/invitation management, and customer webhooks require a full-account API key. A selected-database key can use database-specific lifecycle, environment, network, and backup routes only for its selected active databases.

Extensions

GET /api/v1/databases/{id}/extensions returns the supported extensions (citext, pg_trgm, pgcrypto) with the version available on the server and the version installed in the selected database. A selected-database API key can read only its assigned database. To install or upgrade one of them on a database with managed SQL roles, send POST /api/v1/databases/{id}/extensions/operations with an exact body {"extension":"citext","kind":"install"} (or pg_trgm, pgcrypto / upgrade) and a stable Idempotency-Key header. The response provides an operation ID for GET /api/v1/databases/{id}/extensions/operations/{operationId}. Check a pending or uncertain outcome by that ID; sending a new key requests a different operation. See PostgreSQL extensions.