Change a database's size, instances, storage, version, pooler, REST API, read replicas or deletion protection. Instances are 1 for a single server, or for high availability 2 to 8 replicas for Postgres, 2 to 4 for KV, or 2 or 4 for MySQL. MySQL instances only grow. Storage only grows and the version only goes up. Only owners and admins can turn deletion protection off. Connected services get changed variables on their next deploy.
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/jsonChange a database's size, instances, storage, version, pooler, REST API, read replicas or deletion protection. Instances are 1 for a single server, or for high availability 2 to 8 replicas for Postgres, 2 to 4 for KV, or 2 or 4 for MySQL. MySQL instances only grow. Storage only grows and the version only goes up. Only owners and admins can turn deletion protection off. Connected services get changed variables on their next deploy.
API key access: full.
op*"updateDatabase""updateDatabase"id*stringsize?string|nullinstances?|int32storageGi?|int32version?string|nullpooler?boolean|nullrest?boolean|nulldeletionProtection?boolean|nullreadReplicas?|Dedicated read replicas, each the database's size: 1 to 5 for Postgres, or 1 to 4 for KV. 0 turns them off. They only serve reads and never become the primary. Postgres: connected services get DATABASE_URL_READ (through their own pooler) while they're on. KV: REDIS_URL sends reads to them automatically.
int32cpuMillis?|With size "custom": CPU per instance in millicores (125 to 8000, steps of 125).
int32memoryMi?|With size "custom": memory per instance in MiB, from 512 for Postgres, 1024 for MySQL or 256 for KV, up to 32768, in steps of 256.
int32Done. 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 '{
"cpuMillis": 1,
"deletionProtection": true,
"id": "mdb_8kq2x7ad",
"instances": 1,
"memoryMi": 1,
"op": "updateDatabase",
"pooler": true,
"readReplicas": 1,
"rest": true,
"size": "example",
"storageGi": 1,
"version": "example"
}'{}