# Get a connect session

> Page: https://docs.flung.dev/reference/api/get-v1-connect-sessions-id. Index of every page: https://docs.flung.dev/llms.txt

Poll this after sending the person to `authorizationUrl` until `status` is no longer `pending`.

`GET /v1/connect-sessions/{id}`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Get a connect session. |
| What does it need? | An API key, an OAuth access token, or a connect token (this is one of the calls a connect token may make). |
| What does it take? | `id` in the path. |
| What does it return? | Status 200 with a body of type [`ConnectSession`](https://docs.flung.dev/reference/api/schemas.md#connectsession). |
| In the SDK? | `flung.connectSessions.get()` |
| As an MCP tool? | [`get_connect_session`](https://docs.flung.dev/reference/mcp/get-connect-session.md) |
| What can go wrong? | `401` Missing, unknown, revoked or expired API key; `404` No such session in this workspace, or it ended more than a week ago; `422` The request failed validation; `429` Too many requests for this credential; wait for `retry-after` seconds. Every failure has the same [error shape](https://docs.flung.dev/reference/api/errors.md). |

## Example

**curl**

```bash
curl -X GET 'https://api.flung.dev/v1/connect-sessions/cs_aaaaaaaaaaaaaaaaaaaaaaaa' \
  --header "Authorization: Bearer $FLUNG_API_KEY"
```

**TypeScript**

```ts
import { Flung } from '@flung.dev/sdk'

const flung = new Flung({ apiKey: process.env.FLUNG_API_KEY! })
const result = await flung.connectSessions.get({
  id: 'cs_aaaaaaaaaaaaaaaaaaaaaaaa',
})
```

**fetch**

```js
const response = await fetch('https://api.flung.dev/v1/connect-sessions/cs_aaaaaaaaaaaaaaaaaaaaaaaa', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${process.env.FLUNG_API_KEY}`,
  },
})
if (!response.ok) throw new Error((await response.json()).error.message)
const result = await response.json()
```

A successful answer looks like this:

```json
{
  "id": "cs_aaaaaaaaaaaaaaaaaaaaaaaa",
  "platform": "x",
  "accountId": "string",
  "status": "pending",
  "authorizationUrl": "https://example.com",
  "expiresAt": "2026-11-01T09:00:00.000Z",
  "accountIds": [
    "string"
  ],
  "error": {
    "code": "string",
    "message": "string"
  },
  "createdAt": "2026-11-01T09:00:00.000Z",
  "completedAt": "2026-11-01T09:00:00.000Z"
}
```

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes |  |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | The session. | [`ConnectSession`](https://docs.flung.dev/reference/api/schemas.md#connectsession) |
| 401 | Missing, unknown, revoked or expired API key. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |
| 404 | No such session in this workspace, or it ended more than a week ago. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |
| 422 | The request failed validation. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |
| 429 | Too many requests for this credential; wait for `retry-after` seconds. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |

## Response body

A 200 answer has the type [`ConnectSession`](https://docs.flung.dev/reference/api/schemas.md#connectsession).

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes |  |
| `platform` | `Platform` | yes |  |
| `accountId` | `string \| null` | yes | The account being reconnected; null for a new connection. |
| `status` | `"pending" \| "connected" \| "failed" \| "expired"` | yes | `pending` until the person finishes on the platform; `expired` when they did not by `expiresAt`. |
| `authorizationUrl` | `string \| null` | yes | Send the person here: the platform's own consent page. Null once the session has ended. |
| `expiresAt` | `string` | yes | The person must finish by then. |
| `accountIds` | `string[]` | yes | The accounts stored, once `connected`. Facebook connects one per page. |
| `error` | `object \| null` | yes | Why it `failed`: `access_denied`, `wrong_account`, `platform_error` and so on. |
| `error.code` | `string` | yes |  |
| `error.message` | `string` | yes |  |
| `createdAt` | `string` | yes |  |
| `completedAt` | `string \| null` | yes |  |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.flung.dev/reference/api.md) | Every endpoint |
| [Schemas](https://docs.flung.dev/reference/api/schemas.md) | Every request and response type |
| [Errors](https://docs.flung.dev/reference/api/errors.md) | Every error code and what to do about it |
| [`get_connect_session`](https://docs.flung.dev/reference/mcp/get-connect-session.md) | The same operation as an MCP tool |
