Withdraw a sent connection invitation
Withdraws a pending connection invitation that was previously sent to a LinkedIn user. Only the profileId is required - other fields will be auto-fetched from the profile if not provided. The API will verify that a pending invitation exists before attempting withdrawal.
/invitations/withdrawCode Examples
curl -X POST 'https://api.connectsafely.ai/linkedin/invitations/withdraw' \ -H 'Authorization: Bearer <your_api_key>' \ -H 'Content-Type: application/json' \ -d '{"accountId":"acc_12345","profileId":"john-doe-123","memberId":"12345","firstName":"example_value","lastName":"example_value","invitationId":"12345"}'Parameters
No parameters.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | No | LinkedIn account ID to use. If not provided, uses the default account. |
profileId | string | Yes | LinkedIn profile vanity URL slug (the part after linkedin.com/in/) of the person whose invitation to withdraw. This is the only required field. Either profileId or profileUrn must be provided. |
memberId | string | No | LinkedIn member ID (ACoAAA format). Optional - will be auto-fetched from profile if not provided. |
firstName | string | No | First name of the person. Optional - will be auto-fetched from profile if not provided. |
lastName | string | No | Last name of the person. Optional - will be auto-fetched from profile if not provided. |
profileUrn | string | Conditional | LinkedIn profile URN. Optional - will be auto-fetched from profile if not provided. Either profileUrn or profileId must be provided. |
invitationId | string | No | LinkedIn invitation ID. Optional - will be auto-fetched from profile if not provided. |
Example
{
"profileId": "johndoe"
}Responses
| Status | Description |
|---|---|
| 200 | Invitation withdrawn successfully |
| 400 | Bad request - no pending invitation found or missing required fields |
| 401 | Unauthorized - invalid or missing authentication |
| 404 | Profile not found |
| 500 | Server error while withdrawing invitation |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | Whether the withdrawal was successful |
message | string | Success or error message |
accountId | string | LinkedIn account ID used for the request |
200 Example
{
"success": true,
"message": "Successfully withdrew invitation to John Doe",
"accountId": "696ce9e780e0483585e4e553"
}400 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string | |
success | boolean | |
profile | object | Profile information when no pending invitation exists |
400 Example
{
"error": "No pending invitation found for this profile",
"success": false,
"profile": {
"firstName": "John",
"lastName": "Doe",
"profileId": "johndoe",
"isConnected": false,
"invitationReceived": false
}
}401 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
401 Example
{
"error": "example_value"
}404 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
404 Example
{
"error": "Profile not found",
"success": false
}500 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
500 Example
{
"error": "example_value"
}Accept or ignore a received invitation
Accepts or ignores a received invitation on LinkedIn. Works for all invitation types: connection requests, organization follows, newsletter subscriptions, and events. Use the data from GET /invitations/received to populate the required fields.
Check relationship status with profile
Check the relationship between your default LinkedIn account and a target profile. Returns connection status (1st, 2nd, 3rd degree), whether you follow them, and if you are connected. Useful for determining which actions are available (message, connect, etc.).
