1. Overview
LinkedIn posts publish as the connected member profile (connection_type: "profile") or as the connected company Page (connection_type: "organization"). Both are linkedin accounts and follow the publishing rules on this page, with one difference when publishing: visibility: "connections_only" on a company Page target returns 400 publishing.validation_failed on the field visibility. Listing posts differs too: see Retrieve posts.
2. Supported media
A post cannot mix a video with images. A
media_id video among 2 or more media items returns 400 publishing.validation_failed. A platform_attachment_id video among 2 or more items fails the target at publish time with 400 validation.media_type. A video sent by url among 2 or more items is refused by LinkedIn at upload.
A document cannot be combined with other media or with article_url. Validation returns 400 publishing.validation_failed on the field media or article_url, and a document found among 2 or more items at publish time fails the target with 400 validation.media_type.
File limits for media you upload to SocialAPI (source_type: "media_id"): images at most 10 MB. Videos at most 500 MB, 3 seconds to 30 minutes long, and at most 30 frames per second. Documents at most 100 MB. Text holds at most 3,000 characters. SocialAPI checks these limits before it publishes, and a violation returns 400 publishing.validation_failed. LinkedIn also caps a document at 300 pages, which it checks when it processes the file.
3. Create post
UsePOST /v1/posts with targets pointing at a LinkedIn account and publish_now: true. The text field becomes the post commentary. The platform comes from the account, so a target has no platform field.
Visibility
visibility sets who sees the post. Send it on the post, or on a target to override the post. When both set it, the target’s value wins.
Any other value fails validation on the field
visibility.
Text formatting
Writetext as plain text. Characters LinkedIn reserves for formatting (| { } @ [ ] ( ) < > # \ * _ ~) are escaped for you, so they appear on LinkedIn exactly as typed. Text you already escaped with a backslash (for example \() is published unchanged.
A
# inside a word (C#, page#section) and an @ outside the mention syntax (an email address) are published as plain text.
Link post with a call to action
Setarticle_url to publish a link post. Add cta_label and cta_url for a call-to-action button. An attached image becomes the link thumbnail. LinkedIn builds no preview of its own, so set article_title and article_description too.
Document posts
Attach one PDF, PPT, PPTX, DOC, or DOCX to publish a document post, which LinkedIn shows as a swipeable carousel.text becomes the post commentary. Upload the file with media_type=application/pdf (or the matching MIME type for the other formats), or send it as a url. A url must end in .pdf, .ppt, .pptx, .doc, or .docx, or be served with the document’s MIME type.
LinkedIn shows a title on every document. Set it with title on the post or the target. Without title, the document takes its file name without the extension, for example Q3 report for Q3 report.pdf. platform_data.linkedin.media_title, when set, takes precedence over both.
media. Documents publish on LinkedIn only: any other target carrying the same document fails validation. A document you uploaded through LinkedIn yourself can be sent as a platform_attachment_id with its urn:li:document: URN and type: "file".
LinkedIn processes the document after upload: see Video and document processing for the errors it can return.
Platform data fields
Send these keys inplatform_data.linkedin on the post, which applies them to every LinkedIn target, member profile and company Page alike. To set them for one target, send them flat in that target’s platform_data (targets[].platform_data, with no linkedin key). When both set the same key, the target’s value wins.
SocialAPI forwards any additional keys in
platform_data.linkedin that the table above lists, and no others. LinkedIn has no other publish options that SocialAPI passes through: an unlisted key is ignored without a warning. A malformed article_url, a cta_label outside the list, or a cta_label or cta_url without article_url fails validation on that field.
Scheduling
Setscheduled_at to an ISO 8601 timestamp (UTC) instead of publish_now. SocialAPI holds the post and publishes it at that time.
4. Update post
LinkedIn posts cannot be edited through SocialAPI once they are published.PATCH /v1/posts/{post_id} edits only a post in draft, scheduled, or failed status, and returns 409 post.state_invalid for a published post. To correct a published post, delete it and publish a new one.
5. Delete post
DELETE /v1/posts/{post_id} deletes the post from LinkedIn when its LinkedIn target is published. A target that is not published is removed from SocialAPI only. See Delete a post.
6. Retrieve posts
GET /v1/posts?platform=linkedin&account_ids={account_id} lists the posts of a member profile or a company Page.
For a member profile, the list holds the posts you published through SocialAPI. LinkedIn gives apps no read of a member’s own posts, so a post published on LinkedIn directly never appears, and GET /v1/posts returns no metrics for these posts. Read counts for the 5 most recent ones from LinkedIn insights. For a company Page, the list also holds the Page’s posts made outside SocialAPI.
7. Quirks, errors, and recovery
The post ID is returned for you
SocialAPI returns the LinkedIn post ID asplatform_post_id in the post body and in post.published events, with a permalink. You do nothing to retrieve it.
Video and document processing
LinkedIn processes a video or a document after upload. A video LinkedIn cannot process fails the target with422 platform.linkedin.processing_failed. An upload or processing step that does not finish in time fails it with 503 platform.linkedin.upload_timeout or 503 platform.linkedin.processing_timeout. Upload a smaller or re-encoded file, then retry. A document LinkedIn cannot process fails the same way with 422 platform.linkedin.processing_failed, and one that does not finish processing in time with platform.linkedin.processing_timeout. Check that the file opens and has at most 300 pages, export it again as a PDF if needed, then retry.
Link posts need their own preview
LinkedIn builds no preview for a link post. Setarticle_title, article_description, and attach an image. A video, or more than one media item, on a link post is ignored apart from the first image, and validation returns a warning on the field media.
Errors on a failed target
A publish that fails after the request returned puts a structured error on the target, intargets[].error, with its code. Every code is in Errors.
401 platform.linkedin.auth: LinkedIn reported that the access token is invalid, expired, or revoked. LinkedIn tokens last 60 days and cannot be refreshed. The account is markedtoken_expired, and every later call that acts on the account returns403 account.reconnection_requireduntil you reconnect it.401 platform.linkedin.unauthorized: LinkedIn refused the call as unauthorized without naming the token. The account stays usable, withstatus: reconnect_recommended. Reconnect it if the error repeats.403 platform.linkedin.access_denied: LinkedIn refused the action for this account. Reconnecting does not change it. Readmessage.429 platform.linkedin.rate_limit: LinkedIn’s own limit. Wait, then retry.
Recovery
- Rate limit. Wait for the seconds in
Retry-After, or at least 60 seconds when it is absent, then sendPOST /v1/posts/{post_id}/retry. See Delivery. - Auth error. Reconnect the LinkedIn account through the OAuth flow.
- Media failure. Replace the file, create the post again, or edit the failed post and retry it.
8. Full worked example
This example publishes an image post with a mention and a hashtag, then reads the result. Step 1: Upload mediaupload_url, then call POST /v1/media/{media_id}/verify. The steps and the response are in Media. The result is a media_id, here f47ac10b-58cc-4372-a567-0e02b2c3d479.
Step 2: Publish the post
status: "publishing", as in Create post.
Step 3: Check the status
9. Required OAuth scopes
SocialAPI’s LinkedIn app requests these scopes during the OAuth flow:w_member_social for member profiles, the other two for company Pages. You configure nothing. The full list is in LinkedIn scopes.
The scopes a scoped API key needs, the credit cost of a post, and the MCP tools that publish are on Publishing.