Skip to main content
POST
/
project
/
{project_id}
/
location
/
{location}
/
postgres
/
{postgres_database_reference}
curl -X POST "https://api.ubicloud.com/project/{project_id}/location/eu-central-h1/postgres/my-postgres-db" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "size": "standard-2",
    "storage_size": 100,
    "version": "16",
    "ha_type": "sync",
    "tags": [
      {
        "key": "environment",
        "value": "production"
      }
    ]
  }'
{
  "id": "pgn30gjk1d1e2jj34v9x0dq4rp",
  "name": "my-postgres-db",
  "location": "eu-central-h1",
  "state": "creating",
  "connection_string": "postgresql://username:password@hostname:5432/dbname",
  "username": "postgres",
  "password": "generated_password",
  "hostname": "my-postgres-db.ubicloud.com",
  "version": "16",
  "target_version": "16",
  "ha_type": "sync",
  "vm_size": "standard-2",
  "storage_size_gib": 100,
  "read_replica": false,
  "tags": [
    {
      "key": "environment",
      "value": "production"
    }
  ],
  "created_at": "2024-01-15T10:30:00Z"
}

Path Parameters

project_id
string
required
ID of the projectPattern: ^pj[0-9a-hj-km-np-tv-z]{24}$Example: pjkkmx0f2vke4h36nk9cm8v8q0
location
string
required
The Ubicloud location/regionExample: eu-central-h1
postgres_database_reference
string
required
Postgres database ID or namePattern: ^[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?$

Body Parameters

size
string
required
Requested size for the underlying VM
storage_size
integer
required
Requested storage size in GiB
flavor
string
Kind of database
ha_type
string
High availability type
version
string
PostgreSQL version
restrict_by_default
boolean
Whether to restrict access by default (if so, firewall rules must be added to access)
private_subnet_name
string
Name for the private subnet (if not provided, a name will be auto-generated)
pg_config
object
PostgreSQL configuration parametersExample: {"max_connections": "100"}
pgbouncer_config
object
PgBouncer configuration parametersExample: {"max_client_conn": "100"}
tags
array
Tags for the Postgres Database

Response

id
string
required
ID of the Postgres database
name
string
required
Name of the Postgres database
location
string
required
Location of the Postgres database
state
string
required
State of the Postgres database
connection_string
string
Connection string to the Postgres database
username
string
Username for the Postgres database
password
string
Password for the Postgres database
hostname
string
Hostname for the Postgres database
version
string
required
Current Postgres version
vm_size
string
required
Size of the underlying VM
storage_size_gib
integer
required
Storage size in GiB
curl -X POST "https://api.ubicloud.com/project/{project_id}/location/eu-central-h1/postgres/my-postgres-db" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "size": "standard-2",
    "storage_size": 100,
    "version": "16",
    "ha_type": "sync",
    "tags": [
      {
        "key": "environment",
        "value": "production"
      }
    ]
  }'
{
  "id": "pgn30gjk1d1e2jj34v9x0dq4rp",
  "name": "my-postgres-db",
  "location": "eu-central-h1",
  "state": "creating",
  "connection_string": "postgresql://username:password@hostname:5432/dbname",
  "username": "postgres",
  "password": "generated_password",
  "hostname": "my-postgres-db.ubicloud.com",
  "version": "16",
  "target_version": "16",
  "ha_type": "sync",
  "vm_size": "standard-2",
  "storage_size_gib": 100,
  "read_replica": false,
  "tags": [
    {
      "key": "environment",
      "value": "production"
    }
  ],
  "created_at": "2024-01-15T10:30:00Z"
}

Build docs developers (and LLMs) love