Platforms / LinkedIn
LinkedIn API
Share posts and documents to LinkedIn member profiles and company Pages and handle comments.
At a glance
- Platform id
linkedin- Connects
- profile or Page
- Sign-in
- OAuth: the user approves on the platform's own page
- Post types
- Text · Link card · Image · Images (2-20) · Video · Document (PDF, PPT, DOC)
Capabilities
| Publishing | Yes |
|---|---|
| Scheduling | Yes |
| Comments | Partly |
| Direct messages | No |
| Mentions | No |
| Reviews | No |
| Analytics | Partly |
Required on every post
- Text or media. A document must be the only media item.
Options
Send these in platform_data.linkedin on the post, or flat in a target's own platform_data (the target's keys win). See Publishing.
| Key | Type | What it does |
|---|---|---|
visibility | PUBLIC | CONNECTIONS | LOGGED_IN | Who can see it. Default PUBLIC. CONNECTIONS works for member posts only. The top-level visibility (public, connections_only, logged_in) maps to these. |
disable_reshare | boolean | Stop others from resharing the post. |
article_url | URL | Link to attach (link also works). Not with a document. |
article_title, article_description | string | Link card title (default: the URL) and description. |
link_thumb | URL | Image for the link card thumbnail. |
media_title | string | Title shown on a video or document post. A document defaults to the post title, then the file name. |
alt_texts | string[] | Alt text for each image, in order. |
Limits
- 3,000 characters per post. Up to 20 images, or one video (MP4, up to 500 MB, 3 seconds to 30 minutes).
- Documents: PDF, PPT, PPTX, DOC or DOCX, up to 100 MB and 300 pages, as the only media item.
- This server caps each profile or Page at 25 posts an hour and 50 a day.
Text over the limit fails validation before anything is sent. The caps of this server are explained in Rate limits.
Good to know
- One login connects the member profile and, with Community Management approval, every company Page that member administers. metadata.connection_type profile or organization narrows the choice. A brand can hold several LinkedIn accounts.
- LinkedIn tokens last about 60 days and most apps get no refresh token: the member reconnects when one expires.
- LinkedIn builds no link preview: set the card title and description, and attach one image to use as the thumbnail.
- Mention people and Pages in the text with LinkedIn's syntax: @[Name](urn:li:person:…) or @[Name](urn:li:organization:…).
- Comments can be listed on company Page posts only. No edit after publishing, no DMs.
- Accounts connected before the *_feed scopes were added must reconnect to read comments.
Publish with the API
curl https://api.zaynstack.com/v1/posts \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{
"text": "Hello from SocialWire",
"media": [{ "type": "image", "source_type": "url", "source": "https://example.com/file.jpg" }],
"targets": [{ "account_id": "<LinkedIn account id>" }],
"publish_now": true
}'An operation LinkedIn cannot do answers 501 resource.not_supported. Agents can do the same through the MCP server.
Connection errors
A connection that fails comes back to your redirect_uri with status=error, error=<code> and error_description, or as the error of the connect call. All codes: Connect accounts.
| Code | Meaning |
|---|---|
platform.linkedin.no_pages | connection_type organization was asked for, but the member administers no Page. |
billing.brands_limit | No brand_id was sent, so a new brand was needed, and the plan has no room for another brand. |
Webhook events
Every platform sends the post.* and account.* events. LinkedIn also sends:
comment.received(company Page posts)
Not supported yet
- Listing mentions.
- Member and post analytics that need LinkedIn's partner-only scopes.
- Editing posts, DMs.
Developer setup (self-hosting)
Only the operator of this server does this, once. Users then just click Connect.
- linkedin.com/developers → Create app (needs a company Page you admin; verify the app from that Page).
- Products: add 'Share on LinkedIn' and 'Sign In with LinkedIn using OpenID Connect' (instant).
- Auth tab: add the Callback address below.
- Put the client ID and secret into LINKEDIN_CLIENT_ID / LINKEDIN_CLIENT_SECRET.
- Callback address
https://api.zaynstack.com/api/connect/linkedin/callback- Webhook address
https://api.zaynstack.com/api/hooks/linkedin- Server variables
LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET- Developer console
- LinkedIn developer console
Permissions requested
openidprofileemailw_member_socialw_organization_social*r_organization_social*rw_organization_admin*r_organization_social_feed*w_organization_social_feed*w_member_social_feed*
When a reconnect grants fewer permissions than before, an account.updated event with change permissions_reduced is sent. Accounts connected before a permission was added keep working but must reconnect to use the features it unlocks.
Before anyone can connect (review)
- Member posting works right away for anyone.
- * Company Pages and comments need the Community Management API product: apply with company details and use case; after approval set LINKEDIN_ORG_SCOPES=1.
Typical wait: Member: instant; Community Management API: 2-8 weeks. Until then the app works for your own accounts and the testers you add in the console.