Start the authorization of a Connection
POST /v1/connections/{connection_id}/authorize
| Property | Value |
|---|---|
| Operation | authorize_connection |
| Group | Connections |
| Scope | integrations:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited integrations.connection.authorize (mutation) |
| Released in | 1.60.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Answers the vendor's authorization URL for the Member's browser (1.60.0; integrations.md section 7): PKCE (S256), a single-use state valid 10 minutes (a target) bound to the Organization, the Member and the Connection, and the scopes of enabled_tools, nothing more. Session only: every API key is refused with forbidden, and a Member who is neither an owner nor an admin with the detail owner_or_admin_required. A Connection whose strategy is not OAuth is validation_failed with connection_not_authorizable. The edge role's callback completes the exchange; the Connection becomes active and writes connection.authorized.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the integrations:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/connections/con_.../authorize" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"const response = await fetch(`${process.env.VOCAL_API}/v1/connections/con_.../authorize`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
},
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/connections/con_.../authorize",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
connection_id | path | ConnectionId | yes | The id of a Connection: con_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | ConnectionAuthorization | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | connection_revoked, idempotency_in_progress, idempotency_key_reused |
422 | application/json | ErrorEnvelope | validation_failed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is ConnectionAuthorization.
| Field | Type | Required | Description |
|---|---|---|---|
authorization_url | string (uri) | yes | The vendor's authorization URL with PKCE (S256), the single-use state and the requested scopes, to open in the Member's browser. |
connection_id | ConnectionId | yes | |
expires_at | Timestamp | yes | When the state stops being accepted: 10 minutes after issue (a target). |
object | "connection_authorization" | yes | |
scopes | array of VendorScope | yes |