# Create (PostgreSQL)

Source: https://coolify.io/docs/api/endpoints/databases/create-database-postgresql

## POST /databases/postgresql

Create (PostgreSQL)

Create a new PostgreSQL database.

**Authentication:** Bearer token (`bearerAuth`)

### Request body

Database data

`application/json`, required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| server_uuid | string | yes | UUID of the server |
| project_uuid | string | yes | UUID of the project |
| environment_name | string | no | Name of the environment. You need to provide at least one of environment_name or environment_uuid. |
| environment_uuid | string | no | UUID of the environment. You need to provide at least one of environment_name or environment_uuid. |
| postgres_user | string | no | PostgreSQL user |
| postgres_password | string | no | PostgreSQL password |
| postgres_db | string | no | PostgreSQL database |
| postgres_initdb_args | string | no | PostgreSQL initdb args |
| postgres_host_auth_method | string | no | PostgreSQL host auth method |
| postgres_conf | string | no | PostgreSQL conf |
| destination_uuid | string | no | UUID of the destination if the server has multiple destinations |
| name | string | no | Name of the database |
| description | string | no | Description of the database |
| image | string | no | Docker Image of the database |
| is_public | boolean | no | Is the database public? |
| public_port | integer | no | Public port of the database |
| public_port_timeout | integer | no | Public port timeout in seconds (default: 3600) |
| limits_memory | string | no | Memory limit of the database |
| limits_memory_swap | string | no | Memory swap limit of the database |
| limits_memory_swappiness | integer | no | Memory swappiness of the database |
| limits_memory_reservation | string | no | Memory reservation of the database |
| limits_cpus | string | no | CPU limit of the database |
| limits_cpuset | string | no | CPU set of the database |
| limits_cpu_shares | integer | no | CPU shares of the database |
| instant_deploy | boolean | no | Instant deploy the database |
| tags | array of string | no | Tags to assign to the database. |

### Responses

#### 200

Database updated

#### 400

Invalid token.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |

#### 401

Unauthenticated.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |

#### 422

Validation error.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |
| errors | object | no |  |
