Create a Postgres, MySQL or KV (Redis-compatible key-value, Valkey) database on one of the team's clusters. The first database on a cluster also sets up databases there, which takes a minute or two. size sets CPU and memory per instance: "small" (0.25 CPU, 512 MiB, 5 GiB), "medium" (0.5, 1 GiB, 10 GiB), "large" (1, 2 GiB, 20 GiB) or "xlarge" (2, 4 GiB, 50 GiB). MySQL needs 1 GiB, so "medium" or larger. instances is 1 for a single server with no automatic failover. For high availability, use a primary and 2 to 8 replicas for Postgres (instances 3 to 9), 2 to 4 for KV (3 to 5), or 2 or 4 for MySQL (3 or 5). A replica takes over when the primary's server is lost. MySQL has no pooler, read replicas or REST API. Developers and up.
API key access: full.
apiKeyAuthorizationBearer <pyo_…>An API key from the dashboard's API keys page: Authorization: Bearer pyo_…. Keys can expire, and an expired one gets a 401.
application/jsonCreate a Postgres, MySQL or KV (Redis-compatible key-value, Valkey) database on one of the team's clusters. The first database on a cluster also sets up databases there, which takes a minute or two. size sets CPU and memory per instance: "small" (0.25 CPU, 512 MiB, 5 GiB), "medium" (0.5, 1 GiB, 10 GiB), "large" (1, 2 GiB, 20 GiB) or "xlarge" (2, 4 GiB, 50 GiB). MySQL needs 1 GiB, so "medium" or larger. instances is 1 for a single server with no automatic failover. For high availability, use a primary and 2 to 8 replicas for Postgres (instances 3 to 9), 2 to 4 for KV (3 to 5), or 2 or 4 for MySQL (3 or 5). A replica takes over when the primary's server is lost. MySQL has no pooler, read replicas or REST API. Developers and up.
API key access: full.
op*"createDatabase""createDatabase"id*stringA new id you choose: mdb_ then 4 to 40 lowercase letters, digits, dashes or underscores.
teamId*stringclusterId*stringname*stringLowercase letters, digits and dashes, unique in the team.
engine*string"postgres", "mysql" or "valkey".
size*string"small", "medium", "large", "xlarge", or "custom" with cpuMillis and memoryMi.
instances*integer1 (a single server), or high availability: 3 to 9 for Postgres (2 to 8 replicas), 3 to 5 for KV (2 to 4), 3 or 5 for MySQL (2 or 4).
int32version?|Postgres "16", "17" or "18" (the default). MySQL "8.4". Valkey "8.0" or "8.1" (the default).
storageGi?|Storage per instance in GiB. Defaults to the size's storage.
int32pooler?|Postgres: a connection pooler in front (on by default).
rest?booleanKV: a REST API, for serverless and edge code.
cpuMillis?|A custom size's CPU per instance in millicores: 125 to 8000, in steps of 125.
int32memoryMi?|A custom size's memory per instance in MiB: 512 (Postgres), 1024 (MySQL) or 256 (KV) to 32768, in steps of 256.
int32readReplicas?|Dedicated read replicas: 0 (the default) to 5 for Postgres, or to 4 for KV. MySQL has none.
int32extensions?array<string>|Postgres extensions or KV modules to turn on with it, from listDatabaseExtensions with section "managed" for its engine. For example ["vector", "pg_cron"] or ["valkey-json"].
Done. Always ok: true, and some operations add more, such as a new API key or a join command. A warning comes with a change that went through but won't fully take effect yet, such as more replicas than the servers have room for.
application/jsoncurl -X POST 'https://your-pyo.example.com/api/v1/ops' \
-H 'Content-Type: application/json' \
-d '{
"clusterId": "cl_8kq2x7ad",
"engine": "postgres",
"id": "mdb_8kq2x7ad",
"instances": 1,
"name": "web",
"op": "createDatabase",
"size": "small",
"teamId": "team_8kq2x7ad"
}'{}