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.
| Field | Type | Required | Description |
|---|---|---|---|
completion | object | No | Post-connection behavior of the connection page |
The SDK's createConnectionSession takes no parameters, so it always creates a session with the default completion screen. To pass completion, call the HTTP endpoint.
linkedin admin accounts connect sends no body, so it always creates a session with the default completion screen. To pass completion, call the HTTP endpoint.
Response:
{
"success": true,
"result": {
"sessionId": "990eef7a-...",
"connectionLink": "https://app.linkedapi.io/connection/990eef7a-..."
}
}| Field | Type | Description |
|---|---|---|
sessionId | string | Session UUID for tracking |
connectionLink | string | URL to open in a browser to complete the LinkedIn login |
Errors:
| Type | Description |
|---|---|
subscriptionRequired | No subscription with a seat yet – buy seats with subscription.setSeats first |
noAvailableSeats | No available seats – all seats are occupied by active accounts or pending connection sessions |
dailyConnectionAttemptsExceeded | Too many connection attempts in the last 24 hours |
invalidRequestPayload | The completion object is malformed – the message names the offending field |
Flow: Create session → open
connectionLink→ user logs into LinkedIn → pollaccounts.getConnectionSessionuntil status issuccess→ account appears inaccounts.getAll.
The whole flow over HTTP – create the session, check it until it leaves the in-progress statuses, then read the accounts:
The whole flow with the SDK – create the session, poll it until it leaves the in-progress statuses, then read the accounts:
The same flow in the CLI. connect only creates the session and prints sessionId and connectionLink – it neither opens the link nor waits, so check the session yourself:
# 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:
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | UUID of the account to reconnect |
completion | object | No | Post-connection behavior of the connection page – see Customizing the completion screen |
The SDK's createReconnectionSession takes only accountId. To pass completion, call the HTTP endpoint.
linkedin admin accounts reconnect sends only accountId. To pass completion, call the HTTP endpoint.
Response:
{
"success": true,
"result": {
"reconnectionSessionId": "d90ac1f6-...",
"reconnectionLink": "https://app.linkedapi.io/connection/d90ac1f6-..."
}
}| Field | Type | Description |
|---|---|---|
reconnectionSessionId | string | Session UUID for tracking |
reconnectionLink | string | URL to open in a browser to complete LinkedIn reconnection |
Errors:
| Type | Description |
|---|---|
invalidRequestPayload | The account is not in reconnection_required status or cannot be reconnected |
Flow: Create reconnection session → open
reconnectionLink→ user logs into LinkedIn → pollaccounts.getConnectionSessionwithreconnectionSessionIduntil status issuccess.
The same flow in the CLI:
# 1. Find accounts that require reconnection – they carry a reconnectionLink
linkedin admin accounts list
# 2. Create a fresh reconnection session if you need to replace the link
linkedin admin accounts reconnect <accountId>
# 3. Open the printed reconnectionLink, complete the LinkedIn login, then check the session
linkedin admin accounts session <reconnectionSessionId> --jsonaccounts.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:
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Session UUID |
Response:
{
"success": true,
"result": {
"session": {
"sessionId": "990eef7a-...",
"status": "pending",
"type": "initial"
}
}
}Session statuses:
| Status | Description |
|---|---|
pending | Session created, waiting for user to open the link |
preparing | Browser is being provisioned |
serving | Browser is ready, waiting for user to connect |
streaming | User is connected and logging in |
success | Login completed, account is being created |
expired | Session timed out |
error | An error occurred |
cancelled | Session 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:
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Session UUID |
Response:
{
"success": true,
"result": {}
}