Skip to main content
Databases are exposed by the api.databases module. They are available on Standard, Pro and Enterprise plans.

Creating a database

api.databases.create(options) provisions a new database. The password and certificate are returned only at creation time — store them now.
Current versions by engine: The response from create() returns { id, name, memory, cpu, type, password, certificate?, connection_url, cluster }. cpu is the allocated CPU shares; password and certificate are only present in this creation response, not on later fetches. An unsupported type fails with code: "INVALID_DATABASE_TYPE"; too little memory for the plan fails with code: "INSUFFICIENT_MEMORY"; a failure during provisioning fails with code: "DATABASE_CREATION_FAILED".

Listing your databases

api.user.get() populates user.databases with a Collection of every database you own:

Fetching a single database

Lifecycle

Status and metrics

Summary status for every database

Updating

db.update(options) changes the display name and/or memory allocation. At least one field must be provided.

Credentials

db.credentials.certificate() returns the TLS certificate (base64-encoded PEM):
db.credentials.reset(type) rotates either the password or the certificate.
db.credentials.certificate() and db.credentials.reset() require the database to be running.

Snapshots

db.snapshots mirrors the application snapshots API.
Unlike app.snapshots.restore({ snapshotId, versionId }), db.snapshots.restore(snapshotId, versionId) takes positional arguments.

Deleting a database

Deleting a database is irreversible. Make sure you have a recent snapshot if you might need to recover the data.