---
# @generated by sylphx-gen. Do not edit.
title: "Begin oauth2 authorization on a connection provider"
description: "`connections.connection_providers.begin_oauth2_authorization` (POST /v1/{name}:beginOauth2Authorization): Begins an expiring hosted OAuth 2.0 authorization ceremony for an OAuth 2.0 ConnectionProvider."
type: reference
product: platform
summary: "Begins an expiring hosted OAuth 2.0 authorization ceremony for an OAuth 2.0 ConnectionProvider."
updated: 2026-09-28
nav: false
---

Begins an expiring hosted OAuth 2.0 authorization ceremony for an OAuth 2.0 ConnectionProvider. Returns an authorization_url carrying an expiring one-use state token handled by GET /v1/connections/oauth2:callback.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/connection_providers/connection-provider:beginOauth2Authorization`
- **Scope** `connections:write`
- **Effect** `write` — a successful call changes state.
- **Collection** [connection_providers](/docs/api/connection_providers)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | OAuth 2.0 ConnectionProvider resource name. Required. |
| `connection_id` | `string` | Target Connection id to create or reauthorize on callback; server-assigned when empty. |
| `post_authorize_redirect_uri` | `string` | Optional HTTPS redirect destination after callback completion. |
| `scopes` | `string[]` | Optional scopes overriding the provider defaults. |
| `extra_authorize_params` | `map<string, string>` | Additional per-request query parameters appended to `authorize_url`. |
| `provider_metadata` | `map<string, string>` | Optional non-secret metadata persisted onto the resulting Connection. |
| `external_account_id` | `string` | Optional non-secret external account id recorded on creation. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `authorization_url` | `string` | Full authorization URL to open in a browser; carries a one-use expiring state. |
| `callback_url` | `string` | Hosted callback URL handled by Sylphx Connections. |
| `expire_time` | `timestamp` | When the authorization state expires (ten minutes after begin). |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`INVALID_FIELD`](/docs/api/errors/INVALID_FIELD) — A field failed validation.
- [`INVALID_STATE`](/docs/api/errors/INVALID_STATE) — The Resource is in a state that forbids the call.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`RESOURCE_ALREADY_EXISTS`](/docs/api/errors/RESOURCE_ALREADY_EXISTS) — A Resource with this name exists.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/connection_providers/connection-provider:beginOauth2Authorization" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

**TypeScript**

```ts
const response = await sylphx.connections.connectionProviders.beginOauth2Authorization({ name: 'orgs/acme/connection_providers/connection-provider' })
```

**Rust**

```rust
let mut req = sylphx::connections::BeginOauth2AuthorizationRequest::default();
req.name = "orgs/acme/connection_providers/connection-provider".to_string();
let response = sx.connections().connection_providers().begin_oauth2_authorization(req).await?;
```

**CLI**

```bash
sylphx connections connection-providers begin-oauth2-authorization orgs/acme/connection_providers/connection-provider
```

**MCP**

```json
{ "method_id": "connections.connection_providers.begin_oauth2_authorization", "args": {"name":"orgs/acme/connection_providers/connection-provider"} }
```
