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. Where neither the environment’s own OAuth app nor Anlyon’s app on this deployment can sign in to the integration (the list marks it ownOAuthAppRequired), the answer is 400 OWN_OAUTH_APP_REQUIRED: add the environment’s own app with PUT /api/v2/environments/{environmentId}/oauth-apps/{integration}.

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

The consent token in connectUrl. Whoever holds it can sign in for this session until it expires, so treat it like the link.

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

Open in a browser to sign in at the provider. Then poll complete.

integrationConnectionIntegrationrequired

An integration an account can be connected for.

Show properties
ownOAuthAppRequiredboolean

Present on a sign-in integration whose OAuth app this deployment does not have: it is connected through the environment's own app (PUT /api/v2/environments/{environmentId}/oauth-apps/{integration}), and until that is set a connect session or link answers 400 OWN_OAUTH_APP_REQUIRED. Absent otherwise.

Allowed:true
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. An integration that signs in and also takes a key (GitHub, Notion) is oauth with apiKey set where signing in works here, and api_key where it does not.

Show properties
kindstringrequired
Allowed:oauthapi_key
apiKeyobject

For oauth: the key that may be sent to POST /api/v2/connections/keys instead of signing in. Absent for an integration that only signs in.

Show properties
instructionsstringrequired

Where in the provider's settings the key is created, and with which permissions.

instructionsUrlstring<uri>required

The provider's own page for creating the key.

fieldsobject[]

As fields below, for a key made of several values.

Show properties
Array of object
namestringrequired
labelstringrequired
secretbooleanrequired
kindstringrequired
Allowed:accountcredential
hintstring
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.

fieldsobject[]

For api_key, when the key is several values (an email and an API token) or the host is the account's own (a subdomain): what to ask for, in order. Send them as fields instead of apiKey. Every value is stored encrypted and never returned.

Show properties
Array of object
namestringrequired
labelstringrequired
secretbooleanrequired

Mask it in a form.

kindstringrequired

account names the account's own host (see hostTemplate); credential is part of the key.

Allowed:accountcredential
hintstring
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, a Zendesk subdomain) and is fixed at connect time.

hostTemplatestring

For an API-key integration whose host is the account's own: the one host shape it may be. The account field fills it; anything outside it is refused.

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
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

401

Unauthorized - Invalid or missing API key

successbooleanrequired
requestIdstringrequired

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

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

402

Payment Required - Usage quota exceeded

successbooleanrequired
requestIdstringrequired

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

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

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
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

404

Not Found - Resource does not exist

successbooleanrequired
requestIdstringrequired

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

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

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
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

429

Too Many Requests - Rate limit exceeded. A workspace's API requests are limited per minute and per UTC clock hour by plan; Retry-After says when to try again, and an hourly refusal names the limit and when the count resets. Successful responses carry the same limits in X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (the minute) and X-RateLimit-Limit-Hour, X-RateLimit-Remaining-Hour, X-RateLimit-Reset-Hour (the hour).

successbooleanrequired
requestIdstringrequired

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

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

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
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

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
fixErrorFix

How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.

Show properties
summarystringrequired

One sentence that says what to do.

commandstring

An exact anlyon CLI command that fixes it. Absent when no command does.

urlstring<uri>

An absolute console link where a person fixes it.

docsstring<uri>

A docs page that explains it.

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 'Accept: application/json' \
  -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": "https://api.anlyon.com/api/v2/connection-consent/start?token=cst_9Qm2",
    "integration": {
      "ownOAuthAppRequired": true,
      "id": "hubspot",
      "name": "HubSpot",
      "auth": {
        "kind": "oauth",
        "apiKey": {
          "instructions": "string",
          "instructionsUrl": "http://example.com",
          "fields": [
            {
              "name": "string",
              "label": "string",
              "secret": true,
              "kind": "account",
              "hint": "string"
            }
          ]
        },
        "instructions": "string",
        "instructionsUrl": "http://example.com",
        "fields": [
          {
            "name": "apiToken",
            "label": "API token",
            "secret": true,
            "kind": "account",
            "hint": "string"
          }
        ]
      },
      "hosts": [
        "string"
      ],
      "hostsFromAccount": true,
      "hostTemplate": "{subdomain}.zendesk.com",
      "scopes": [
        "string"
      ],
      "operationsPack": "anlyon/hubspot",
      "workflowPacks": [
        "string"
      ]
    }
  }
}

Was this page helpful?