> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeus.agentspro.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# OAuth Token Exchange

> Exchange an authorization code for an OAuth access token

Exchanges an OAuth authorization code for an access token. This endpoint **does not require JWT authentication** since it is used during the OAuth callback flow.

### Supported Providers

| Provider       | Description  | Environment Variables                       |
| -------------- | ------------ | ------------------------------------------- |
| `github`       | GitHub OAuth | `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET` |
| `google_drive` | Google Drive | `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET` |
| `gmail`        | Gmail        | `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET` |
| `slack`        | Slack        | `SLACK_CLIENT_ID` / `SLACK_CLIENT_SECRET`   |
| `notion`       | Notion       | `NOTION_CLIENT_ID` / `NOTION_CLIENT_SECRET` |

<ParamField body="provider" type="string" required>
  OAuth provider: `github` | `google_drive` | `gmail` | `slack` | `notion`
</ParamField>

<ParamField body="code" type="string" required>
  OAuth authorization code
</ParamField>

<ParamField body="redirect_uri" type="string" required>
  OAuth callback URL (must match the one used in the authorization request)
</ParamField>

<ResponseField name="access_token" type="string">
  Access token
</ResponseField>

<ResponseField name="refresh_token" type="string">
  Refresh token (provided by some providers)
</ResponseField>

<ResponseField name="expires_at" type="number">
  Expiration timestamp (Unix timestamp, provided by some providers)
</ResponseField>

<ResponseField name="token_type" type="string">
  Token type, typically `Bearer`
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://zeus-api.agentspro.cn/api/tools/oauth/exchange \
    --header 'Content-Type: application/json' \
    --data '{
      "provider": "github",
      "code": "abc123def456",
      "redirect_uri": "https://zeus.agentspro.cn/oauth/callback"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "access_token": "gho_xxxxxxxxxxxx",
    "refresh_token": null,
    "expires_at": null,
    "token_type": "Bearer"
  }
  ```
</ResponseExample>
