# List connections

> The connections of the workspace in one region that the caller can see: the ones they created and the ones shared with the workspace.

Source: https://docs.stacksync.com/api-reference/connections/list_connections

`GET https://api.stacksync.com/v1/workspaces/{workspace_id}/connections`

- Operation: `list_connections`
- Resource: Connections
- Access: read-only

## Authentication

- `Authorization: Bearer <key>`: A workspace API key (workspace_…, created by a workspace owner under Workspace settings > Stacksync API) acts with editor rights on that workspace only; a user API key (user_…, created under Profile > Stacksync API) acts as that user in every workspace they belong to. POST, PUT and PATCH requests must send Content-Type: application/json. Every authentication failure answers 403.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | integer | Yes | The workspace. List the ones your key can reach with GET /v1/workspaces. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `region` | string (besg \| usnv) | Yes | Region of the connection: besg or usnv |
| `name` | string \| null | No | Only the connection with exactly this name |
| `connection_name` | string \| null | No | Same as name |
| `search` | string \| null, 1 to 200 characters | No | Only connections whose name contains this text, case-insensitive |
| `app_type` | string \| null | No | Only connections of this app type: the type shown in Stacksync (app_type) or the underlying connector type, case-insensitive |

## Returns

### 200 OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of object (Connection) | Yes |  |
| `data[].connection_id` | string | Yes |  |
| `data[].connection_name` | string | Yes |  |
| `data[].app_type` | string | Yes | The type shown in Stacksync |
| `data[].is_shared_with_workspace` | boolean | Yes |  |
| `data[].created_time` | string | Yes | UTC, YYYY-MM-DD HH:MM:SS |
| `data[].last_modified_time` | string | Yes | UTC, YYYY-MM-DD HH:MM:SS |
| `data[].credentials_options` | object | Yes | The identifiers of the connection (instance_id, instance_url, shop_name, sub_domain...), never a secret |
| `data[].connection_resource_id` | string \| null | Yes | The name workflow steps reference the connection by |
| `data[].region` | string | Yes |  |
| `data[].needs_reauthorization` | boolean | Yes | True when Stacksync marked the credentials invalid (the app refused to refresh them): reauthorize it in Stacksync. Credentials the app refuses on a read are reported by that read |

## Example request

```bash
curl -X GET "https://api.stacksync.com/v1/workspaces/{workspace_id}/connections?region=usnv" \
  -H "Authorization: Bearer $STACKSYNC_API_KEY"
```

## Example response (200)

```json
{
  "data": [
    {
      "connection_id": "<connection_id>",
      "connection_name": "<connection_name>",
      "app_type": "<app_type>",
      "is_shared_with_workspace": false,
      "created_time": "<created_time>",
      "last_modified_time": "<last_modified_time>",
      "credentials_options": {},
      "connection_resource_id": "<connection_resource_id>",
      "region": "<region>",
      "needs_reauthorization": false
    }
  ]
}
```

## Errors

| Status | Meaning | Body |
| --- | --- | --- |
| 400 | Bad Request | `{ "error": string, "msg": string, "field": string \| null }` |
| 403 | Forbidden | `{ "error": string, "msg": string, "field": string \| null }` |

## Related

- [API Reference overview](https://docs.stacksync.com/api-reference): base URLs, regions, pagination, idempotency and errors
- [Authentication](https://docs.stacksync.com/api-reference/authentication): API keys and the 403 answers
- OpenAPI document: https://docs.stacksync.com/openapi.json
- [Get a connection](https://docs.stacksync.com/api-reference/connections/get_connection)
- [Create a connection](https://docs.stacksync.com/api-reference/connections/create_connection)
- [Update a connection](https://docs.stacksync.com/api-reference/connections/update_connection)
- [Delete a connection](https://docs.stacksync.com/api-reference/connections/delete_connection)
- [Reauthorize a connection](https://docs.stacksync.com/api-reference/connections/reauthorize_connection)