> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create PostgreSQL cluster

> Create a new PostgreSQL cluster with the specified configuration.



## OpenAPI

````yaml /api-reference/services_documented/cloud_api.yaml post /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Cloud API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-11T15:10:30.328297+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Bare Metal
    x-displayName: Bare Metal
  - name: Container as a Service
    x-displayName: Container as a Service
  - name: Cost Reports
    x-displayName: Cost Reports
  - name: DDoS Protection
    x-displayName: DDoS Protection
  - name: Everywhere Inference
    x-displayName: Everywhere Inference
  - name: Everywhere Inference Apps
    x-displayName: Everywhere Inference Apps
  - name: File Shares
    x-displayName: File Shares
  - name: Floating IPs
    x-displayName: Floating IPs
  - name: Function as a Service
    x-displayName: Function as a Service
  - name: GPU Bare Metal
    x-displayName: GPU Bare Metal
  - name: GPU Virtual
    x-displayName: GPU Virtual
  - name: IP Ranges
    x-displayName: IP Ranges
  - name: Images
    x-displayName: Images
  - name: Instances
    x-displayName: Instances
  - name: Load Balancers
    x-displayName: Load Balancers
  - name: Logging
    x-displayName: Logging
  - name: Managed Kubernetes
    x-displayName: Managed Kubernetes
  - name: Managed PostgreSQL
    x-displayName: Managed PostgreSQL
  - name: Networks
    x-displayName: Networks
  - name: Placement Groups
    x-displayName: Placement Groups
  - name: Projects
    x-displayName: Projects
  - name: Quotas
    x-displayName: Quotas
  - name: Regions
    x-displayName: Regions
  - name: Registry
    x-displayName: Registry
  - name: Reservations
    x-displayName: Reservations
  - name: Reserved IPs
    x-displayName: Reserved IPs
  - name: Routers
    x-displayName: Routers
  - name: SSH Keys
    x-displayName: SSH Keys
  - name: Secrets
    x-displayName: Secrets
  - name: Security Groups
    x-displayName: Security Groups
  - name: Snapshot Schedules
    x-displayName: Snapshot Schedules
  - name: Snapshots
    x-displayName: Snapshots
  - name: Tasks
    x-displayName: Tasks
  - name: User Actions
    x-displayName: User Actions
  - name: User Role Assignments
    x-displayName: User Role Assignments
  - name: Volumes
    x-displayName: Volumes
paths:
  /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}:
    post:
      tags:
        - Managed PostgreSQL
      summary: Create PostgreSQL cluster
      description: Create a new PostgreSQL cluster with the specified configuration.
      operationId: PGClustersViewSet.post
      parameters:
        - in: path
          name: project_id
          required: true
          description: Project ID
          schema:
            description: Project ID
            title: Project Id
            type: integer
        - in: path
          name: region_id
          required: true
          description: Region ID
          schema:
            description: Region ID
            title: Region Id
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PGClusterCreateSerializer'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskIDsSerializer'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            task_id_list = client.cloud.databases.postgres.clusters.create(
                project_id=0,
                region_id=0,
                cluster_name="3",
                flavor={
                    "cpu": 1,
                    "memory_gib": 1,
                },
                high_availability={
                    "replication_mode": "sync"
                },
                network={
                    "acl": ["92.33.34.127"],
                    "network_type": "public",
                },
                pg_server_configuration={
                    "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on",
                    "version": "version",
                },
                storage={
                    "size_gib": 100,
                    "type": "ssd-hiiops",
                },
            )
            print(task_id_list.tasks)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/cloud\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttaskIDList, err := client.Cloud.Databases.Postgres.Clusters.New(context.TODO(), cloud.DatabasePostgresClusterNewParams{\n\t\tProjectID:   gcore.Int(0),\n\t\tRegionID:    gcore.Int(0),\n\t\tClusterName: \"3\",\n\t\tFlavor: cloud.DatabasePostgresClusterNewParamsFlavor{\n\t\t\tCPU:       1,\n\t\t\tMemoryGib: 1,\n\t\t},\n\t\tHighAvailability: cloud.DatabasePostgresClusterNewParamsHighAvailability{\n\t\t\tReplicationMode: \"sync\",\n\t\t},\n\t\tNetwork: cloud.DatabasePostgresClusterNewParamsNetwork{\n\t\t\tACL: []string{\"92.33.34.127\"},\n\t\t},\n\t\tPgServerConfiguration: cloud.DatabasePostgresClusterNewParamsPgServerConfiguration{\n\t\t\tPgConf:  \"\\nlisten_addresses = 'localhost'\\nport = 5432\\nmax_connections = 100\\nshared_buffers = 128MB\\nlogging_collector = on\",\n\t\t\tVersion: \"version\",\n\t\t},\n\t\tStorage: cloud.DatabasePostgresClusterNewParamsStorage{\n\t\t\tSizeGib: 100,\n\t\t\tType:    \"ssd-hiiops\",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", taskIDList.Tasks)\n}\n"
components:
  schemas:
    PGClusterCreateSerializer:
      properties:
        cluster_name:
          description: PostgreSQL cluster name
          maxLength: 50
          minLength: 1
          pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
          title: Cluster Name
          type: string
        databases:
          default: []
          items:
            $ref: '#/components/schemas/Database'
          title: Databases
          type: array
        flavor:
          $ref: '#/components/schemas/Flavor'
          description: Instance RAM and CPU
        high_availability:
          anyOf:
            - $ref: '#/components/schemas/HighAvailabilityOptions'
            - type: 'null'
          description: High Availability settings
        network:
          $ref: '#/components/schemas/PublicNetwork'
          title: Network
        pg_server_configuration:
          $ref: '#/components/schemas/PostgreSQLServerConfig'
          description: PosgtreSQL cluster configuration
        storage:
          $ref: '#/components/schemas/Storage'
          description: Cluster's storage configuration
        users:
          default: []
          items:
            $ref: '#/components/schemas/PgUser'
          title: Users
          type: array
      required:
        - cluster_name
        - network
        - high_availability
        - flavor
        - storage
        - pg_server_configuration
      title: PGClusterCreateSerializer
      type: object
    TaskIDsSerializer:
      properties:
        tasks:
          description: >-
            List of task IDs representing asynchronous operations. Use these IDs
            to monitor operation progress:

            - `GET /v1/tasks/{task_id}` - Check individual task status and
            details

            Poll task status until completion (`FINISHED`/`ERROR`) before
            proceeding with dependent operations.
          example:
            - d478ae29-dedc-4869-82f0-96104425f565
          examples:
            - - d478ae29-dedc-4869-82f0-96104425f565
          items:
            type: string
          title: Tasks
          type: array
      required:
        - tasks
      title: TaskIDsSerializer
      type: object
    Database:
      properties:
        name:
          description: Database name
          example: mydatabase
          examples:
            - mydatabase
          pattern: ^[a-z]*$
          title: Name
          type: string
        owner:
          description: Database owner from users list
          example: myuser
          examples:
            - myuser
          title: Owner
          type: string
      required:
        - name
        - owner
      title: Database
      type: object
    Flavor:
      properties:
        cpu:
          description: Maximum available cores for instance
          example: 1
          examples:
            - 1
            - 2
          minimum: 1
          title: Cpu
          type: integer
        memory_gib:
          description: Maximum available RAM for instance
          example: 1
          examples:
            - 1
            - 2
          minimum: 1
          title: Memory Gib
          type: integer
      required:
        - cpu
        - memory_gib
      title: Flavor
      type: object
    HighAvailabilityOptions:
      properties:
        replication_mode:
          $ref: '#/components/schemas/ReplicationMode'
          description: Type of replication
          examples:
            - sync
            - async
      required:
        - replication_mode
      title: HighAvailabilityOptions
      type: object
    PublicNetwork:
      properties:
        acl:
          description: Allowed IPs and subnets for incoming traffic
          example:
            - 92.33.34.127
          examples:
            - - 92.33.34.127
          items:
            format: ipvanyinterface
            type: string
          title: Acl
          type: array
        network_type:
          const: public
          description: Network Type
          example: public
          examples:
            - public
          title: Network Type
          type: string
      required:
        - network_type
        - acl
      title: PublicNetwork
      type: object
    PostgreSQLServerConfig:
      properties:
        pg_conf:
          description: pg.conf settings
          example: |-

            listen_addresses = 'localhost'
            port = 5432
            max_connections = 100
            shared_buffers = 128MB
            logging_collector = on
          examples:
            - |-

              listen_addresses = 'localhost'
              port = 5432
              max_connections = 100
              shared_buffers = 128MB
              logging_collector = on
          title: Pg Conf
          type: string
        pooler:
          anyOf:
            - $ref: '#/components/schemas/PoolerConfigurationSchema'
            - type: 'null'
          default: null
          examples:
            - null
          title: Pooler configuration for master
        version:
          description: Cluster version
          title: Version
          type: string
      required:
        - pg_conf
        - version
      title: PostgreSQLServerConfig
      type: object
    Storage:
      properties:
        size_gib:
          description: Total available storage for database
          example: 100
          examples:
            - 100
          maximum: 100
          minimum: 1
          title: Size Gib
          type: integer
        type:
          description: Storage type
          example: ssd-hiiops
          examples:
            - ssd-hiiops
          title: Type
          type: string
      required:
        - size_gib
        - type
      title: Storage
      type: object
    PgUser:
      properties:
        name:
          description: User name
          example: myuser
          examples:
            - myuser
          pattern: ^[a-z]*$
          title: Name
          type: string
        role_attributes:
          description: User's attributes
          example:
            - INHERIT
          examples:
            - - INHERIT
          items:
            enum:
              - BYPASSRLS
              - CREATEDB
              - CREATEROLE
              - INHERIT
              - LOGIN
              - NOLOGIN
            type: string
          title: Role Attributes
          type: array
          uniqueItems: true
      required:
        - name
        - role_attributes
      title: PgUser
      type: object
    ReplicationMode:
      enum:
        - async
        - sync
      title: ReplicationMode
      type: string
    PoolerConfigurationSchema:
      properties:
        mode:
          $ref: '#/components/schemas/PoolerModes'
          examples:
            - transaction
        type:
          const: pgbouncer
          default: pgbouncer
          example: pgbouncer
          examples:
            - pgbouncer
          title: Type
          type: string
      required:
        - mode
      title: PoolerConfigurationSchema
      type: object
    PoolerModes:
      enum:
        - session
        - statement
        - transaction
      title: PoolerModes
      type: string
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````