Posts
post fetch
Fetch a LinkedIn post with optional comments and reactions.
linkedin post fetch <url> [flags]| Flag | Type | Description |
|---|---|---|
--comments | boolean | Include comments |
--reactions | boolean | Include reactions |
--comments-limit | integer | Max comments to retrieve |
--comments-sort | string | Sort order: mostRelevant or mostRecent |
--comments-replies | boolean | Include replies to comments |
--reactions-limit | integer | Max reactions to retrieve |
With
--comments, each returned comment includescommentUrnandcommentUrl. Pass acommentUrltocomment react/comment replyto engage with that comment.
linkedin post fetch https://www.linkedin.com/posts/vprudnikoff_activity-123
# With comments sorted by most recent, including replies
linkedin post fetch https://www.linkedin.com/posts/vprudnikoff_activity-123 \
--comments --comments-sort mostRecent --comments-replies --json
# With reactions
linkedin post fetch https://www.linkedin.com/posts/vprudnikoff_activity-123 \
--comments --reactions --jsonpost search
Search for posts on LinkedIn with filters.
linkedin post search [flags]| Flag | Type | Description |
|---|---|---|
--term | string | Search keyword or phrase, up to 50 characters |
--limit | integer | Max results to return, up to 100 |
--sort | string | One of topMatch, latest |
--date-posted | string | One of past24Hours, pastWeek, pastMonth |
--content-type | string | One of videos, images, jobPosts, liveVideos, documents |
--posted-by | string | Comma-separated: me, firstConnections, peopleYouFollow |
--from-members | string | Comma-separated names of people whose posts to keep |
--from-companies | string | Comma-separated names of companies whose posts to keep |
--mentioning-members | string | Comma-separated names of people the post must mention |
--mentioning-companies | string | Comma-separated names of companies the post must mention |
--author-companies | string | Comma-separated names of companies the author works at |
--author-industries | string | Comma-separated industries the author works in |
The member and company flags take typed names, which is all LinkedIn's filter panel accepts, so the entry that gets picked is whichever suggestion LinkedIn ranked first for that name – it may be a namesake rather than the person or company you meant. To pin an exact one, run the search as a workflow with an urn on the filter entry; an identifier that no suggestion matches fails the action with filterNotApplied instead of filtering by a namesake.
A search may return fewer posts than --limit, because how many results come back depends on what LinkedIn loads for that account on that search. LinkedIn also widens a narrow query on its own, so a non-empty result does not mean your term matched. See searching for posts.
Search results carry no
urnon theirauthorandreposter– runpost fetchon a result'surlwhen you need one.
linkedin post search --term "climate tech" --date-posted pastWeek --json
linkedin post search --term "product launch" --content-type images --sort latest --limit 20 --json
linkedin post search --term "hiring" --from-companies "Linked API" --posted-by "peopleYouFollow" --jsonpost create
Create a LinkedIn post with optional media attachments.
linkedin post create <text> [flags]| Arg | Required | Description |
|---|---|---|
text | yes | Post text (up to 3000 characters) |
| Flag | Type | Description |
|---|---|---|
--company-url | string | Post on behalf of a company page (requires admin access) |
--attachments | string | Attachments as url:type or url:type:name. Types: image, video, document. Can be specified multiple times. |
--mention | string | One mention, bound to @[key] in the text. Can be specified multiple times, up to 20. |
Attachment limits: up to 9 images, or 1 video, or 1 document. Cannot mix types.
Passing mentions
Write @[key] in the post text where the mention should appear, then describe that key with --mention. The value takes one of two forms:
key:name
key:name:identifierkey– the placeholder name used in the text as@[key]. Letters, digits,_or-.name– the name to find the person or company by. Always required.identifier– optional. One of a member URN, an organization URN, a hashed profile URL, or a hashed company URL.
Everything after the second : is the identifier, so its own colons and :// need no escaping. Quote the whole value, because names contain spaces.
# Name only — LinkedIn's first suggestion for that name is used
linkedin post create 'Thanks @[author]!' \
--mention "author:Example Person"
# Pinned by member URN
linkedin post create 'Thanks @[author]!' \
--mention "author:Example Person:urn:li:member:123456789"
# Pinned by hashed profile URL
linkedin post create 'Thanks @[author]!' \
--mention "author:Example Person:https://www.linkedin.com/in/ACwAAAxxxxxxxxx"
# A company, and two mentions at once
linkedin post create 'Great work @[author] and everyone at @[company]!' \
--mention "author:Example Person:urn:li:member:123456789" \
--mention "company:Example Company:urn:li:organization:1234567"Without an identifier, LinkedIn's first suggestion for
nameis used, which may not be the entity you meant. The published mention shows LinkedIn's own name for the entity, which can differ from thenameyou passed. Every@[key]in the text must have a matching--mentionand vice versa, and keys cannot repeat — otherwise the command fails before anything is published.
The post's postUrl and postUrn are printed on success (use --json for the full object).
linkedin post create "Excited to share our latest update!"
# With an image
linkedin post create "Check this out" \
--attachments "https://example.com/photo.jpg:image"
# With a document
linkedin post create "Our Q4 report" \
--attachments "https://example.com/report.pdf:document:Q4 Report"
# Mentioning a person
linkedin post create "Huge thanks to @[author] for the write-up!" \
--mention "author:Example Person:urn:li:member:123456789"
# Post as a company
linkedin post create "Company announcement" \
--company-url https://www.linkedin.com/company/flutterwtfpost repost
Repost a LinkedIn post, as is or with your own commentary.
linkedin post repost <url> [flags]| Arg | Required | Description |
|---|---|---|
url | yes | URL or URN of the post to repost |
| Flag | Type | Description |
|---|---|---|
--text | string | Your own commentary (up to 3000 characters). Without it the post is reposted as is. |
--mention | string | One mention, bound to @[key] in --text. Same format as for post create — see passing mentions. Can be specified multiple times, up to 20. |
The repost's own postUrl and postUrn are printed on success — not those of the post you reposted. They are empty when the repost was published but LinkedIn did not return its address; do not retry, the repost is already live.
alreadyRepostedis returned only when LinkedIn refuses an instant repost (one without--text). LinkedIn does not always refuse a repeat repost: a repost of your own post, or a repost with commentary, can be published again. Keep track of what you have already reposted instead of relying on this error.
Reposts count toward the same posting limit as
post create.
linkedin post repost https://www.linkedin.com/posts/vprudnikoff_activity-123
# With commentary
linkedin post repost urn:li:activity:1234567890123456789 \
--text "Worth reading, especially the part on onboarding." --jsonpost react
React to a LinkedIn post.
linkedin post react <url> --type <reaction> [flags]| Flag | Type | Required | Description |
|---|---|---|---|
--type | string | yes | Reaction type: like, love, support, celebrate, insightful, funny |
--company-url | string | no | React on behalf of a company page |
linkedin post react https://www.linkedin.com/posts/vprudnikoff_activity-123 --type like
linkedin post react https://www.linkedin.com/posts/vprudnikoff_activity-123 --type celebrate \
--company-url https://www.linkedin.com/company/flutterwtfpost comment
Comment on a LinkedIn post.
linkedin post comment <url> <text> [flags]| Arg | Required | Description |
|---|---|---|
url | yes | LinkedIn post URL |
text | yes | Comment text (up to 1000 characters) |
| Flag | Type | Description |
|---|---|---|
--company-url | string | Comment on behalf of a company page |
The same text on the same post, already published through Linked API within 24 hours, is not published again – the command fails with
duplicateCommentand links the earlier comment when it is known. A comment published with--company-urlis counted separately from a personal one.
linkedin post comment https://www.linkedin.com/posts/vprudnikoff_activity-123 "Great insights!"
linkedin post comment https://www.linkedin.com/posts/vprudnikoff_activity-123 "Well said!" \
--company-url https://www.linkedin.com/company/flutterwtfcomment react
React to a comment on a LinkedIn post.
linkedin comment react <commentUrl> --type <reaction>| Arg | Required | Description |
|---|---|---|
commentUrl | yes | Deep-link URL of the comment, from post fetch --comments or a comment reply result |
| Flag | Type | Required | Description |
|---|---|---|---|
--type | string | yes | Reaction type: like, love, support, celebrate, insightful, funny |
linkedin comment react "https://www.linkedin.com/feed/update/urn:li:activity:123/?dashCommentUrn=urn:li:fsd_comment:(456,urn:li:activity:123)" --type likecomment reply
Reply to a comment on a LinkedIn post.
linkedin comment reply <commentUrl> <text> [flags]| Arg | Required | Description |
|---|---|---|
commentUrl | yes | Deep-link URL of the comment to reply to |
text | yes | Reply text |
The reply's commentUrn and commentUrl are printed on success (use --json for the full object). The same reply text to the same comment, already published through Linked API within 24 hours, is not published again – the command fails with duplicateComment.
linkedin comment reply "https://www.linkedin.com/feed/update/urn:li:activity:123/?dashCommentUrn=urn:li:fsd_comment:(456,urn:li:activity:123)" "Great point, thanks for sharing!" --json