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

Reconnect a connected account

Make a connected account work again, the way it was connected. The secret keeps its name, its hosts and its placement, so nothing that references {{secret:NAME}} changes. For an API-key integration, send the new key as apiKey: Anlyon checks it with the provider the way it checked the first one, replaces the stored value, and answers status: completed with the secret. A key the provider refuses changes nothing (CONNECTION_KEY_REJECTED). For a sign-in integration, send an empty body: Anlyon starts a consent session for the account’s existing connection and answers status: pending with the session. Open its connectUrl or hand its consent values to the console’s window, then call POST /api/v2/connections/sessions/{sessionId}/complete as for a first connect; completing marks the account working again. Sending a key for a sign-in account, or none for a key account, is 400. Counts toward the same limit of 10 per minute per workspace as connect sessions.

POST/api/v2/connections/{secretName}/reconnect
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.

Path parameters
secretNamestringrequired

The connected account, by its secret name.

min length 1 · max length 100 · matches ^[A-Z0-9_]+$
Header parameters
X-Request-Idstring

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

max length 128
Request body
application/json
apiKeystring

For an API-key integration: the new key alone, with no spaces or line breaks. Checked with the provider, stored encrypted, and never returned. Omit for a sign-in integration.

min length 8 · max length 4096 · matches ^[\x21-\x7e]+$
Responses
200

The new key was accepted and stored (completed)

successbooleanrequired
Allowed:true
dataConnectionReconnectrequired

How the reconnect went. completed: a new key was accepted and stored; secret is the account as it now stands. pending: a consent session was started for a signed-in account; finish it with POST /api/v2/connections/sessions/{sessionId}/complete.

Show properties
statusstringrequired
Allowed:completedpending
secretSecret | nullrequired

The reconnected account once completed; null while pending.

Show properties
Any of:
Secret
idstringrequired
namestringrequired
matches ^[A-Z0-9_]+$
descriptionstring | nullrequired
allowedHostsstring[] | nullrequired

Hosts this secret may be sent to. Null means any public host.

allowedPlacementsstring[] | nullrequired

Where in the request this secret may appear. Null means anywhere.

kindstringrequired

static holds a value you stored. connection is a connected account: its value is an access token fetched at dispatch, its hosts come from the integration, and it may only appear in a header. PUT cannot change a secret's kind.

Allowed:staticconnection
connectionobject | nullrequired

For a signed-in account, which integration it is and whether it still works. status mirrors health.status, which is the one record of it for both kinds of connected account. Null for a static secret, including one connected with an API key.

Show properties
integrationIdstringrequired
statusstringrequired

The same value as health.status. Reconnect the account to use it again.

Allowed:activeneeds_reauth
healthobject | nullrequired

Whether the connected account still works, whichever way it was connected. active, or needs_reauth with a reason once the provider refused the credential or the connector service could not refresh it. A dispatch that uses a needs_reauth account fails before anything is sent. Reconnect it with POST /api/v2/connections/{secretName}/reconnect. Null for a secret you stored directly, which Anlyon cannot check.

Show properties
statusstringrequired
Allowed:activeneeds_reauth
checkedAtstring<date-time> | nullrequired

When Anlyon last asked the provider whether the credential works. Null when it never has.

reasonstring | nullrequired

Set while status is needs_reauth. key_rejected: the provider refused the stored key. access_revoked: the provider no longer honours the signed-in account's grant. refresh_failed: the connector service could not refresh its token.

Allowed:key_rejectedaccess_revokedrefresh_failednull
integrationIdstring | nullrequired

The integration this secret was connected for, by signing in or with an API key. Null for a secret you stored directly. A secret connected with an API key is static with this set.

lastUsedAtstring<date-time> | nullrequired
createdAtstring<date-time>required
updatedAtstring<date-time>required
null
null
sessionConnectSession | nullrequired

The consent session to finish, for a signed-in account; null once completed.

Show properties
Any of:
ConnectSession
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.

null
null
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
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
422

The provider did not accept the new key (CONNECTION_KEY_REJECTED). Nothing changed.

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

The account is signed in and 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 new key could not be checked (CONNECTION_KEY_CHECK_FAILED), or the connected-account service did not answer (CONNECTION_PROVIDER_ERROR). Nothing changed.

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/string/reconnect' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "apiKey": "the-new-key-you-created-at-the-provider"
}'
Response
{
  "success": true,
  "data": {
    "status": "completed",
    "secret": {
      "id": "sec_01JABCDEF",
      "name": "string",
      "description": "string",
      "allowedHosts": [
        "string"
      ],
      "allowedPlacements": [
        "url"
      ],
      "kind": "static",
      "connection": {
        "integrationId": "hubspot",
        "status": "active"
      },
      "health": {
        "status": "active",
        "checkedAt": "2019-08-24T14:15:22Z",
        "reason": "key_rejected"
      },
      "integrationId": "github",
      "lastUsedAt": "2019-08-24T14:15:22Z",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z"
    },
    "session": {
      "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"
        ]
      }
    }
  }
}