---
title: "Authorize a connection"
method: POST
path: "/connections:authorize"
tags: ["dataConnectors"]
---

# Authorize a connection

`POST /connections:authorize`

This method starts the OAuth authorization flow for a data connector. The platform returns an authorization URL. Redirect the user to this URL so they can grant access to their account.

After the user grants or denies access, the platform redirects them to the redirect URI you provided, with the outcome appended to that URI as query parameters. Read these parameters from the redirect that your application receives:

- `connection_id`: The identifier of the new connection, returned on success. Store this value and pass it as the `connection_id` path parameter in later requests.
- `status`: The `ok` value, returned on success.
- `custom_id`: The label you supplied, returned on success when you provided one.
- `error`: An error code, returned instead of the other parameters when the user denies access or the flow fails.

## Headers

- `x-api-key` string, required

## Request body

- object
  - `provider` 'google_drive', required — The data connector provider to authorize.
  - `redirect_uri` string, uri, required — The URI where the user is redirected after granting or denying access. By default, any redirect URI is accepted. If you've authorized specific redirect URIs with the [Register a redirect URI](/v1.3/api-reference/data-connectors/register-a-redirect-uri) method, this URI must be one of them.
  - `custom_id` string — A label you supplied, stored on the connection and returned with it. Use a value that does not identify a person so you can match the connection to your own records.

## Response `200`

The authorization flow has been successfully initiated.

- DataConnectorsAuthorizeConnectionResponse200
  - `authorize_url` string — The URL to redirect the user to so they can grant access.
  - `state` string — A value the platform uses to secure the authorization flow. You do not need to read or send it: the platform includes it in the `authorize_url` field and checks it automatically when the user is redirected back. It is returned only so you can match or troubleshoot requests.

## Other responses

- `400` — The request has failed.

---

[API](https://skmtc.net/twelvelabs/apis/twelvelabs-api.md) · [All operations](https://skmtc.net/twelvelabs/apis/twelvelabs-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/twelvelabs/twelvelabs-api/revisions/a332164b8c23/schema)
