citext, pg_trgm and
pgcrypto. These routes read the catalog for one database and install or
upgrade one extension at a time. For what each extension is for, see
PostgreSQL extensions.
- API access requires a Pro or Business plan. See Authentication.
- A selected-database key works for the databases it is assigned to. A full-account key works for every database you own.
- Install and upgrade work only on databases with managed SQL roles. A single-login database returns the catalog but cannot install or upgrade.
Cache-Control: no-store.
List extensions
GET /api/v1/databases/{id}/extensions
The database must be active. The response always lists the three extensions
in the order citext, pg_trgm, pgcrypto.
200 OK
DBHost installs
citext 1.6, pg_trgm 1.6 and pgcrypto 1.3 in the
public schema.
Install or upgrade an extension
POST /api/v1/databases/{id}/extensions/operations
Requests one install or upgrade. The change runs as an asynchronous operation.
Headers
Reuse the same key after a timeout or an uncertain response. The same key
returns the same operation and never starts a second change. A new key
requests a new operation. Reusing a key with a different extension or kind is
rejected with
409 EXTENSION_MUTATION_UNAVAILABLE.
Request body
The body must contain exactly these two fields and nothing else.installrequires that the extension is not installed in the database.upgraderequires that the extension is installed in thepublicschema at a version other than the supported version.- The catalog entry must be
available,trustedandrestoreQualified, and itsdefaultVersionmust be the supported version.
409 EXTENSION_MUTATION_UNAVAILABLE.
Response
202 Accepted while the operation is queued or running, or 200 OK if it
has already reached a terminal status (for example on a replay). The
Location header points to the operation status route.
202 Accepted
idempotencyKey is a value DBHost derives from your header. It is not the
header value you sent.
Get an extension operation
GET /api/v1/databases/{id}/extensions/operations/{operationId}
Returns the current state of one extension operation for this database. While
the operation is open, each read also checks for progress, so poll this route
until status is succeeded, failed or canceled.
200 OK
result is set after success and contains extension, installedVersion and
schema. A failure before any change to the database reports
error.code EXTENSION_PREPARATION_FAILED. If the outcome cannot be confirmed
yet, the operation stays running until DBHost confirms it; keep polling with
the same operation ID rather than submitting a new request.
stage values are informational and may change; base client logic on
status. See Get operation for operations in
general.
Errors
During maintenance the body is
{"error":"MAINTENANCE","message":"..."}
instead of the standard error envelope.
The dashboard offers the same actions on the database page; see
Databases. The CLI equivalents are
dbhost databases extensions <id>,
dbhost databases extensions install|upgrade <id> <extension> --idempotency-key KEY
and dbhost databases extensions status <id> <operation-id>.