# Change a PostgreSQL Connection

After creating your database, you can change the connection to your private LAN or remove it completely. You can change it to be connected to a different LAN or update the IP address. However, you must always include all properties of the connections list for the request, even if you only want to update the database IP address. The newly provided LAN must be located in the same place as the database cluster. Updating the IP address also updates the DNS record of the database's name.

{% hint style="info" %}
**Note:** When you change the connection to a new LAN, the database will no longer be reachable in the old network almost immediately. However, the new connection will only be established after your dedicated VMs are updated, which can take a couple of minutes, depending on the number of instances you specified.
{% endhint %}

## Endpoint

To modify the connection settings for your PostgreSQL cluster, send a `PATCH` request to the following endpoint:`https://api.ionos.com/databases/postgresql/clusters/{clusterId}`

{% hint style="info" %}
**Note:** The sample UUID is `498ae72f-411f-11eb-9d07-046c59cc737e`.
{% endhint %}

## Request

```bash
curl --include \
    --request PATCH \
    --user "clientname@ionos.com:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "properties": {
        "connections": [
          {
            "datacenterId": "b4f86015-9918-443d-be14-aa2eb7529f40",
            "lanId": "2",
            "cidr": "192.168.1.100/24"
          }
        ]
      }
    }' \
```

In order to remove the connection, you have to specify an empty list in the request body:

```json
{
  "properties": {
    "connections": []
  }
}
```

## Response

```json
{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "clientname@ionos.com",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "clientname@ionos.com",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
    "properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 4,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Sunday",
            "time": "03:30:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": true,
            "poolMode": "session"
        }
    }
}
```


---

# Agent Instructions: 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:

```
GET https://docs.ionos.com/cloud/databases/postgresql/api/v1-api/modify-cluster-attributes/change-a-postgresql-connection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
