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.
/messageCode Examples
curl -X POST 'https://api.connectsafely.ai/linkedin/message' \ -H 'Authorization: Bearer <your_api_key>' \ -H 'Content-Type: application/json' \ -d '{"accountId":"acc_12345","recipientProfileId":"john-doe-123","message":"Hello! I would like to connect with you.","subject":"Quick question about your work","messageType":"normal","groupId":"12345678"}'Parameters
No parameters.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | No | LinkedIn account ID to use. If not provided, uses the default account. |
recipientProfileId | string | Conditional | Recipient LinkedIn profile public ID (e.g., "john-doe-123"). Either this or recipientProfileUrn is required. Either recipientProfileId or recipientProfileUrn must be provided. |
recipientProfileUrn | string | Conditional | Recipient LinkedIn profile URN (e.g., "urn:li:fsd_profile:ABC123"). Either this or recipientProfileId is required. Either recipientProfileUrn or recipientProfileId must be provided. |
message | string | Yes | Message content to send. Supports basic formatting. |
subject | string | No | Subject line (required for InMail, optional for regular messages) |
messageType | string | No | Message type: normal (1st-degree connections) or inmail (non-connections, requires Premium credits) |
groupId | string | No | Group ID to send message in group context (enables messaging non-connections who are group members) |
Example
{
"accountId": "acc_12345",
"recipientProfileId": "john-doe-123",
"message": "Hello! I would like to connect with you.",
"messageType": "normal"
}Responses
| Status | Description |
|---|---|
| 200 | Message sent successfully |
| 400 | Bad request - Missing required fields |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Recipient profile not found |
| 429 | Rate limit exceeded |
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 |
recipientProfileUrn | string | LinkedIn URN of the recipient |
200 Example
{
"success": true,
"message": "Message sent successfully",
"recipientProfileUrn": "urn:li:fsd_profile:ACoAAA24A-MBVEvT49xpVF2gnWrhvmUIPDJshSM"
}400 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
400 Example
{
"error": "Either recipientProfileId or recipientProfileUrn is required",
"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 | |
success | boolean |
429 Example
{
"error": "Rate limit exceeded for MESSAGE: 100/100 used. Resets at 2024-01-16T00:00:00.000Z",
"success": false
}Follow or unfollow a LinkedIn profile
Follow or unfollow a LinkedIn member to see their posts in your feed. Following does not require a connection. Provide either profileId (public identifier) or profileUrn (internal URN). Following builds your network visibility without sending connection requests. Rate limit: 100 actions per day.
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.
