eavz

Connect

Create connections via the hosted connect flow for OAuth2 and all other authentication types.

Connect

The Connect endpoints provide a hosted connect flow for creating connections across all authentication types (OAuth2, API keys, custom auth). Weavz hosts the entire authorization process — you create a session token, open the connect page, and retrieve the result.

Hosted Connect Flow

POST/api/v1/connect/token

Create a connect session token. Returns a token and a connectUrl that you open in a popup or redirect to start the authorization flow.

Request Body

FieldTypeRequiredDescription
integrationNamestringYesIntegration to connect (e.g., slack, google-sheets)
connectionNamestringYesDisplay name for the resulting connection
externalIdstringYesExternal identifier for the connection (for multi-tenant scoping)
workspaceIdstring (uuid)YesWorkspace to create the connection in
endUserIdstringNoEnd user external ID to associate the connection with
scopestringNoConnection scope: ORGANIZATION, WORKSPACE, or USER

Response

json
{
  "token": "cst_abc123def456",
  "connectUrl": "https://api.weavz.io/connect?token=cst_abc123def456",
  "expiresAt": "2025-01-15T14:30:00.000Z"
}

Example

bash
curl -X POST https://api.weavz.io/api/v1/connect/token \
  -H "Authorization: Bearer wvz_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationName": "google-sheets",
    "connectionName": "Google Sheets",
    "externalId": "tenant_123_gsheets",
    "workspaceId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }'

Open the connectUrl in a popup window or redirect the user to it. The hosted page handles the full OAuth2 consent flow.

Errors

StatusCodeDescription
400NOT_OAUTH2Integration does not support OAuth2
400MISSING_OAUTH2_CONFIGNo OAuth app configured for this integration
404INTEGRATION_NOT_FOUNDIntegration not found
GET/api/v1/connect/session/:sessionId

Retrieve the status and result of a connect session. Poll this endpoint after the user completes (or closes) the connect page.

Path Parameters

FieldTypeDescription
sessionIdstringThe token returned from POST /api/v1/connect/token

Response

json
{
  "status": "completed",
  "connection": {
    "id": "c1d2e3f4-5678-90ab-cdef-1234567890ab",
    "externalId": "tenant_123_gsheets",
    "displayName": "Google Sheets",
    "integrationName": "google-sheets",
    "type": "PLATFORM_OAUTH2",
    "status": "ACTIVE",
    "scope": "ORGANIZATION",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z"
  }
}

Session statuses:

StatusDescription
pendingConnect page not yet opened or user still authorizing
completedAuthorization succeeded, connection field contains the new connection
failedAuthorization failed, error field contains the error message

Example

bash
curl https://api.weavz.io/api/v1/connect/session/cs_abc123def456 \
  -H "Authorization: Bearer wvz_your_api_key"

Errors

StatusCodeDescription
404SESSION_NOT_FOUNDConnect session not found or expired