Skip to content

Create a database

POST/v1/databases

Queues a new database and returns 202 Accepted with the operation_id of the create operation. The database starts in provisioning and becomes ready when the operation succeeds. Poll Get an operation or Get a database to follow it.

The response contains the generated password in database.password, and in database.connection_string and database.internal_connection_string. You can read it again later with Get database credentials.

Things to know:

  • Pick engine and version from List database versions and a plan_slug for the same engine from List database plans. engine is case-insensitive and postgresql is accepted as postgres.
  • The engine's default user is created for you: postgres for PostgreSQL, rumpty for MySQL and default for Redis. For PostgreSQL and MySQL the database name is the name's slug with - replaced by _ (for example orders-db becomes orders_db).
  • PostgreSQL databases always get a public hostname on port 5432. MySQL and Redis databases only get a public hostname when public_access is true. They are then reached on a dedicated port, returned as public_port. Public Redis connections use TLS (rediss://). Private databases are reachable only through internal_host from workloads running on RumptyCloud.
  • Free plans (monthly_price_cents of 0) are limited to 2 active databases per account, across every engine and workspace. Check Get the free database quota.
  • Names are not required to be unique, but must contain at least one letter or digit.
  • To create a database from a snapshot, send snapshot_uid. The engine, version and plan are then taken from the snapshot's source database (your engine, version and plan_slug are ignored), as are the database name and user. Storage is at least the source database's storage. Only snapshots of container-runtime databases can be used.

X-Idempotency is optional. If you repeat a create with a key you already used for a database create, the original operation is returned with 200 OK, is_replay: true and the X-Idempotency-Replay header, and nothing new is queued. The replay is checked before anything else (billing, validation, quota), so a retry still gets the original result. The name is compared by slug: the same key with a different name returns 409 with action: idempotency_key_reused, as does using the key for another action. A replay does not include the password.

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

X-Idempotencystring

Optional unique key for this request, such as a UUID. Leading and trailing spaces are trimmed. If you send a key you already used for the same action on the same resource, the original operation is returned with 200 OK, is_replay: true and the X-Idempotency-Replay header, and nothing new is queued. The replay is checked before the resource's current state, so a retry after the first request finished still gets the original result. Reusing a key for a different action or resource returns 409 with action: idempotency_key_reused. Keys are scoped to you and the workspace and shared by every resource type. Without a key, every request queues a new operation.

Request body

namestringRequired

Display name of the database. Leading and trailing spaces are trimmed. Its slug is used for the default database name.

enginestring

Database engine. Case-insensitive; postgresql is treated as postgres. redis runs Valkey. Required unless snapshot_uid is set.

One ofpostgrespostgresqlmysqlredis

versionstring

Engine version from List database versions. Required unless snapshot_uid is set.

plan_slugstring

Slug of an available database plan for the same engine. Case-insensitive. Required unless snapshot_uid is set.

zone_slugstring

Optional zone. When set it must match the plan's zone, otherwise the request fails. The database always runs in the plan's zone.

public_accessboolean

Give a MySQL or Redis database a public hostname and port. PostgreSQL databases always get a public hostname; the value is still stored and returned.

Default false

snapshot_uidstring

UID of an available database snapshot in this workspace to create the database from. See the notes above.

Response

202

The create operation was queued.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

UID of the queued operation. Poll it with Get an operation.

databaseobjectRequired
Show attributes
uidstringRequired

Unique identifier of the database.

namestringRequired

Display name.

slugstringRequired

URL-safe version of the name. Not necessarily unique.

enginestringRequired

Database engine. redis runs Valkey.

One ofpostgresmysqlredis

versionstring

Engine version. Omitted when unknown.

statusstringRequired

Lifecycle state. provisioning while being created, resized, restored or restarted, ready when usable, deleting while being deleted and failed when the last create, resize, restore, restart or delete failed. deleted only appears in an idempotent replay of a delete.

stopped means the platform stopped the database because the account was suspended for non-payment. A ready database switches to stopped as soon as the stop is queued (compute billing stops), and stays stopped while the account is suspended. Within about a minute of the account becoming active again it is restarted: it goes through provisioning back to ready (or failed if the restart fails). While stopped, actions that need a ready database (resize, password rotation, snapshots, the data browser) return 409. If the stop itself fails, the database stays ready and the stop is retried.

One ofprovisioningreadystoppeddeletingdeletedfailed

display_statusstringRequired

Status to show in user interfaces. Currently the same values as status.

plan_slugstring

Slug of the database's plan. Omitted when the plan is unknown.

zone_slugstringRequired

Zone the database runs in.

storage_gibintegerRequired

Provisioned storage in GiB.

vcpuintegerRequired

Whole vCPUs of the plan.

cpu_limit_millisinteger

CPU cap in millicores. Omitted when not set.

memory_mibintegerRequired

Memory in MiB.

hoststring

Public hostname. Omitted for private MySQL and Redis databases.

portinteger

Engine port: 5432 (PostgreSQL), 3306 (MySQL) or 6379 (Redis). Public MySQL and Redis clients connect to public_port instead.

database_namestring

Name of the database inside the engine. Omitted for Redis.

usernamestring

Database user.

passwordstring

The database password. Only returned when a database is created, never by list or get.

connection_stringstring

Public connection URL (postgresql://…?sslmode=require, mysql://… or rediss://…). Contains the password only in the create response. Omitted when the database has no public hostname.

internal_hoststring

Private hostname, reachable only from workloads running on RumptyCloud in the same zone.

internal_connection_stringstring

Private connection URL using internal_host (Redis uses plain redis://). Contains the password only in the create response. Omitted when internal_host is not known.

public_accessbooleanRequired

Whether public access was requested. MySQL and Redis databases only have a public endpoint when this is true.

public_portinteger

Public port for MySQL and Redis databases with public access, in the range 30000–40000. Omitted otherwise.

created_atstring (date-time)Required

When the database was created.

statusstringRequired

Status of the operation. queued for a new request; the original operation's status on a replay.

One ofqueuedrunningsucceededfailed

events_urlstringRequired

Path of the server-sent events stream with the operation's progress.

is_replaybooleanRequired

true when an existing operation was returned for a reused X-Idempotency key.

is_completedboolean

true when a replayed operation has already finished. Omitted unless true.

Response

200

Replay. The X-Idempotency key was already used for this action, so the existing operation is returned and nothing is queued. status is the operation's status and database is the database as it is now (status: deleted once it is gone). The password is never included.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

UID of the queued operation. Poll it with Get an operation.

databaseobjectRequired
Show attributes
uidstringRequired

Unique identifier of the database.

namestringRequired

Display name.

slugstringRequired

URL-safe version of the name. Not necessarily unique.

enginestringRequired

Database engine. redis runs Valkey.

One ofpostgresmysqlredis

versionstring

Engine version. Omitted when unknown.

statusstringRequired

Lifecycle state. provisioning while being created, resized, restored or restarted, ready when usable, deleting while being deleted and failed when the last create, resize, restore, restart or delete failed. deleted only appears in an idempotent replay of a delete.

stopped means the platform stopped the database because the account was suspended for non-payment. A ready database switches to stopped as soon as the stop is queued (compute billing stops), and stays stopped while the account is suspended. Within about a minute of the account becoming active again it is restarted: it goes through provisioning back to ready (or failed if the restart fails). While stopped, actions that need a ready database (resize, password rotation, snapshots, the data browser) return 409. If the stop itself fails, the database stays ready and the stop is retried.

One ofprovisioningreadystoppeddeletingdeletedfailed

display_statusstringRequired

Status to show in user interfaces. Currently the same values as status.

plan_slugstring

Slug of the database's plan. Omitted when the plan is unknown.

zone_slugstringRequired

Zone the database runs in.

storage_gibintegerRequired

Provisioned storage in GiB.

vcpuintegerRequired

Whole vCPUs of the plan.

cpu_limit_millisinteger

CPU cap in millicores. Omitted when not set.

memory_mibintegerRequired

Memory in MiB.

hoststring

Public hostname. Omitted for private MySQL and Redis databases.

portinteger

Engine port: 5432 (PostgreSQL), 3306 (MySQL) or 6379 (Redis). Public MySQL and Redis clients connect to public_port instead.

database_namestring

Name of the database inside the engine. Omitted for Redis.

usernamestring

Database user.

passwordstring

The database password. Only returned when a database is created, never by list or get.

connection_stringstring

Public connection URL (postgresql://…?sslmode=require, mysql://… or rediss://…). Contains the password only in the create response. Omitted when the database has no public hostname.

internal_hoststring

Private hostname, reachable only from workloads running on RumptyCloud in the same zone.

internal_connection_stringstring

Private connection URL using internal_host (Redis uses plain redis://). Contains the password only in the create response. Omitted when internal_host is not known.

public_accessbooleanRequired

Whether public access was requested. MySQL and Redis databases only have a public endpoint when this is true.

public_portinteger

Public port for MySQL and Redis databases with public access, in the range 30000–40000. Omitted otherwise.

created_atstring (date-time)Required

When the database was created.

statusstringRequired

Status of the operation. queued for a new request; the original operation's status on a replay.

One ofqueuedrunningsucceededfailed

events_urlstringRequired

Path of the server-sent events stream with the operation's progress.

is_replaybooleanRequired

true when an existing operation was returned for a reused X-Idempotency key.

is_completedboolean

true when a replayed operation has already finished. Omitted unless true.

Errors

StatusMeaning
400Validation failed. Possible messages: invalid request (malformed JSON or missing name), name is required, name, engine, version, and plan_slug are required, that database engine isn't available yet, invalid database plan, selected plan is not available for that database engine, selected database plan is not available in that zone, invalid database version, that database version isn't available yet, database name must contain alphanumeric characters, invalid snapshot, snapshot source plan is unavailable, or create-from-snapshot is only supported for container-runtime database snapshots.
401The API key is missing, invalid, expired or revoked.
402The account is past due, so new paid resources cannot be created.
403You cannot create resources in this workspace, or the account already has the maximum number of free databases.
409The snapshot is not available (snapshot is not ready to restore), or the X-Idempotency key was already used for a different operation (action: idempotency_key_reused).

Errors use the standard error format.