Get received invitations
Retrieves received invitations from LinkedIn including connection requests, organization follow invites, and newsletter subscriptions. Returns invitation details with category classification (CONNECTION, ORGANIZATION, NEWSLETTER, EVENT, MEMBER_FOLLOW). Supports pagination via startIndex parameter. Paginating clients must 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.
/invitations/receivedCode Examples
curl -X GET 'https://api.connectsafely.ai/linkedin/invitations/received' \ -H 'Authorization: Bearer <your_api_key>'Retrieves received invitations from LinkedIn including connection requests, organization follow invites, and newsletter subscriptions. Returns invitation details with category classification (CONNECTION, ORGANIZATION, NEWSLETTER, EVENT, MEMBER_FOLLOW). Supports pagination via startIndex parameter. Paginating clients must 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.
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 | Pagination start index (0-indexed). Each page returns 10 invitations. |
Request Body
No request body.
Responses
| Status | Description |
|---|---|
| 200 | Received invitations retrieved successfully |
| 401 | Unauthorized - invalid or missing authentication |
| 500 | Server error while fetching received invitations |
| 502 | Received invitations temporarily unavailable — the list came back empty but the account still has pending invitations. Retryable; do NOT treat as the end of the list. Two cases, told apart by which field is present: candidateCount means LinkedIn returned invitation cards we could not read, pendingCount means it returned no cards at all while the account has pending connection requests. |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
invitations | array | |
count | number | Number of invitations returned |
endOfList | boolean | true only when this page is empty AND the page genuinely contained no invitation cards AND the account has no pending connection requests beyond startIndex. Paginate until this is true — never stop on an empty array alone. |
startIndex | number | Current pagination start index |
accountId | string | LinkedIn account ID used |
200 Example
{
"success": true,
"endOfList": false,
"invitations": [
{
"id": "7455891636745551899",
"invitationId": "7455891636745551899",
"invitationUrn": "urn:li:invitation:7455891636745551899",
"memberId": "",
"memberUrn": "",
"invitationType": "RECEIVED",
"invitationCategory": "ORGANIZATION",
"linkedInInvitationType": "GenericInvitationType_ORGANIZATION",
"validationToken": "C712w50Z",
"receivedAt": "2 weeks ago",
"companyName": "ZenX8Studio",
"profile": {
"firstName": "Yash",
"lastName": "Jadhav",
"profileUrl": "https://www.linkedin.com/in/yash-jadhav-a03656326/",
"publicIdentifier": "yash-jadhav-a03656326"
}
},
{
"id": "7455163451166860117",
"invitationId": "7455163451166860117",
"invitationUrn": "urn:li:invitation:7455163451166860117",
"memberId": "",
"memberUrn": "",
"invitationType": "RECEIVED",
"invitationCategory": "NEWSLETTER",
"linkedInInvitationType": "GenericInvitationType_ORGANIZATION",
"validationToken": "EJx1vfKg",
"receivedAt": "2 weeks ago",
"newsletterName": "VAYUZ Insights",
"profile": {
"firstName": "Natalya",
"lastName": "Singh",
"profileUrl": "",
"publicIdentifier": ""
}
},
{
"id": "7455301624689844224",
"invitationId": "7455301624689844224",
"invitationUrn": "urn:li:invitation:7455301624689844224",
"memberId": "ACoAAAYHg8oBNy-PmYu4ZIXcv5yOcNldwpl8lj8",
"memberUrn": "urn:li:fsd_profile:ACoAAAYHg8oBNy-PmYu4ZIXcv5yOcNldwpl8lj8",
"invitationType": "RECEIVED",
"invitationCategory": "CONNECTION",
"linkedInInvitationType": "GenericInvitationType_CONNECTION",
"validationToken": "jywembME",
"receivedAt": "2 weeks ago",
"profile": {
"firstName": "Deepika",
"lastName": "Khare",
"profileUrl": "https://www.linkedin.com/in/deepika-khare/",
"publicIdentifier": "deepika-khare"
}
}
],
"count": 10,
"startIndex": 0,
"accountId": "69da1eacf365891afa0426a4"
}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": "INVITATIONS_UNAVAILABLE",
"error": "Received invitations unavailable: LinkedIn returned 10 invitation cards at startIndex 0 but none could be parsed — their card structure has changed. Retry later — do NOT treat this as the end of the list.",
"startIndex": 0,
"candidateCount": 10,
"accountId": "69da1eacf365891afa0426a4"
}Get sent connection invitations
Retrieves sent connection invitations from LinkedIn. Returns a list of pending invitations with profile information, timestamps, and invitation IDs. Supports pagination via startIndex parameter.
Get user organizations
Fetch all LinkedIn organizations (company pages) the authenticated user has admin or posting access to. Returns organization details including URN, name, logo, follower count, and visitor count. Use the organization URN for posting content as a company or commenting as a company page.
