> For the complete documentation index, see [llms.txt](https://docs.carto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carto.com/carto-for-developers/reference/carto-api/resources-api/connections.md).

# Connections

Manage connections to your data warehouses.

A connection stores the credentials CARTO uses to reach your data warehouse. Everything else — maps, workflows, tokens — is scoped to one.

Use these endpoints to provision connections programmatically: onboarding a new team, rotating credentials, or replicating a setup across organizations.

| Endpoint                                | What it does        |
| --------------------------------------- | ------------------- |
| `GET /v3/connections`                   | List connections    |
| `POST /v3/connections`                  | Create a connection |
| `GET /v3/connections/{connectionId}`    | Get a connection    |
| `PATCH /v3/connections/{connectionId}`  | Update a connection |
| `DELETE /v3/connections/{connectionId}` | Delete a connection |

{% hint style="info" %}
These endpoints need an **OAuth Access Token**. See [Authorization](https://docs.carto.com/carto-for-developers/reference/carto-api.md#authorization).
{% endhint %}

## Credentials are write-only

Secrets you send are stored encrypted and are **never returned** by any endpoint. When updating a connection, omit them to keep the stored values.

Each provider takes a different `config` shape — BigQuery, Snowflake, Redshift, PostgreSQL, Databricks and Oracle. The request examples below cover the common authentication method for each.

## Deleting a connection that is in use

Deleting a connection with maps or workflows behind it returns `409`. Pass `targetConnectionId` to move them to another connection of the same provider first — it must belong to the same user and use the same provider.

## Sharing

`privacy` is `private` or `shared`. Sharing requires `sharingScope` — `organization` for everyone, or `specific` with the `groupIds` to share with.

Alternatively, send `policies`: a list of grants, each `{ "type": "organization" }`, `{ "type": "user", "id": "..." }` or `{ "type": "group", "id": "..." }`. The list replaces the connection's current grants, and an empty list leaves it owner-only. Unlike `groupIds`, it can name individual users.

The two styles are mutually exclusive — sending `policies` together with `privacy`, `sharingScope` or `groupIds` returns `400`. On `PATCH`, only the connection's owner can send `policies`; anyone else gets a `403`. Every connection response carries its current grants back as `policies`.

## Endpoints

{% openapi src="<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>" path="/v3/connections" method="get" %}
<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>
{% endopenapi %}

{% openapi src="<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>" path="/v3/connections" method="post" %}
<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>
{% endopenapi %}

{% openapi src="<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>" path="/v3/connections/{connectionId}" method="get" %}
<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>
{% endopenapi %}

{% openapi src="<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>" path="/v3/connections/{connectionId}" method="patch" %}
<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>
{% endopenapi %}

{% openapi src="<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>" path="/v3/connections/{connectionId}" method="delete" %}
<https://openapi.gitbook.com/o/zP3LT2Qhlb5jPWQCfWV3/spec/carto-api>
{% endopenapi %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.carto.com/carto-for-developers/reference/carto-api/resources-api/connections.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
