LinkedIn messaging API: how to send a message to a user

By Benjamin · Founder of Lempile · Updated
Checked against the official sources listed at the end.

LinkedIn has a Messages API, but only approved partners can use it, and only for messages a member chooses to send to their own connections. Page messaging and Sales Navigator are partner-only too. Outside those programs, apps send from the member's own account through an unofficial API. Here is each route, what it allows, and the code for the last.

Table of contents
  1. Does LinkedIn have a messaging API?
  2. How do I send a LinkedIn message to a user with an API?
  3. Who can you message on LinkedIn through an API?
  4. Can you send InMail through an API?
  5. How many LinkedIn messages can you send per day?
  6. Is it allowed to send LinkedIn messages through an API?
  7. Frequently asked questions
  8. Official sources checked

Does LinkedIn have a messaging API?

Yes, but none an ordinary app can sign up for. LinkedIn's Messages API sends a member's messages to their first-degree connections, and its documentation says its use is restricted to approved partners. The two other official routes are partner-only as well:

Swipe the table sideways to see every column →

RouteWhat it coversWho can use it
Messages APIA member's messages to one or more first-degree connections, or a reply in an existing conversationApproved partners only
Page MessagingA Company Page's messages, through the Community Management APIsMarketing apps LinkedIn approves
Sales Navigator (SNAP)Connecting and messaging leads, InMail included, inside a CRMApproved partners; no new partners accepted

Connection invitations follow the same pattern: LinkedIn's Invitations API carries the same “restricted to approved partners” note. See Does LinkedIn have an API? for everything else that is open.

What LinkedIn's Messages API requires

Even approved partners can only send what the member chose to send:

  • Each message comes from a specific member action. LinkedIn says an automated or scheduled event doesn't count.
  • The member opts in. A pre-written message is shown as a draft they can edit, and they send it themselves.
  • The message is posted at, or around, the time of that action.
  • No reward for the sender or the recipients, and no HTML in the message.

So it suits a “share with a connection” button, not a sequence of follow-ups.

How do I send a LinkedIn message to a user with an API?

Outside the partner programs, through an API that acts from the member's own LinkedIn account, such as Lempile or Unipile. The member connects the account once, through a hosted link, and your code then starts conversations and replies as them. Lempile answers Unipile's paths, so the same code works with both (see Lempile vs Unipile).

1. Connect the account

Create a hosted auth link (POST /api/v1/hosted/accounts/link), send it to your user, and keep the account_id you get back. Details in Authentication and accounts.

2. Start a conversation

Start a chat with one person
curl -X POST "https://direct.lempile.com/api/v1/chats" \
  -H "X-API-KEY: $LEMPILE_KEY" \
  -H "Idempotency-Key: first-message-bob" \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "'"$ACCOUNT_ID"'",
    "attendees_ids": ["https://www.linkedin.com/in/bob-buyer"],
    "text": "Hi Bob, quick question about your post."
  }'

# 201 { "object": "ChatStarted", "chat_id": "2-QUFB…", "message_id": "2-_vpt…" }

attendees_ids takes one person, as a profile URL, a public identifier or LinkedIn's member id. The Idempotency-Key means a retry never sends the message twice. Add ?dry_run=true to see exactly what LinkedIn would receive, without sending it.

The same call in Python
import os
import requests

res = requests.post(
    "https://direct.lempile.com/api/v1/chats",
    headers={
        "X-API-KEY": os.environ["LEMPILE_KEY"],
        "Idempotency-Key": "first-message-bob",
    },
    json={
        "account_id": os.environ["ACCOUNT_ID"],
        "attendees_ids": ["https://www.linkedin.com/in/bob-buyer"],
        "text": "Hi Bob, quick question about your post.",
    },
    timeout=60,
)
print(res.status_code, res.json()["chat_id"])  # 201 2-QUFB…

3. Reply in a conversation

Send a message in an existing chat
curl -X POST "https://direct.lempile.com/api/v1/chats/$CHAT_ID/messages" \
  -H "X-API-KEY: $LEMPILE_KEY" \
  -H "Idempotency-Key: reply-42" \
  -H "Content-Type: application/json" \
  -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Thanks, Tuesday works for me." }'

# 201 { "object": "MessageSent", "message_id": "2-_vpt…" }

4. Get replies as they arrive

Register a messaging webhook: Lempile keeps LinkedIn's own live connection open for the account and posts each new message, read receipt, reaction, edit or deletion to your URL within seconds. See Webhooks.

Who can you message on LinkedIn through an API?

The same people the member could message by hand. LinkedIn's Help Center lists them: 1st-degree connections and LinkedIn Pages for free; Premium members who turned on Open Profile; members of the same group or current coworkers, by message request; anyone else only by InMail, which takes a paid subscription. Lempile reads the profile's “Message” option first, as LinkedIn's own page does:

Swipe the table sideways to see every column →

CaseWhat happens
A connection, an open profile, or someone who wrote firstThe message is sent
Anyone else422 no_connection_with_recipient, unless you ask for an InMail
An InMail LinkedIn doesn't offer for this person422 not_allowed_inmail
An InMail with no credit left for this person422 insufficient_credits
The account itself422 invalid_recipient

Can you send InMail through an API?

Officially, through Sales Navigator's Display Services, whose modules let approved partners' users message leads, InMail included; LinkedIn isn't accepting new Sales Navigator partners. Through Lempile, set linkedin[inmail]=true on a new chat: if LinkedIn offers an InMail to that person and the account has credit, it goes out as an InMail with your subject. Lempile's docs say the InMail send is built from LinkedIn's own web code and tested, but not yet confirmed with a real InMail.

An InMail takes a subject of up to 200 characters, which is required, and a body of up to 1,900, according to LinkedIn. Every other limit is in LinkedIn character limits.

How many LinkedIn messages can you send per day?

LinkedIn doesn't publish a number. Its Help Center says only that it limits how many messages a member can send in a certain time period, and that nobody can message a member who blocked them. Lempile's own pacing, per connected account:

Swipe the table sideways to see every column →

LimitValue
Calls at a timeOne; the next waits up to 60 seconds for its turn
Gap between calls1.5 to 3 seconds
Writes (messages, invitations, posts, comments)150 in any 24 hours
LinkedIn calls of any kind1,500 in any 24 hours
After LinkedIn answers “too many”15 minutes of rest
  • A message takes up to 8,000 characters.
  • Files go up to 20 MB each; a voice note up to 60 seconds, sent on its own.
  • The limits belong to the account, never the key: two apps using one account share them.
  • Every newly connected account starts with writes off; Lempile turns them on per account, and dry runs work meanwhile.

Details in Errors and limits. For invitations, see LinkedIn connection limits.

Is it allowed to send LinkedIn messages through an API?

LinkedIn's User Agreement asks members not to use bots or other unauthorized automated methods to send or redirect messages, and lets LinkedIn restrict accounts. Its own Messages API goes further: each message must come from a member's action, never an automated or scheduled event. Sending from a member's own account carries that risk, with Lempile as with any other tool, and no API can remove it.

Frequently asked questions

Does LinkedIn have a messaging API?
Yes, but not an open one. LinkedIn's Messages API lets a member send a message they chose to write to their first-degree connections, and it is restricted to approved partners. Page Messaging serves approved marketing apps, and Sales Navigator's API takes no new partners. None of them is open to an ordinary app.
How do I send a LinkedIn message to a user with an API?
Outside LinkedIn's partner programs, through an unofficial API that acts from the member's own account, such as Lempile or Unipile. The member connects their LinkedIn account once through a hosted link; your code then calls POST /api/v1/chats with their account_id, the person's profile URL and the text, and the message goes out as them.
Can I message anyone on LinkedIn through an API?
No. LinkedIn lets a member message their 1st-degree connections and Pages for free, plus Premium members with Open Profile and, by message request, fellow group members and coworkers. Anyone else needs an InMail. Lempile checks the profile's Message option first and answers no_connection_with_recipient instead of sending when only an InMail would reach the person.
Can I send a LinkedIn InMail with an API?
Officially, through Sales Navigator's Display Services, which let approved partners' users message leads, InMail included; LinkedIn takes no new Sales Navigator partners. Lempile sends an InMail from the member's own account when you set linkedin[inmail]=true and the account has credit for that person; its docs say this isn't yet confirmed with a real InMail.
How many messages can you send on LinkedIn per day?
LinkedIn doesn't publish a number: its Help Center says only that it limits how many messages a member can send in a certain time period. Through Lempile, each account makes one call at a time, 1.5 to 3 seconds apart, and at most 150 writes (messages, invitations, posts, comments) in any 24 hours.
How do I receive LinkedIn replies in my app?
Register a messaging webhook. Lempile keeps LinkedIn's own live connection open for each account a webhook wants, and new messages, read receipts, reactions, edits and deletions reach your URL within seconds. A delivery that fails is tried again 30 seconds, 2 minutes, 10 minutes, 30 minutes and 2 hours later.
Is it allowed to send LinkedIn messages through an API?
LinkedIn's User Agreement asks members not to use bots or other unauthorized automated methods to send or redirect messages, and its Messages API requires each message to come from a member's own action, never an automated or scheduled event. LinkedIn can restrict accounts. Any tool that sends for a member carries that risk; no API removes it.

Official sources checked

Read on 3 December 2026.

Send LinkedIn messages from your product.

Start conversations, reply, send files and voice notes, and get every new message by webhook within seconds, from your users' own accounts. Dry-run any message first. 7-day free trial, no card needed.

Try every endpoint for 7 days. No card needed.