LinkedIn Messaging API in 2026: Send Messages From Your Code

The LinkedIn messaging API landscape in 2026: what the official Messages API allows, how account-based APIs send and read DMs, real code, and pricing.

Alexandre Risser

Alexandre Risser

Swarmhit

6 min read
LinkedIn Messaging API in 2026: Send Messages From Your Code

Search for a LinkedIn messaging API and you will find two very different things wearing the same name: an official Messages API that almost nobody can use, and a growing category of account-based APIs that power most of the LinkedIn messaging automation actually running in 2026. This guide covers both, with real endpoints and requests rather than feature lists.

By the end you will know what the official API permits, how the account-based route works end to end (send, read, reply, webhooks), what it costs, and where the real risks sit. For the broader picture of every LinkedIn API category, see our LinkedIn API guide.

Is there an official LinkedIn messaging API?

Yes, and it is worth being precise here, because a lot of articles claim no official API exists. LinkedIn documents a Messages API and an Invitation API under its Communications product. Three restrictions make it unusable for outreach: access is granted only to approved partners, messaging is limited to your first-degree connections, and LinkedIn prohibits automated or scheduled sending through it. There is also a separate Pages messaging API for company page inboxes, which is support tooling, not outreach.

So the official route answers a narrow question: approved partners building user-initiated messaging inside their apps. If your product needs to start conversations, follow up, or read an inbox programmatically, the official LinkedIn messaging API was never designed to let you do that.

How account-based LinkedIn messaging APIs work

Account-based providers take the opposite approach: instead of asking LinkedIn for permission, they operate real LinkedIn accounts that customers own and connect. The provider maintains the account session server-side, exposes HTTP endpoints for actions (send a message, send an InMail, read a conversation), and pushes what happens back to your app as webhook events. The model works because the actions are indistinguishable from a person using the account, which is also why account safety becomes the central engineering problem: pacing, limits, session health, and proxies decide whether the account survives.

Send a LinkedIn message with one API call

Here is what the account-based route looks like in practice, using the Swarmhit API (the requests below are adapted from the public docs). Sending a direct message to a connection is one call against the sender account:

cURL
curl -X POST "https://app.swarmhit.com/api/v1/accounts/ACCOUNT_ID/messages" \
  -H "Authorization: Bearer swh_live_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 8a1d3f5b-2c4e-4a6d-9b8c-7e5f1a3d2c4b" \
  -d '{
    "profileUrl": "https://www.linkedin.com/in/john-doe",
    "text": "Thanks for connecting, John!"
  }'

Two details matter more than they look. The Idempotency-Key header means a network retry can never double-send a message to a prospect. And the target is a profile URL, so your CRM data is enough to address someone; the API resolves the conversation.

Read replies and close the loop

Sending is half the job. To react to answers, you subscribe a webhook endpoint to messaging events:

Register a webhook
curl -X POST https://app.swarmhit.com/api/v1/webhooks \
  -H "Authorization: Bearer swh_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/hooks/swarmhit",
    "events": ["message.received", "connection.accepted"],
    "classifyReplies": true
  }'

When a prospect replies, your endpoint receives the event with the message text, the chat id, and the campaign context, signed with HMAC SHA-256 so you can verify it came from the API:

message.received payload (abridged)
{
  "event": "message.received",
  "workspaceId": "wJ4kQz8XrN2mYpL5d",
  "createdAt": "2026-08-03T14:22:07.311Z",
  "data": {
    "accountId": "sN4Xq7Lm2Rw9Zk5Yp",
    "chatId": "9Zp4YtLm2Rw8XqKd5",
    "message": { "text": "Thanks for reaching out..." }
  }
}

Replying happens through the inbox endpoints (list chats, read a thread, post a message into it), so a human can take over any conversation at any point. The full API reference covers the chat model, attachments, and reply classification.

Messages, InMails, voice notes and attachments

A messaging API worth building on covers more than plain text. Direct messages work with first-degree connections. InMails reach people outside your network, cost credits, and cap the body at 1,900 characters. Voice notes and file attachments send through the same message endpoints and consistently stand out in crowded inboxes, because almost nobody automates them.

Rate limits and account safety

Two layers of limits exist, and conflating them is how accounts get restricted. LinkedIn acknowledges some hard rules (a weekly invitation cap whose number it does not publish, and published InMail credit budgets) but discloses no daily messaging quota; the operational numbers are operator-reported, and experienced operators keep new accounts far below what warmed accounts can send. The second layer is behavioral: sending pace, active hours, and consistency matter as much as volume.

This is the real difference between providers. Raw messaging APIs relay LinkedIn's responses and leave pacing to your code. A sequencer-grade API enforces per-sender limits server-side and schedules campaign sends inside human-like windows, so the safety layer is not something you have to write, tune, and maintain.

100+

safeguards monitored 24/7 on Swarmhit's sending infrastructure

Which LinkedIn messaging API route should you build on?

The choice comes down to how much of the messaging layer you want to own. Raw APIs like Unipile give you endpoints and channel breadth, but no campaign object: sequencing, follow-up logic, and pacing are yours to build and host. A sequencer API ships that layer. We compare both models in depth in our Unipile comparison.

RouteWhat you getPricingBest for
Official Messages APIPartner-gated, first-degree only, no automated sendsNo public pricing; access is the barrierApproved partners only
Unofficial libraries (Voyager)Reverse-engineered endpoints, no support, breaks oftenFreeExperiments, never production
Raw messaging API (Unipile)Send and read endpoints, webhooks, you build the sequencer and pacing49 EUR/month minimum incl. 10 accounts, then 5 EUR per accountTeams with engineers to own the LinkedIn layer
Sequencer API (Swarmhit)Same endpoints plus campaigns, enforced limits, warm-up and safeguards built inVolume-based, scoped on a call, as low as $9 per sender at 50+ accountsSaaS products and agencies shipping outreach features

For a wider comparison across seven providers, see our outreach API guide, and for what each access route really costs, our LinkedIn API pricing breakdown. And if you are choosing an end-user tool rather than an API to build on, start from our LinkedIn prospecting tools guide.

Sending LinkedIn messages from AI agents

The newest consumers of messaging APIs are not SaaS backends but AI agents. Through MCP (Model Context Protocol), an assistant like Claude can search prospects, send connection requests and messages, and triage replies in natural language, using the same authenticated endpoints described above. If you are evaluating a LinkedIn messaging API in 2026, agent access belongs on the checklist next to webhooks.

Ship LinkedIn messaging in your product

Send, read and reply through one API, with campaign logic, enforced limits and 100+ safeguards handled by the infrastructure. Pricing is volume-based and scoped on a short technical call.

Book an integration call

White-label available. As low as $9 per sender at volume.

FAQ

Does LinkedIn have an official messaging API?

Yes. LinkedIn documents a Messages API and an Invitation API, but access is restricted to approved partners, messaging is limited to first-degree connections, and automated sending is prohibited. That is why products that automate LinkedIn messaging use account-based APIs instead.

How do account-based messaging APIs work?

You connect LinkedIn accounts you own, the provider maintains the session server-side, and your code calls HTTP endpoints to send messages or read conversations. Replies come back as webhook events, so your app can respond in real time.

Can I automate LinkedIn messages without getting accounts banned?

Risk never reaches zero, but it is manageable when limits and pacing are enforced by the infrastructure rather than left to your code: per-sender caps, human-like sending windows, warm-up for new accounts, and monitoring. Ask any provider who enforces the limits; if the answer is you, budget for that work.

What does a LinkedIn messaging API cost?

Raw APIs price per connected account: Unipile starts at 49 EUR per month including 10 accounts, then 5 EUR per account. Sequencer-grade APIs like Swarmhit price on volume, scoped on a call, reaching as low as $9 per sender per month at 50 or more accounts, with white-label available.

What is the difference between a message and an InMail through the API?

A direct message requires a first-degree connection and is free. An InMail reaches people outside your network, consumes InMail credits from the sender account (Open Profile recipients excepted), and caps the body at 1,900 characters. Good messaging APIs expose both as separate endpoints on the same account.

Can AI agents send LinkedIn messages?

Yes, through MCP servers that wrap a messaging API. The agent uses the same authenticated endpoints as any integration: it can search prospects, send messages within the enforced limits, and read replies, while every action stays attributable to an account the customer owns.

The messaging layer is ready. Build the rest.

Campaigns, inbox, webhooks and 100+ monitored safeguards behind one API. We scope pricing and integration on a short technical call.

Book an integration call

Volume-based pricing. White-label available.

Alexandre Risser

Written by

Alexandre Risser

Swarmhit

Building Swarmhit. Writes about LinkedIn outreach, multi-sender infrastructure, and outbound that books meetings.

Ready to scale your LinkedIn outreach?

Multi-sender campaigns with built-in safeguards, from $39/month per sender.

Start free trial →

Keep reading

Stop sending cold messages.
Start booking warm meetings.

The teams getting in early are already booking meetings instead of chasing them.