Back to blog

LinkedIn Messaging API: What You Can and Can't Use

Ruz, Founder LeadShark · Nov 13, 2026 · 8 min read

Short answer: LinkedIn does have a LinkedIn Messaging API. Access is restricted to approved partners, it only reaches your 1st-degree connections or an existing thread, and LinkedIn's own rules say the member has to send the message in the moment. You cannot use it to automate or schedule DMs. If you want Claude, ChatGPT or Cursor to send and reply to LinkedIn messages from your own account, Apex by LeadShark gives your agent those tools over MCP, inside a daily DM limit you set from 0 to 250.

I build LeadShark, so read this with that in mind. Everything about the official API below comes from LinkedIn's own developer documentation as of November 2026.


What the official LinkedIn Messaging API allows

LinkedIn documents a Messages API under its Communication APIs. The Messages API lets an approved partner's app create a member-to-member message to one or more 1st-degree connections, or reply in an existing conversation. The Communications overview groups it with the Invitation API.

The Messages API page opens with a hard limit: "Usage of this API is restricted to approved partners, subject to limitations via API agreement." A standard developer app does not get it. Open products in the LinkedIn Developer Portal cover Sign In with LinkedIn and Share on LinkedIn. They do not include inbox access, and they do not give you a LinkedIn message API you can add yourself.

Even with partner access, LinkedIn sets rules that block automated outreach:

  • A message must be tied to a specific member action. LinkedIn's docs say: "Member actions do not include an automated or scheduled event."
  • The member must opt in to sending, not opt out.
  • If the app pre-writes a draft, the member has to see the subject, body and attachments, be able to edit them, and take an affirmative action to send.
  • The message must be posted at, or around, the time the member took that action.

So the official LinkedIn messages API is a tool for an approved partner that needs a signed-in member to start or continue a conversation, in the moment, with people they are already connected to. It is not a way to run outreach, follow-ups or comment-to-DM from code.

There is also a separate Pages messaging API in LinkedIn Help. That one is for a Company Page inbox, through approved partner platforms. It is not a way for a member to send personal DMs from their own profile.

For the wider official API (how to get an API key, which products are open or partner-only, and official rate limits), see how to get LinkedIn API access and an API key.

Why most "send a DM from code" searches can't use it

People who search for a linkedin message api or a linkedin messages api usually want one thing: send a LinkedIn DM from their own code, or from an AI agent, without waiting for LinkedIn to approve a partner app. The official Messages API is not built for that.

It cannot reach people outside your 1st-degree network unless you already have a thread with them. It cannot send on a schedule. It cannot watch the comments on your posts and DM everyone who asked for a resource. That last flow also needs permission to read comments, which LinkedIn restricts and is not opening to new requests.

So the official route answers a narrow question: approved partners building user-initiated messaging inside their app. If you want to start conversations, follow up, or let an agent work your inbox, you are looking at a different kind of product. Some vendors sell HTTP APIs that send from a member's own connected account. Apex is not that kind of raw messaging API. It is an MCP server your agent uses to act as you, with a daily cap and an approval queue on sensitive sends.

Send LinkedIn messages from your own account with Apex MCP

Apex is LeadShark's MCP server for AI agents. You connect your LinkedIn account once in LeadShark, then paste the Apex MCP URL into Claude, ChatGPT or Cursor. Your agent can then send a DM as you, read a thread before it replies, and stay inside the same daily DM budget your LeadShark automations already use.

This is not a way around LinkedIn's official partner gate, and it is not risk free. Sends go out from your own account, they count against a daily limit you control, and sensitive writes can wait in your approval queue. LeadShark is not affiliated with or endorsed by LinkedIn.

If you already use LeadShark for comment-to-DM, nothing about that changes. Automations you arm in the dashboard still send from your account, inside the same daily cap. Apex adds a direct path for the agent: it can open a specific conversation, not only the automated reply that fires when someone comments. Across LeadShark, 2.8M+ DMs have been delivered from connected accounts. That is the infrastructure Apex uses, not a promise about any one account.

The Apex send and inbox tools

These are the messaging tools your agent actually gets on Apex:

send_message. Send a LinkedIn message as yourself. By default this is a direct message, which requires a 1st-degree connection. To reach someone you are not connected to, the tool can send an InMail instead, which spends one of your LinkedIn plan's paid InMail credits and is refused if you have none. Either way, the send counts against your daily DM limit. Pass a LinkedIn member id or a public profile slug. For how many messages LinkedIn itself allows, and how InMail credits work, see LinkedIn DM limit per day.

get_lead_activity. Call this before you DM. It is a read-only briefing on the person: whether you already have a history, whether they engaged your content, whether you are connected, and whether they are on your do-not-engage list. Use it to write a specific opening, or to skip the send.

list_recent_messages. List your LinkedIn DM threads, newest first, with a preview of the last message and whether they wrote last or you did. You can filter for threads that went quiet, or for people who fit your ICP, so the agent can triage who to reply to or revive.

get_messages_with_person. Read the conversation with one specific person before you reply, so the next message has the context of the thread.

send_connection_request. If you are not connected yet and you do not want to spend an InMail credit, send a connection request first (an optional note can go with it). It respects the daily and weekly connection limits you have configured. LinkedIn's own invitation caps are covered in LinkedIn connection limit.

set_daily_dm_limit. Set your daily DM sending limit from 0 to 250. We recommend a maximum of 150. Setting the limit to 0 is an emergency stop: all DM sending pauses immediately, including automations that share the same budget.

A typical agent flow looks like this: check get_lead_activity, connect with send_connection_request if you are not already 1st-degree, read the thread with get_messages_with_person or list_recent_messages if one exists, then send with send_message. If the daily cap is hit, the send is refused until the next day, or until you raise the limit.

How to connect Claude, ChatGPT or Cursor

The setup is on apex.new and in the LeadShark MCP docs. In short:

  1. Create a LeadShark account and connect your LinkedIn account. New accounts get a 7-day LeadShark trial, no card.
  2. Unlock the one-time 72-hour Apex trial in Settings, then Apex Settings, when you are ready to run the agent. The window works on the free trial, Pro and Pro+. After that, Apex is $119/month.
  3. Add https://apex.leadshark.io/mcp as a custom MCP server or connector in Claude, ChatGPT or Cursor, then sign in and approve access.

The written steps for each app are in the MCP server guide.

Safety: the approval queue, the daily cap and the emergency stop

Apex is built so the agent cannot send DMs without your limits, and, when you want it, your approval. Sensitive MCP writes, including DMs, connection requests and comments, can be queued for your review before they go out. You also set the daily DM cap. Dashboard automations you arm yourself, such as a keyword comment-to-DM, still run under that same cap.

If something looks wrong, set the daily DM limit to 0 and sending stops. Every attempt is logged. None of that makes LinkedIn activity risk free. Stay inside limits you are comfortable with, and review queued sends before you approve them.

FAQ

Does LinkedIn have a messaging API?

Yes. LinkedIn documents a Messages API and an Invitation API. Access to the Messages API is restricted to approved partners, it only reaches 1st-degree connections or an existing thread, and automated or scheduled sends are not allowed.

Can I use the official LinkedIn message API without being a partner?

No. LinkedIn's Messages API page says usage is restricted to approved partners, subject to limitations via API agreement. A standard developer app in the LinkedIn Developer Portal does not receive it.

Can I automate LinkedIn DMs with the official LinkedIn messages API?

No. LinkedIn requires each message to come from a specific member action, and "Member actions do not include an automated or scheduled event." If an app presents a draft, the member must be able to edit it and must take an affirmative action to send it.

How do I send LinkedIn messages from an AI agent instead?

Connect your LinkedIn account to LeadShark and use Apex. Your agent calls the send_message tool over MCP to DM a 1st-degree connection, or to send an InMail if you have credit. Read the thread first with get_messages_with_person or list_recent_messages, and check get_lead_activity before you reach out.

What daily limit applies to Apex DMs?

You set a daily DM limit from 0 to 250 (150 is the recommended maximum). The cap is shared with your LeadShark automations. Setting it to 0 is an emergency stop.

Is the Pages messaging API the same thing?

No. The Pages messaging API in LinkedIn Help is for a Company Page inbox, through approved partner platforms. It is not the member Messages API, and it is not how Apex sends DMs from your personal profile.

How do I try Apex?

Start a LeadShark account, then unlock the one-time 72-hour Apex trial in Settings, then Apex Settings. The setup and the MCP URL are on apex.new.


Let your AI agent send LinkedIn messages, inside a daily limit you control. Unlock the 72-hour Apex trial on apex.new.

Ruz, Founder LeadShark

Written by

Ruz

Founder LeadShark

Put your lead magnets on autopilot

Reply to every commenter and deliver your resource in DMs, automatically. 7-day free trial, no card.

Start automating for free