# Complete Google Sheets OAuth

Consume provider OAuth state and redirect to a clean internal Integrations URL.

## Endpoint

`GET /api/v1/oauth/google-sheets/callback`

## Authentication

| Class | Authentication | Minimum role | API key |
| --- | --- | --- | --- |
| dashboard-session-api | Dashboard session cookie and single-use OAuth state. | session | Not allowed |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `state` | query | `string` | No | — |
| `code` | query | `string` | No | — |
| `picked_file_ids` | query | `string` | No | — |
| `error` | query | `string or null` | No | — |

## Request body

This operation has no request body.

## Example

```bash
curl --request GET 'https://operade.ai/api/v1/oauth/google-sheets/callback?state=PROVIDER_STATE&code=PROVIDER_CODE&picked_file_ids=PROVIDER_FILE' --cookie 'cx_session=YOUR_SESSION_COOKIE'
```

## Responses

| Status | Description | Content |
| --- | --- | --- |
| 4XX | Handled client error | application/json: `ErrorResponse` |
| 303 | Redirect to a clean internal Integrations URL after OAuth succeeds or fails. | No body |

### 4XX application/json response schema

| Field path | Type | Reference | Format | Nullable | Required | Enum | Description |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `$` | `object` | ErrorResponse | — | No | Yes | — | — |
| `error` | `object` | ErrorItem | — | No | Yes | — | — |
| `error.code` | `string` | — | — | No | Yes | — | — |
| `error.details` | `object` | — | — | No | No | — | — |
| `error.message` | `string` | — | — | No | Yes | — | — |

### Response example

HTTP 303
This response has no body.

## Errors

Reviewed common and route-declared errors are summarized here; the list is not exhaustive. Start with the [distributed error index](/docs/reference/api/errors) to find each code's canonical domain page.

| Status | Code | Description |
| --- | --- | --- |
| 401 | `unauthenticated` | Authentication is missing, invalid, or revoked. |

## Related operations

- [Get Google Sheet grant metadata](/docs/api-reference/google-sheets/get-google-sheet-grant-metadata) — `GET /api/v1/workspaces/{workspace_id}/google-sheets/grants/{grant_id}/metadata`
- [List Google Sheets connections](/docs/api-reference/google-sheets/list-google-sheets-connections) — `GET /api/v1/workspaces/{workspace_id}/google-sheets/connections`
- [Revoke a Google Sheets connection](/docs/api-reference/google-sheets/revoke-google-sheets-connection) — `POST /api/v1/workspaces/{workspace_id}/google-sheets/connections/{connection_id}/revoke`
