# Connections

Connected services: list them, connect new ones, check them, and read or write in them.

Web version: https://www.svanja.com/docs/api/connections/

Connections are the services Svanja works with for you, like GitHub, Google Drive, or your own API. You can manage them in [Connections](https://app.svanja.com/connections), or use these endpoints to check a connection's health and read or write in a connected service from your own code. Reading requires the Connections area, which is included in Full access and Read-only. Making changes requires Full access or Connections set to **Read and write**, and every write to another service waits for someone to approve it. For more details, see [Connections](https://www.svanja.com/docs/connections/).

`GET /connections` lists your connections along with their health status, and `GET /connections/{id}` returns a single connection and the operations it supports. To start a new connection, send `POST /connections` with a `provider`, which requires approval in the app first. If the service requires a sign-in, the response includes a link to finish signing in through a browser. A Custom API connection returns right away.

Use `PATCH /connections/{id}` to change a connection's settings. For everything else, send `POST /connections/{id}/actions` with `action` set to `read`, `write`, `check`, or `disconnect`. Writing to a connected service takes three steps:

1. Prepare the exact write with `POST /authorization-requests`, using the `connection.action` operation and the same `input` you plan to send.
2. Have a person approve the request in the app using the `approval_url`.
3. Send the write along with the `authorization_request_id`.

See [The REST API](https://www.svanja.com/docs/api/) for more on the API, or use [svanja connection](https://www.svanja.com/docs/cli/connections-and-channels/) if you are working from a terminal.

## Operations

| Operation | What it does | Effect | Endpoints |
| --- | --- | --- | --- |
| `connection.action` | Run a declared provider action. | Acts outside Svanja | `POST /connections/{id}/actions` |
| `connection.connect` | Connect or reconnect a provider. | Changes access or automation | `POST /connections` |
| `connection.read` | Read provider connections. | Reads only | `GET /connections`<br>`GET /connections/{id}` |

## Endpoints

### GET /api/v1/connections

List provider connections

### POST /api/v1/connections

Start provider connection handoff

### GET /api/v1/connections/{id}

Read a provider connection

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### PATCH /api/v1/connections/{id}

Update provider connection settings

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### POST /api/v1/connections/{id}/actions

Run a provider connection action

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
