Fly.io
Postgres Clusters

Create Postgres Cluster

View as Markdown

Create a Managed Postgres cluster for the organization named in the request body. Provisioning is asynchronous, and a name is generated when one is not supplied.

POST
/v1/postgres

Create a Managed Postgres cluster for the organization named in the request body. Provisioning is asynchronous, and a name is generated when one is not supplied.

Authorization

bearerAuth
AuthorizationBearer <token>

A Fly.io access token. Create one with fly tokens create.

In: header

Request Body

application/json

Cluster details

disk_size_gb?integer

Disk size in gigabytes.

name?string

Name for the cluster. A name is generated when omitted.

org_slug*string

Slug of the organization that will own the cluster.

pg_major_version?string

Postgres major version.

plan*string

Plan slug selecting CPU, memory, and disk sizing.

pool_mode?string

Connection pooler mode.

postgis_enabled?boolean

Enable PostGIS support, required to later enable PostGIS extensions.

region*string

Fly region code where the cluster's primary runs.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/postgres" \  -H "Content-Type: application/json" \  -d '{    "org_slug": "my-org",    "plan": "basic",    "region": "iad"  }'
{  "data": {    "attached_apps": [      {        "name": "string"      }    ],    "cpu_kind": "shared",    "cpus": 2,    "created_at": "string",    "disk_size_gb": 10,    "endpoints": {      "primary": {        "direct": {          "host": "string",          "port": 0        },        "pooler": {          "host": "string",          "port": 0        }      }    },    "id": "string",    "memory_mb": 1024,    "name": "string",    "organization": {      "name": "string",      "slug": "string"    },    "pg_major_version": "17",    "plan": "basic",    "postgis_enabled": true,    "region": "iad",    "replicas": 1,    "status": "ready"  }}
{  "error": "string"}
{  "error": "string"}
{  "error": "string"}