> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/api-reference/databases/postgresql/clusters/create-a-cluster.md).

# Create a cluster

Creates a new PostgreSQL cluster. If the `fromBackup` field is populated, the new cluster will be created based on the given backup.

```json
{"openapi":"3.0.3","info":{"title":"IONOS DBaaS PostgreSQL REST API","version":"1.0.0"},"tags":[{"name":"Clusters","description":"Everything about PostgreSQL clusters."}],"servers":[{"url":"https://api.ionos.com/databases/postgresql","description":"Production"}],"security":[{"basicAuth":[]},{"tokenAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"You will need to base64 encode the string containing your credentials.\nSeparate your username and password with a colon, i.e.,\nusername:password and send it as 'Authorization' request header. More\ndetails: https://en.wikipedia.org/wiki/Basic_access_authentication.\n"},"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please provide header value as 'Bearer <token>' and don't forget to add\n'Bearer' HTTP Authorization Scheme before the token.\n"}},"schemas":{"CreateClusterRequest":{"description":"Request payload with all data needed to create a new PostgreSQL cluster.\n","properties":{"metadata":{"$ref":"#/components/schemas/ClusterMetadata"},"properties":{"$ref":"#/components/schemas/CreateClusterProperties"}},"type":"object"},"ClusterMetadata":{"description":"Metadata of the resource.","properties":{"createdDate":{"type":"string","format":"date-time","description":"The ISO 8601 creation timestamp."},"createdBy":{"type":"string"},"createdByUserId":{"type":"string"},"lastModifiedDate":{"type":"string","format":"date-time","description":"The ISO 8601 modified timestamp."},"lastModifiedBy":{"type":"string"},"lastModifiedByUserId":{"type":"string"},"state":{"$ref":"#/components/schemas/State"}}},"State":{"description":"The current status reported back by the cluster.","type":"string","enum":["AVAILABLE","BUSY","DESTROYING","DEGRADED","FAILED","UNKNOWN"]},"CreateClusterProperties":{"description":"Properties with all data needed to create a new PostgreSQL cluster.\n","required":["postgresVersion","instances","cores","ram","storageSize","storageType","connections","location","displayName","credentials","synchronizationMode"],"properties":{"postgresVersion":{"$ref":"#/components/schemas/PostgresVersion"},"instances":{"$ref":"#/components/schemas/Instances"},"cores":{"$ref":"#/components/schemas/Cores"},"ram":{"$ref":"#/components/schemas/Ram"},"storageSize":{"$ref":"#/components/schemas/StorageSize"},"storageType":{"$ref":"#/components/schemas/StorageType"},"connections":{"type":"array","minItems":1,"maxItems":1,"items":{"$ref":"#/components/schemas/Connection"}},"location":{"$ref":"#/components/schemas/Location"},"backupLocation":{"$ref":"#/components/schemas/BackupLocation"},"displayName":{"$ref":"#/components/schemas/DisplayName"},"maintenanceWindow":{"$ref":"#/components/schemas/MaintenanceWindow"},"credentials":{"$ref":"#/components/schemas/DBUser"},"synchronizationMode":{"$ref":"#/components/schemas/CreateSynchronizationMode"},"fromBackup":{"$ref":"#/components/schemas/CreateRestoreRequest"},"connectionPooler":{"$ref":"#/components/schemas/ConnectionPooler"}},"type":"object"},"PostgresVersion":{"type":"string","description":"The PostgreSQL version of your cluster."},"Instances":{"type":"integer","description":"The total number of instances in the cluster (one master and n-1\nstandbys).\n","minimum":1,"maximum":5},"Cores":{"type":"integer","description":"The number of CPU cores per instance.","minimum":1},"Ram":{"type":"integer","description":"The amount of memory per instance in megabytes. Has to be a multiple of 1024.","multipleOf":1024,"minimum":4096},"StorageSize":{"type":"integer","description":"The amount of storage per instance in megabytes.","minimum":10240,"maximum":2097152},"StorageType":{"description":"The storage type used in your cluster. (Value \"SSD\" is deprecated. Use the equivalent \"SSD Premium\" instead)","type":"string","enum":["HDD","SSD","SSD Standard","SSD Premium"]},"Connection":{"description":"Details about the network connection for your cluster.","properties":{"datacenterId":{"description":"The datacenter to connect your cluster to.","type":"string"},"lanId":{"description":"The numeric LAN ID to connect your cluster to.","type":"string"},"cidr":{"type":"string","description":"The IP and subnet for your cluster.\nNote the following unavailable IP ranges:\n10.233.64.0/18\n10.233.0.0/18\n10.233.114.0/24\n"}},"required":["datacenterId","lanId","cidr"],"type":"object"},"Location":{"type":"string","description":"The physical location where the cluster will be created. This will be\nwhere all of your instances live. Property cannot be modified after\ndatacenter creation.\n"},"BackupLocation":{"type":"string","description":"The S3 location where the backups will be stored."},"DisplayName":{"type":"string","description":"The friendly name of your cluster."},"MaintenanceWindow":{"description":"A weekly 4 hour-long window, during which maintenance might occur.\n","properties":{"time":{"type":"string","description":"Start of the maintenance window in UTC time."},"dayOfTheWeek":{"$ref":"#/components/schemas/DayOfTheWeek"}},"required":["time","dayOfTheWeek"],"type":"object"},"DayOfTheWeek":{"description":"The name of the week day.","type":"string","enum":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},"DBUser":{"description":"Credentials for the database user to be created.","properties":{"username":{"type":"string","description":"The username for the initial PostgreSQL user. Some system usernames\nare restricted (e.g. \"postgres\", \"admin\", \"standby\").\n"},"password":{"type":"string","minLength":10}},"required":["username","password"],"type":"object"},"CreateSynchronizationMode":{"description":"Represents the supported replication modes when creating a cluster.\nThe SYNCHRONOUS mode is deprecated and cannot be used in create requests.\nIt may still appear on existing clusters via the SynchronizationMode response schema.\nYou may update your cluster to one of the supported modes yourself.\nElse, it will eventually be migrated to one of the supported modes.\n","type":"string","enum":["ASYNCHRONOUS","STRICTLY_SYNCHRONOUS"]},"CreateRestoreRequest":{"description":"The restore request.","properties":{"backupId":{"type":"string","description":"The unique ID of the backup you want to restore."},"recoveryTargetTime":{"type":"string","format":"date-time","description":"If this value is supplied as ISO 8601 timestamp, the backup will be\nreplayed up until the given timestamp. If empty, the backup will be\napplied completely.\n"}},"required":["backupId"],"type":"object"},"ConnectionPooler":{"description":"Configuration options for the connection pooler","properties":{"enabled":{"type":"boolean"},"poolMode":{"$ref":"#/components/schemas/PoolMode"}}},"PoolMode":{"description":"Represents different modes of connection pooling for the connection pooler.\n","type":"string","enum":["transaction","session"]},"ClusterResponse":{"description":"A database cluster.","properties":{"type":{"allOf":[{"$ref":"#/components/schemas/ResourceType"}]},"id":{"$ref":"#/components/schemas/ResourceId"},"metadata":{"$ref":"#/components/schemas/ClusterMetadata"},"properties":{"$ref":"#/components/schemas/ClusterProperties"}},"type":"object"},"ResourceType":{"description":"The type of the resource.","type":"string","enum":["collection","cluster","backup","user","database"]},"ResourceId":{"type":"string","description":"The unique ID of the resource."},"ClusterProperties":{"description":"Properties of a database cluster.","properties":{"displayName":{"$ref":"#/components/schemas/DisplayName"},"postgresVersion":{"$ref":"#/components/schemas/PostgresVersion"},"location":{"$ref":"#/components/schemas/Location"},"dnsName":{"$ref":"#/components/schemas/DNSName"},"backupLocation":{"$ref":"#/components/schemas/BackupLocation"},"instances":{"$ref":"#/components/schemas/Instances"},"ram":{"$ref":"#/components/schemas/Ram"},"cores":{"$ref":"#/components/schemas/Cores"},"storageSize":{"$ref":"#/components/schemas/StorageSize"},"storageType":{"$ref":"#/components/schemas/StorageType"},"connections":{"type":"array","minItems":1,"maxItems":1,"items":{"$ref":"#/components/schemas/Connection"}},"maintenanceWindow":{"$ref":"#/components/schemas/MaintenanceWindow"},"synchronizationMode":{"$ref":"#/components/schemas/SynchronizationMode"},"connectionPooler":{"$ref":"#/components/schemas/ConnectionPooler"}},"type":"object"},"DNSName":{"type":"string","description":"The DNS name pointing to your cluster."},"SynchronizationMode":{"description":"Represents different modes of replication.\nBe aware that the SYNCHRONOUS mode is deprecated and will be removed in future versions.\nExisting clusters will eventually be migrated to one of the supported modes.\n","type":"string","enum":["ASYNCHRONOUS","SYNCHRONOUS","STRICTLY_SYNCHRONOUS"]},"ErrorResponse":{"properties":{"httpStatus":{"type":"integer","description":"The HTTP status code of the operation."},"messages":{"type":"array","items":{"$ref":"#/components/schemas/ErrorMessage"}}},"type":"object"},"ErrorMessage":{"properties":{"errorCode":{"type":"string","description":"Application internal error code\n"},"message":{"type":"string","description":"A human readable explanation specific to this occurrence of the\nproblem.\n"}},"type":"object"}},"responses":{"ApiError":{"description":"Any erroneous status code: 400 (parse error), 401 (auth error),\n402 (trial access), 403 (insufficient permissions), 404 (not found),\n405 (unsupported HTTP method), 415 (unsupported content type,\n422 (validation error), 429 (request rate limit exceeded),\n500 (server error), 503 (maintenance)\n","headers":{"Content-Type":{"description":"application/problem+json","schema":{"type":"string","default":"application/problem+json"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/clusters":{"post":{"operationId":"clustersPost","summary":"Create a cluster","description":"Creates a new PostgreSQL cluster.\nIf the `fromBackup` field is populated, the new cluster will be created\nbased on the given backup.\n","tags":["Clusters"],"requestBody":{"description":"The cluster to be created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateClusterRequest"}}},"required":true},"responses":{"200":{"description":"The created cluster is returned with `metadata.state` set to \"BUSY\".\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClusterResponse"}}}},"default":{"$ref":"#/components/responses/ApiError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/api-reference/databases/postgresql/clusters/create-a-cluster.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
