Posts

post fetch

Fetch a LinkedIn post with optional comments and reactions.

bash
linkedin post fetch <url> [flags]
FlagTypeDescription
--commentsbooleanInclude comments
--reactionsbooleanInclude reactions
--comments-limitintegerMax comments to retrieve
--comments-sortstringSort order: mostRelevant or mostRecent
--comments-repliesbooleanInclude replies to comments
--reactions-limitintegerMax reactions to retrieve

With --comments, each returned comment includes commentUrn and commentUrl. Pass a commentUrl to comment react / comment reply to engage with that comment.

bash
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 --json

post search

Search for posts on LinkedIn with filters.

bash
linkedin post search [flags]
FlagTypeDescription
--termstringSearch keyword or phrase, up to 50 characters
--limitintegerMax results to return, up to 100
--sortstringOne of topMatch, latest
--date-postedstringOne of past24Hours, pastWeek, pastMonth
--content-typestringOne of videos, images, jobPosts, liveVideos, documents
--posted-bystringComma-separated: me, firstConnections, peopleYouFollow
--from-membersstringComma-separated names of people whose posts to keep
--from-companiesstringComma-separated names of companies whose posts to keep
--mentioning-membersstringComma-separated names of people the post must mention
--mentioning-companiesstringComma-separated names of companies the post must mention
--author-companiesstringComma-separated names of companies the author works at
--author-industriesstringComma-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 urn on their author and reposter – run post fetch on a result's url when you need one.

bash
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" --json

post create

Create a LinkedIn post with optional media attachments.

bash
linkedin post create <text> [flags]
ArgRequiredDescription
textyesPost text (up to 3000 characters)
FlagTypeDescription
--company-urlstringPost on behalf of a company page (requires admin access)
--attachmentsstringAttachments as url:type or url:type:name. Types: image, video, document. Can be specified multiple times.
--mentionstringOne 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:identifier
  • key – 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.

bash
# 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 name is used, which may not be the entity you meant. The published mention shows LinkedIn's own name for the entity, which can differ from the name you passed. Every @[key] in the text must have a matching --mention and 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).

bash
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/flutterwtf

post repost

Repost a LinkedIn post, as is or with your own commentary.

bash
linkedin post repost <url> [flags]
ArgRequiredDescription
urlyesURL or URN of the post to repost
FlagTypeDescription
--textstringYour own commentary (up to 3000 characters). Without it the post is reposted as is.
--mentionstringOne 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.

alreadyReposted is 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.

bash
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." --json

post react

React to a LinkedIn post.

bash
linkedin post react <url> --type <reaction> [flags]
FlagTypeRequiredDescription
--typestringyesReaction type: like, love, support, celebrate, insightful, funny
--company-urlstringnoReact on behalf of a company page
bash
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/flutterwtf

post comment

Comment on a LinkedIn post.

bash
linkedin post comment <url> <text> [flags]
ArgRequiredDescription
urlyesLinkedIn post URL
textyesComment text (up to 1000 characters)
FlagTypeDescription
--company-urlstringComment 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 duplicateComment and links the earlier comment when it is known. A comment published with --company-url is counted separately from a personal one.

bash
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/flutterwtf

comment react

React to a comment on a LinkedIn post.

bash
linkedin comment react <commentUrl> --type <reaction>
ArgRequiredDescription
commentUrlyesDeep-link URL of the comment, from post fetch --comments or a comment reply result
FlagTypeRequiredDescription
--typestringyesReaction type: like, love, support, celebrate, insightful, funny
bash
linkedin comment react "https://www.linkedin.com/feed/update/urn:li:activity:123/?dashCommentUrn=urn:li:fsd_comment:(456,urn:li:activity:123)" --type like

comment reply

Reply to a comment on a LinkedIn post.

bash
linkedin comment reply <commentUrl> <text> [flags]
ArgRequiredDescription
commentUrlyesDeep-link URL of the comment to reply to
textyesReply 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.

bash
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