> For the complete documentation index, see [llms.txt](https://docs.datasentinel.io/manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datasentinel.io/manual/implementation/platform-usage/api-reference/connection.md).

# Connection

{% hint style="info" %}
If you prefer installing each agent locally, then adding a connection is done at the agent level
{% endhint %}

To use the Connection API, it's necessary to generate an access token.

{% content-ref url="/pages/pWMV9FXn2PVthWicFKyC" %}
[Access Token](/manual/implementation/platform-usage/api-reference/access-token.md)
{% endcontent-ref %}

## Add

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/pool/pg-instances/{connection_name}`

Create a New Remote Monitored Connection ([Agentless Feature](/manual/features/other-features/agentless-monitoring.md))

#### Path Parameters

| Name                                               | Type   | Description           |
| -------------------------------------------------- | ------ | --------------------- |
| connection\_name<mark style="color:red;">\*</mark> | String | Connection Identifier |

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                       | Type   | Description                                                                                                                                                                                      |
| ------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| host<mark style="color:red;">\*</mark>     | String | PostgreSQL Hostname for connection                                                                                                                                                               |
| port<mark style="color:red;">\*</mark>     | Number | Indicate the port used for communication with the PostgreSQL cluster.                                                                                                                            |
| user<mark style="color:red;">\*</mark>     | String | PostgreSQL user used by Datasentinel for monitoring                                                                                                                                              |
| password<mark style="color:red;">\*</mark> | String | User password                                                                                                                                                                                    |
| tags<mark style="color:red;">\*</mark>     | String | <p>Tags linked with the instance. Tags should follow the format \[key=value],....<br><br>Can be empty</p><p>Refer to <a href="/pages/6qMO1VXnEBOK7n0cig6O">Tags section</a> for more details</p> |

**Response**

{% tabs %}
{% tab title="201: Created " %}

```json
{
    "status": "Connection created and connected!"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="409: Conflict " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

{% code title="Example" %}

```bash
cat > body.json << EOF
{
    "host": "pg-sales-1734",
    "port": 9342,
    "user": "datasentinel",
    "password": "sentinel",
    "tags": "application=sales,environment=production,provider=amazon,datacenter=lyon",
}
EOF
export TOKEN=<<user_token>>
curl -k --header "user-token: $TOKEN" --header 'Content-Type: application/json' --request POST 'https://<<platform-server>>/ds-api/pool/pg-instances/sales-production' -d @body.json

```

{% endcode %}

## Display

<mark style="color:blue;">`GET`</mark> `https://<<platform-server>>/ds-api/pool/pg-instances/{connection_name}`

Display Remote Monitored Connection ([Agentless Feature](/manual/features/other-features/agentless-monitoring.md))

#### Path Parameters

| Name                                               | Type   | Description           |
| -------------------------------------------------- | ------ | --------------------- |
| connection\_name<mark style="color:red;">\*</mark> | String | Connection Identifier |

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

**Response**

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "name": "sales-production",
    "host": "pg-sales-1734",
    "port": 9342,
    "user": "datasentinel",
    "password": "sentinel",
    "tags": "",
    "enabled": true,
    "connected": true,
    "collection-rate": "low",
    "samples": false,
    "lock-monitoring": true,
    "lock-monitoring-delay": 30,
    "table-monitoring": true,
    "query-monitoring": true,
    "query-monitoring-optimize": false,
    "query-monitoring-min-calls": 2,
    "query-monitoring-min-time": 1
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Update

<mark style="color:orange;">`PUT`</mark> `https://<<platform-server>>/ds-api/pool/pg-instances/{connection_name}`

Update Remote Monitored Connection ([Agentless Feature](/manual/features/other-features/agentless-monitoring.md))

#### Path Parameters

| Name                                               | Type   | Description           |
| -------------------------------------------------- | ------ | --------------------- |
| connection\_name<mark style="color:red;">\*</mark> | String | Connection Identifier |

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name     | Type   | Description                                                                                                                                                                                      |
| -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| host     | String | PostgreSQL Hostname for connection                                                                                                                                                               |
| port     | Number | Indicate the port used for communication with the PostgreSQL cluster.                                                                                                                            |
| user     | String | PostgreSQL user used by Datasentinel for monitoring                                                                                                                                              |
| password | String | User password                                                                                                                                                                                    |
| tags     | String | <p>Tags linked with the instance. Tags should follow the format \[key=value],....<br><br>Can be empty</p><p>Refer to <a href="/pages/6qMO1VXnEBOK7n0cig6O">Tags section</a> for more details</p> |

**Response**

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "status": "Connection updated!"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Disable

<mark style="color:purple;">`PATCH`</mark> `https://<<platform-server>>/ds-api/pool/pg-instances/{connection_name}/disable`

Disable Remote Monitored Connection ([Agentless Feature](/manual/features/other-features/agentless-monitoring.md))

#### Path Parameters

| Name                                               | Type   | Description           |
| -------------------------------------------------- | ------ | --------------------- |
| connection\_name<mark style="color:red;">\*</mark> | String | Connection Identifier |

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

**Response**

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "status": "Connection disabled!"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Enable

<mark style="color:purple;">`PATCH`</mark> `https://<<platform-server>>/ds-api/pool/pg-instances/{connection_name}/enable`

Enable Remote Monitored Connection ([Agentless Feature](/manual/features/other-features/agentless-monitoring.md))

#### Path Parameters

| Name                                               | Type   | Description           |
| -------------------------------------------------- | ------ | --------------------- |
| connection\_name<mark style="color:red;">\*</mark> | String | Connection Identifier |

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

{% tabs %}
{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="200: OK " %}

```json
{
    "status": "Connection enabled!"
}
```

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}

## Delete

<mark style="color:red;">`DELETE`</mark> `https://<<platform-server>>/ds-api/pool/pg-instances/{connection_name}`

Delete Remote Monitored Connection ([Agentless Feature](/manual/features/other-features/agentless-monitoring.md))

#### Path Parameters

| Name                                               | Type   | Description           |
| -------------------------------------------------- | ------ | --------------------- |
| connection\_name<mark style="color:red;">\*</mark> | String | Connection Identifier |

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

**Response**

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "status": "Connection deleted!"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}


---

# 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.datasentinel.io/manual/implementation/platform-usage/api-reference/connection.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.
