Facebook Pixel
APILinkedIn Actions

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.

POST/message
Authentication requiredActions

Code 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

FieldTypeRequiredDescription
accountIdstringNoLinkedIn account ID to use. If not provided, uses the default account.
recipientProfileIdstringConditionalRecipient LinkedIn profile public ID (e.g., "john-doe-123"). Either this or recipientProfileUrn is required. Either recipientProfileId or recipientProfileUrn must be provided.
recipientProfileUrnstringConditionalRecipient LinkedIn profile URN (e.g., "urn:li:fsd_profile:ABC123"). Either this or recipientProfileId is required. Either recipientProfileUrn or recipientProfileId must be provided.
messagestringYesMessage content to send. Supports basic formatting.
subjectstringNoSubject line (required for InMail, optional for regular messages)
messageTypestringNoMessage type: normal (1st-degree connections) or inmail (non-connections, requires Premium credits)
groupIdstringNoGroup 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

StatusDescription
200Message sent successfully
400Bad request - Missing required fields
401Unauthorized - Invalid or missing API key
404Recipient profile not found
429Rate limit exceeded

Rate Limit Headers

All responses include rate limit information in the headers:

HeaderDescription
X-RateLimit-ActionThe action type being rate limited
X-RateLimit-LimitMaximum actions allowed per period
X-RateLimit-UsedActions used in current period
X-RateLimit-RemainingActions remaining
X-RateLimit-ResetISO 8601 timestamp when limit resets

200 Response Parameters

NameTypeDescription
successboolean
messagestringStatus message
recipientProfileUrnstringLinkedIn URN of the recipient

200 Example

{
  "success": true,
  "message": "Message sent successfully",
  "recipientProfileUrn": "urn:li:fsd_profile:ACoAAA24A-MBVEvT49xpVF2gnWrhvmUIPDJshSM"
}

400 Response Parameters

NameTypeDescription
errorstring

400 Example

{
  "error": "Either recipientProfileId or recipientProfileUrn is required",
  "success": false
}

401 Response Parameters

NameTypeDescription
errorstring

401 Example

{
  "error": "Unauthorized"
}

404 Response Parameters

NameTypeDescription
errorstring

404 Example

{
  "error": "LinkedIn profile not found: invalid-profile-id",
  "success": false
}

429 Response Parameters

NameTypeDescription
errorstring
successboolean

429 Example

{
  "error": "Rate limit exceeded for MESSAGE: 100/100 used. Resets at 2024-01-16T00:00:00.000Z",
  "success": false
}