Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview

Start a connect session

Start the consent flow for one integration whose auth.kind is oauth. An api_key integration is refused here; send its key to POST /api/v2/connections/keys. Open connectUrl in a browser, or hand the consent values to the console’s consent window. The session expires after 15 minutes. At most 10 sessions may be started per minute per workspace. The secret name must not exist yet in this environment.

POST/api/v2/connections/sessions
Authorization
AuthorizationBearer token (Anlyon API key) · headerrequired

Workspace API key sent as Authorization: Bearer <key>.

or
better-auth.session_tokenAPI key · cookierequired

Browser session used by dashboard-only operations.

Header parameters
X-Request-Idstring

Optional caller correlation ID. Unsafe or oversized values are replaced.

max length 128
Request body
requiredapplication/json
integrationIdstringrequired
max length 64 · matches ^[a-z0-9-]+$
secretNamestringrequired

The secret the connected account becomes; actions reference it as {{secret:NAME}}.

min length 1 · max length 100 · matches ^[A-Z0-9_]+$
descriptionstring
max length 500
Responses
201

Session started.

successbooleanrequired
Allowed:true
dataConnectSessionrequired
Show properties
sessionIdstringrequired
sessionTokenstringrequired

Opaque token for the consent window. Valid for this session only.

expiresAtstring<date-time>required
connectUrlstring<uri>required

Open in a browser to run the consent flow.

consentobjectrequired

What a consent window opened from the console needs.

Show properties
originstring<uri>required
websocketsPathstringrequired
keystringrequired

Opaque key naming the consent flow for this integration.

integrationConnectionIntegrationrequired

An integration an account can be connected for.

Show properties
idstringrequired

Stable id used in sessions and pack manifests.

namestringrequired
authobjectrequired

How an account is connected. oauth: start a connect session and sign in at the provider. api_key: create a key in the provider's own settings, following instructions, and send it to POST /api/v2/connections/keys.

Show properties
kindstringrequired
Allowed:oauthapi_key
instructionsstring

For api_key: where in the provider's settings the key is created, and with which permissions.

instructionsUrlstring<uri>

For api_key: the provider's own page for creating the key.

hostsstring[] | nullrequired

The API hosts the token may be sent to. Null when they come from the connected account itself (see hostsFromAccount).

hostsFromAccountbooleanrequired

True when the API host is the account's own (a Salesforce instance) and is fixed at connect time.

scopesstring[]required

The scopes requested at the provider's consent page. Empty for an api_key integration, whose access is whatever the key was given.

operationsPackstring | nullrequired

The pack whose actions are this integration's operations: what an agent may be allowed to do once the account is connected.

workflowPacksstring[]required

Workflow packs that use this integration together with others.

400

Bad Request - Invalid input data

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
401

Unauthorized - Invalid or missing API key

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
402

Payment Required - Usage quota exceeded

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
403

Authenticated credential lacks the required scope or workspace access.

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
404

Not Found - Resource does not exist

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
409

The request conflicts with current resource state or a concurrent decision.

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
429

Too Many Requests - Rate limit exceeded

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
501

Connected accounts are not configured on this deployment (CONNECTIONS_UNAVAILABLE).

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
502

The connected-account service did not answer (CONNECTION_PROVIDER_ERROR). Nothing was created.

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'https://api.anlyon.com/api/v2/connections/sessions' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "integrationId": "hubspot",
  "secretName": "HUBSPOT",
  "description": "string"
}'
Response
{
  "success": true,
  "data": {
    "sessionId": "csn_4f9a1c2b7d8e0f3a",
    "sessionToken": "string",
    "expiresAt": "2019-08-24T14:15:22Z",
    "connectUrl": "http://example.com",
    "consent": {
      "origin": "https://connect.anlyon.com",
      "websocketsPath": "/ws",
      "key": "string"
    },
    "integration": {
      "id": "hubspot",
      "name": "HubSpot",
      "auth": {
        "kind": "oauth",
        "instructions": "string",
        "instructionsUrl": "http://example.com"
      },
      "hosts": [
        "string"
      ],
      "hostsFromAccount": true,
      "scopes": [
        "string"
      ],
      "operationsPack": "anlyon/hubspot",
      "workflowPacks": [
        "string"
      ]
    }
  }
}