Get connections list
Retrieves the list of LinkedIn connections for the authenticated user. Returns connection details including name, headline, vanity name, and connected date. Paginate with `nextStartIndex`, never by your requested `limit`. LinkedIn serves a fixed page size of its own choosing; `limit` can narrow that page but never widen it, so advancing by the limit you asked for skips whatever you did not get. Stop on `endOfList: true`, not on an empty array — an empty page with HTTP 502 / `code: CONNECTIONS_UNAVAILABLE` means LinkedIn temporarily returned nothing and the request should be retried.
/connectionsCode Examples
curl -X GET 'https://api.connectsafely.ai/linkedin/connections' \ -H 'Authorization: Bearer <your_api_key>'Retrieves the list of LinkedIn connections for the authenticated user. Returns connection details including name, headline, vanity name, and connected date.
Paginate with nextStartIndex, never by your requested limit. LinkedIn serves a fixed page size of its own choosing; limit can narrow that page but never widen it, so advancing by the limit you asked for skips whatever you did not get.
Stop on endOfList: true, not on an empty array — an empty page with HTTP 502 / code: CONNECTIONS_UNAVAILABLE means LinkedIn temporarily returned nothing and the request should be retried.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
accountId | query | No | string | LinkedIn account ID to use. If not provided, uses the default account. |
startIndex | query | No | number | Starting index for pagination (0-indexed), counted in connections. Advance using nextStartIndex from the previous response, never by your requested limit — see limit. |
limit | query | No | number | Upper bound on how many connections to return. LinkedIn serves a fixed page (10 today) and offers no page-size control, so limit can only NARROW that page — asking for 12 returns 10. Read count for what you actually got and nextStartIndex for where to continue. |
sortBy | query | No | string | Sort order for connections. Options: recentlyAdded (default), firstName, lastName. |
Request Body
No request body.
Responses
| Status | Description |
|---|---|
| 200 | Connections list retrieved successfully |
| 401 | Unauthorized - invalid or missing authentication |
| 500 | Server error while fetching connections |
| 502 | Connections list temporarily unavailable — LinkedIn returned no connections at this startIndex even though the account has more. Retryable; do NOT treat as the end of the list. |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
connections | array | |
count | number | Number of connections actually returned on this page |
served | number | Cards LinkedIn put on this page, including any we could not read. served \> count means a connection was dropped and is NOT in this page — the pagination offset stays correct, but that person is missing from the list. Report it if you see it. |
endOfList | boolean | true only when this page is empty AND the account has no connections beyond startIndex (verified against the exact connection count). Paginate until this is true — never stop on an empty array alone. |
startIndex | number | Starting index used for this request |
nextStartIndex | number | startIndex for the next page: where this page ended (startIndex + served). Use this and nothing else to advance — deriving the next offset from your requested limit, or from count, repeats or skips records. Until 2026-10-09 this was startIndex + count, so a page whose cards we could not all read advanced one position short and the next page re-served a row; if you cached an older walk, re-run it. |
limit | number | Number of items requested |
sortBy | string | Sort order applied to connections |
accountId | string | LinkedIn account ID used for the request |
200 Example
{
"success": true,
"endOfList": false,
"connections": [
{
"firstName": "John",
"lastName": "Doe",
"vanityName": "johndoe",
"headline": "CEO | Entrepreneur | Tech Founder",
"connectedDate": "Connected on Feb 15, 2024",
"profileUrl": "https://www.linkedin.com/in/johndoe/"
},
{
"firstName": "Jane",
"lastName": "Smith",
"vanityName": "janesmith",
"headline": "VP of Engineering at TechCorp",
"connectedDate": "Connected on Jan 10, 2024",
"profileUrl": "https://www.linkedin.com/in/janesmith/"
}
],
"startIndex": 0,
"limit": 10,
"sortBy": "recentlyAdded",
"accountId": "696ce9e780e0483585e4e553"
}401 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
401 Example
{
"error": "example_value"
}500 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
500 Example
{
"error": "example_value"
}502 Example
{
"success": false,
"code": "CONNECTIONS_UNAVAILABLE",
"error": "Connections list unavailable: LinkedIn returned no connections at startIndex 3324 but the account has 3419. Retry later — do NOT treat this as the end of the list.",
"startIndex": 3324,
"connectionCount": 3419,
"accountId": "696ce9e780e0483585e4e553"
}LinkedIn User API
Manage your LinkedIn network via API. Retrieve connections, sent invitations, organizations, and profile visitor data programmatically.
Get sent connection invitations
Retrieves sent connection invitations from LinkedIn. Returns a list of pending invitations with profile information, timestamps, and invitation IDs. Paginate with `nextStartIndex`, never by a page size of your own. LinkedIn picks the page size and has changed it under us; a client that advances by an assumed constant skips whatever the difference is, silently, on a 200. Stop on `endOfList: true`, not on an empty array — an empty page with HTTP 502 / `code: INVITATIONS_UNAVAILABLE` means LinkedIn temporarily returned nothing while the account still has pending invitations, and the request should be retried.
