---
title: "Create a new PostgreSQL database"
method: POST
path: "/project/{project_id}/location/{location}/postgres/{postgres_database_reference}"
tags: ["Postgres Database"]
---

# Create a new PostgreSQL database

`POST /project/{project_id}/location/{location}/postgres/{postgres_database_reference}`

## Request body

- object
  - `flavor` string — Kind of database
  - `ha_type` string — High availability type
  - `size` string, required — Requested size for the underlying VM
  - `storage_size` integer, required — Requested storage size in GiB
  - `version` '16' | '17' | '18' — 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
  - `pgbouncer_config` object
  - `tags` PostgresTag[] — Tags for the Postgres Database
    - `key` string, required — Key of the Postgres tag
    - `value` string, required — Value of the Postgres tag

## Response `200`

A Postgres Database

- object
  - `flavor` string, required — Kind of Postgres database
  - `ha_type` string, required — High availability type
  - `target_server_count` integer, required — Target number of servers (primary + standbys)
  - `id` string, required — ID of the Postgres database
  - `location` string, required — Location of the Postgres database
  - `name` string, required — Name of the Postgres database
  - `state` string, required — State of the Postgres database
  - `storage_size_gib` integer, required — Storage size in GiB
  - `target_storage_size_gib` integer — Desired storage size in GiB
  - `version` '16' | '17' | '18', required — Current Postgres version
  - `target_version` '16' | '17' | '18', required — Target Postgres version
  - `vm_size` string, required — Size of the underlying VM
  - `target_vm_size` string — Desired VM size
  - `ca_certificates` string, nullable — CA certificates of the root CA used to issue postgres server certificates
  - `maintenance_window_start_at` integer, nullable, required — Maintenance window start time
  - `maintenance_window_days` MaintenanceWindowDay[] — Days of the week the maintenance window applies to (empty list means every day)
  - `read_replica` boolean, required — If the database is a read replica or not
  - `parent` string, nullable — Parent Postgres database
  - `fallback_active` boolean, required — Whether the primary server is running on a fallback instance type
  - `tags` PostgresTag[], required — Tags of the Postgres database
    - `key` string, required — Key of the Postgres tag
    - `value` string, required — Value of the Postgres tag
  - `created_at` string, date-time, required — Creation timestamp of the Postgres database
  - `connection_string` string, nullable, required — Connection string to the Postgres database
  - `private_connection_string` string, nullable, required — Private connection string to the Postgres database, accessible from connected subnets
  - `username` string, nullable, required — Username for the Postgres database
  - `password` string, nullable, required — Password for the Postgres database
  - `hostname` string, nullable, required — Hostname for the Postgres database
  - `earliest_restore_time` string, nullable, required — Earliest restore time (if primary)
  - `firewall_rules` PostgresFirewallRule[], required — List of Postgres firewall rules
    - `cidr` string, required — CIDR of the firewall rule
    - `description` string — Port information for the firewall rule
    - `id` string, required — ID of the firewall rule
    - `port` integer — Port for the Postgres firewall rule
  - `latest_restore_time` string, required — Latest restore time (if primary)"
  - `primary` boolean, required — Is the database primary

## Other responses

- `default` — An error response

## Changes

> 59 revisions in range; 8 could not be searched.

- **2026-07-14** `0d2405af1fd7` — 1 info
  - added the optional property `allOf[#/components/schemas/PostgresDatabase]/maintenance_window_days` to the response with the `200` status
- **2026-07-08** `a8cf54a33de7` — 1 info
  - added the required property `allOf[subschema #2]/private_connection_string` to the response with the `200` status
- **2026-07-06** `ddf6e87ed1be` — 1 breaking
  - the response property `allOf[subschema #2]/maintenance_window_start_at` became nullable for the status `200`
- **2026-05-22** `576c50424941` — 1 info
  - added the required property `allOf[#/components/schemas/PostgresDatabase]/fallback_active` to the response with the `200` status
- **2026-04-09** `e483b6781a6d` — 1 info
  - added the required property `allOf[#/components/schemas/PostgresDatabase]/target_server_count` to the response with the `200` status

[Full history](https://skmtc.dev/ubicloud/apis/clover-api/changes/project/:project_id/location/:location/postgres/:postgres_database_reference/post.md)

---

[API](https://skmtc.dev/ubicloud/apis/clover-api.md) · [All operations](https://skmtc.dev/ubicloud/apis/clover-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ubicloud/clover-api/revisions/ae229e5ccaee/schema)
