Send a connection request
Send a connection request to a LinkedIn member to become 1st-degree connections. Optionally include a personalized message (300 character limit). Connection requests with custom messages have higher acceptance rates. Either profileId or profileUrn must be provided. Rate limit: 90 connection requests per week per LinkedIn account (resets every Monday at midnight UTC). Exceeding the limit puts the account on hold for 24 hours.
/connectCode Examples
curl -X POST 'https://api.connectsafely.ai/linkedin/connect' \ -H 'Authorization: Bearer <your_api_key>' \ -H 'Content-Type: application/json' \ -d '{"accountId":"acc_12345","profileId":"john-doe-123","customMessage":"Hello! I would like to connect with you."}'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 | Conditional | Target LinkedIn profile public ID (e.g., "john-doe-123"). Either this or profileUrn is required. Either profileId or profileUrn must be provided. |
profileUrn | string | Conditional | Target LinkedIn profile URN (e.g., "urn:li:fsd_profile:ABC123"). Either this or profileId is required. Either profileUrn or profileId must be provided. |
customMessage | string | No | Personalized connection message (max 300 characters). Leave empty for default request. |
Example
{
"accountId": "acc_12345",
"profileId": "john-doe-123",
"customMessage": "Hi John, I would love to connect with you!"
}Responses
| Status | Description |
|---|---|
| 200 | Connection request sent successfully |
| 400 | Bad request - Missing required fields or already connected |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Profile not found |
| 429 | Rate limit exceeded - Connection requests blocked for 24 hours (other activities remain unaffected) |
Rate Limit Headers
All responses include rate limit information in the headers:
| Header | Description |
|---|---|
X-RateLimit-Action | The action type being rate limited |
X-RateLimit-Limit | Maximum actions allowed per period |
X-RateLimit-Used | Actions used in current period |
X-RateLimit-Remaining | Actions remaining |
X-RateLimit-Reset | ISO 8601 timestamp when limit resets |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
message | string | Status message |
profileUrn | string | LinkedIn URN of the target profile |
200 Example
{
"success": true,
"message": "Connection request sent successfully",
"profileUrn": "urn:li:fsd_profile:ACoAAA24A-MBVEvT49xpVF2gnWrhvmUIPDJshSM"
}400 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
400 Example
{
"error": "Either profileId or profileUrn must be provided",
"success": false
}401 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
401 Example
{
"error": "Unauthorized"
}404 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
404 Example
{
"error": "LinkedIn profile not found: invalid-profile-id",
"success": false
}429 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string | Error message describing the rate limit |
success | boolean | |
holdUntil | string (date-time) | Connection requests blocked until this time |
weeklyReset | string (date-time) | When the weekly limit resets |
429 Example
{
"error": "Connection request limit exceeded: 90/90 used. New connection requests blocked for 24 hours. Other activities (messaging, following, etc.) are not affected.",
"success": false,
"holdUntil": "2024-01-16T10:30:00.000Z",
"weeklyReset": "2024-01-22T00:00:00.000Z"
}Send a LinkedIn message
Send a direct message to a LinkedIn member. Supports regular messages (requires 1st-degree connection) and InMail (for non-connections, requires Premium). Can also send messages in group context. Either recipientProfileId or recipientProfileUrn must be provided. Rate limit: 100 messages per day per LinkedIn account.
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.
