---
canonical_url: "https://docs.composio.dev/reference/api-reference/connected-accounts/postConnectedAccountsCompleteAuth"
markdown_url: "https://docs.composio.dev/reference/api-reference/connected-accounts/postConnectedAccountsCompleteAuth.md"
product: "platform"
version: "3.1"
last_updated: null
---

# Complete a deferred OAuth connection after identity verification

**Documentation:** /reference/api-reference/connected-accounts/postConnectedAccountsCompleteAuth

> **API version:** This page documents Composio REST API v3.1, the current version, at `https://backend.composio.dev/api/v3.1`. `https://backend.composio.dev/api/v3` is the previous version and remains supported.

Redeems a single-use `session_uri` handed to a project's OAuth callback verifier. Composio validates that the caller's project owns the pending connection and that `user_id` matches the connection owner, then completes the token exchange and returns the now-ACTIVE connected account. The session is single-use.

---

## POST `/api/v3.1/connected_accounts/complete_auth`

**Endpoint:** `https://backend.composio.dev/api/v3.1/connected_accounts/complete_auth`

**Summary:** Complete a deferred OAuth connection after identity verification

Redeems a single-use `session_uri` handed to a project's OAuth callback verifier. Composio validates that the caller's project owns the pending connection and that `user_id` matches the connection owner, then completes the token exchange and returns the now-ACTIVE connected account. The session is single-use.

### Authentication

**ApiKeyAuth** - API Key in `header` header `x-api-key`

### Request Body

**Schema:**

- `session_uri` (string) *(required)*: The opaque session URI received on the verifier redirect.
- `user_id` (string) *(required)*: The user this connection was initiated for.

**Example:**

```json
{
  "session_uri": "string",
  "user_id": "string"
}
```

### Responses

#### 200 - The connection was completed and is now ACTIVE.

**Response Schema:**

- `connected_account_id` (string) *(required)*: The connection that was completed.
- `toolkit_slug` (string) *(required)*: The toolkit the connection belongs to.

**Example Response:**

```json
{
  "connected_account_id": "string",
  "toolkit_slug": "string"
}
```

#### 400 - Bad request — missing/malformed field, or identity mismatch (user_id does not match the connection owner).

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 401 - Unauthorized - Authentication failed

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 404 - Session not found, expired, already consumed, or not owned by the caller (masks cross-tenant); or the held authorization expired.

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 500 - Internal server error - Failed to complete the connection.

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

### Example cURL Request

```bash
curl -X POST "https://backend.composio.dev/api/v3.1/connected_accounts/complete_auth" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session_uri": "string",
    "user_id": "string"
  }'
```

---

## REST API version

The current REST API version is **v3.1**, served at `https://backend.composio.dev/api/v3.1`. Prefer it for new code and new examples.

`https://backend.composio.dev/api/v3` is the previous version. It is frozen with pinned tool-version defaults and remains supported — existing v3 integrations keep working and do not need to migrate.