Connection Sessions

A connection session is a short-lived link that opens the Linked API connection page, where the end user logs into LinkedIn. Use it to connect a new account or to reconnect one whose LinkedIn session has expired. For the accounts themselves, see Accounts.

accounts.createConnectionSession

Create a new connection session to connect a LinkedIn account. Returns a link that opens the connection page where the user logs into LinkedIn.

curl -X POST https://api.linkedapi.io/admin/accounts.createConnectionSession \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here"

Body:

The body is optional. Send no body at all to get the default behavior, or pass completion to control what the user sees after a successful connection – see Customizing the completion screen.

FieldTypeRequiredDescription
completionobjectNoPost-connection behavior of the connection page

Response:

json
{
  "success": true,
  "result": {
    "sessionId": "990eef7a-...",
    "connectionLink": "https://app.linkedapi.io/connection/990eef7a-..."
  }
}
FieldTypeDescription
sessionIdstringSession UUID for tracking
connectionLinkstringURL to open in a browser to complete the LinkedIn login

Errors:

TypeDescription
subscriptionRequiredNo subscription with a seat yet – buy seats with subscription.setSeats first
noAvailableSeatsNo available seats – all seats are occupied by active accounts or pending connection sessions
dailyConnectionAttemptsExceededToo many connection attempts in the last 24 hours
invalidRequestPayloadThe completion object is malformed – the message names the offending field

Flow: Create session → open connectionLink → user logs into LinkedIn → poll accounts.getConnectionSession until status is success → account appears in accounts.getAll.

The whole flow over HTTP – create the session, check it until it leaves the in-progress statuses, then read the accounts:

# 1. Create the session and open the returned connectionLink in a browser
curl -X POST https://api.linkedapi.io/admin/accounts.createConnectionSession \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here"

# 2. After the user logs into LinkedIn, check the session until status is "success"
curl -X POST https://api.linkedapi.io/admin/accounts.getConnectionSession \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{"sessionId": "<sessionId>"}'

# 3. Verify the account appeared
curl -X POST https://api.linkedapi.io/admin/accounts.getAll \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here"

accounts.createReconnectionSession

Create a new reconnection session for an account whose status is reconnection_required. If the account already has an active reconnection session, it is cancelled and replaced with a new one. If an in-progress reconnection session is applying a pending proxy change, Linked API returns that existing session instead so the proxy change state is preserved.

curl -X POST https://api.linkedapi.io/admin/accounts.createReconnectionSession \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{"accountId": "a91c20f8-..."}'

Body:

FieldTypeRequiredDescription
accountIdstringYesUUID of the account to reconnect
completionobjectNoPost-connection behavior of the connection page – see Customizing the completion screen

Response:

json
{
  "success": true,
  "result": {
    "reconnectionSessionId": "d90ac1f6-...",
    "reconnectionLink": "https://app.linkedapi.io/connection/d90ac1f6-..."
  }
}
FieldTypeDescription
reconnectionSessionIdstringSession UUID for tracking
reconnectionLinkstringURL to open in a browser to complete LinkedIn reconnection

Errors:

TypeDescription
invalidRequestPayloadThe account is not in reconnection_required status or cannot be reconnected

Flow: Create reconnection session → open reconnectionLink → user logs into LinkedIn → poll accounts.getConnectionSession with reconnectionSessionId until status is success.

accounts.getConnectionSession

Check the status of a connection session.

curl -X POST https://api.linkedapi.io/admin/accounts.getConnectionSession \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{"sessionId": "990eef7a-..."}'

Body:

FieldTypeRequiredDescription
sessionIdstringYesSession UUID

Response:

json
{
  "success": true,
  "result": {
    "session": {
      "sessionId": "990eef7a-...",
      "status": "pending",
      "type": "initial"
    }
  }
}

Session statuses:

StatusDescription
pendingSession created, waiting for user to open the link
preparingBrowser is being provisioned
servingBrowser is ready, waiting for user to connect
streamingUser is connected and logging in
successLogin completed, account is being created
expiredSession timed out
errorAn error occurred
cancelledSession was cancelled

accounts.cancelConnectionSession

Cancel an active connection session.

curl -X POST https://api.linkedapi.io/admin/accounts.cancelConnectionSession \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{"sessionId": "990eef7a-..."}'

Body:

FieldTypeRequiredDescription
sessionIdstringYesSession UUID

Response:

json
{
  "success": true,
  "result": {}
}