# Get a group connection

Read a group's own connection state for an integration.

`GET https://api.smallworld.sh/api/v1/groups/:groupId/connections/:integration`

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| groupId | path | string | Yes | Your application's group ID, URL-encoded. At most 512 characters, with no surrounding whitespace or null bytes. |
| integration | path | string | Yes | An integration key from GET /integrations, such as github or notion. |

## Request examples

### curl

```curl
curl --fail-with-body -X GET 'https://api.smallworld.sh/api/v1/groups/team_42/connections/github' \
  -H "Authorization: Bearer $SMALLWORLD_API_KEY"
```

### typescript

```typescript
const response = await fetch("https://api.smallworld.sh/api/v1/groups/team_42/connections/github", {
  method: "GET",
  headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();
```

### python

```python
response = requests.get(
    "https://api.smallworld.sh/api/v1/groups/team_42/connections/github",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Responses

Returns the shape of a user's connection with userId null: integration, groupId, source (group, or null when not connected), overridesGroup (always false), authScheme, status (connected, needs_reauth, or not_connected), and nullable accountId, accountName, workspaceId, connectedAt, updatedAt, and error. Credentials are never returned.

### 200 · Connected

The group's own account, which members without a connection of their own use. Secret credential values are never returned.

```json
{
  "integration": "github",
  "userId": null,
  "groupId": "team_42",
  "source": "group",
  "overridesGroup": false,
  "authScheme": "api_key",
  "status": "connected",
  "accountId": "654321",
  "accountName": "support-bot",
  "workspaceId": null,
  "connectedAt": "2026-10-10T12:00:01.000Z",
  "updatedAt": "2026-10-10T12:00:01.000Z",
  "error": null
}
```

### 200 · Needs reauth

The group's credentials no longer work. Connect the group again through a new connect session.

```json
{
  "integration": "github",
  "userId": null,
  "groupId": "team_42",
  "source": "group",
  "overridesGroup": false,
  "authScheme": "api_key",
  "status": "needs_reauth",
  "accountId": "654321",
  "accountName": "support-bot",
  "workspaceId": null,
  "connectedAt": "2026-10-10T12:00:01.000Z",
  "updatedAt": "2026-10-10T12:00:01.000Z",
  "error": "GitHub rejected the stored credentials. Ask the user to connect again."
}
```

### 200 · Not connected

The group has no connection to the integration. source, account fields, and connection timestamps are null.

```json
{
  "integration": "github",
  "userId": null,
  "groupId": "team_42",
  "source": null,
  "overridesGroup": false,
  "authScheme": "api_key",
  "status": "not_connected",
  "accountId": null,
  "accountName": null,
  "workspaceId": null,
  "connectedAt": null,
  "updatedAt": null,
  "error": null
}
```

### 400

invalid_request: A parameter is invalid; the message names the problem. Unknown query parameters are rejected. integration_invalid_provider: The integration key does not identify an available integration. integration_connection_not_supported: Built-in integrations have authScheme none and do not need a connection.

#### invalid_request

A parameter is invalid; the message names the problem. Unknown query parameters are rejected.

```json
{
  "statusCode": 400,
  "code": "invalid_request",
  "message": "Unknown query parameter: color"
}
```

#### integration_invalid_provider

The integration key does not identify an available integration.

```json
{
  "statusCode": 400,
  "code": "integration_invalid_provider",
  "message": "Unsupported integration provider 'acme'"
}
```

#### integration_connection_not_supported

Built-in integrations have authScheme none and do not need a connection.

```json
{
  "statusCode": 400,
  "code": "integration_connection_not_supported",
  "message": "Web Access is built in and available without a connection; there is nothing to connect"
}
```

### 401

authentication_required: The Authorization header is missing or empty. invalid_api_key: The API key is invalid or revoked, or the header doesn't use the Bearer scheme.

#### authentication_required

The Authorization header is missing or empty.

```json
{
  "statusCode": 401,
  "code": "authentication_required",
  "message": "Authentication is required"
}
```

#### invalid_api_key

The API key is invalid or revoked, or the header doesn't use the Bearer scheme.

```json
{
  "statusCode": 401,
  "code": "invalid_api_key",
  "message": "The API key is invalid or revoked"
}
```

### 403

ip_not_allowed: The request came from an address outside the workspace's IP allowlist.

#### ip_not_allowed

The request came from an address outside the workspace's IP allowlist.

```json
{
  "statusCode": 403,
  "code": "ip_not_allowed",
  "message": "The source IP address is not allowed by this account's security settings"
}
```

### 404

group_not_found: The group does not exist in your workspace. Create groups from your backend with POST /groups.

#### group_not_found

The group does not exist in your workspace. Create groups from your backend with POST /groups.

```json
{
  "statusCode": 404,
  "code": "group_not_found",
  "message": "Group not found"
}
```

### 500

internal_error: An unexpected server error.

#### internal_error

An unexpected server error.

```json
{
  "statusCode": 500,
  "code": "internal_error",
  "message": "Internal server error"
}
```

## Notes

- A group without a connection to the integration returns status not_connected with nullable account fields.

- needs_reauth means the group should be connected again with a new connect session. Until then, members without a connection of their own can't use the integration.
