st.createPost
This action allows you to create a post on LinkedIn. You can post as yourself or on behalf of a company page you have admin access to. The action supports text content with optional mentions of people and companies, and media attachments including images, videos, and documents.
In the SDK this is the createPost method. It takes the parameters below except label and then, which exist only in workflow JSON, and returns the result below in data.
In the CLI this is linkedin post create – the command is below, under Parameters.
Constraints
⏺️ Root Start: allowed.
⬆️ Parent Actions: N/A.
⬇️ Child Actions: st.openPost.
Parameters
{
"actionType": "st.createPost",
"label": "post1",
"text": "Excited to share my latest insights on building scalable APIs, together with @[teammate]!",
"mentions": [
{
"key": "teammate",
"name": "Example Person",
"personHashedUrl": "https://www.linkedin.com/in/ACwAAAxxxxxxxxx"
}
],
"attachments": [
{
"url": "https://example.com/images/team-photo.jpg",
"type": "image"
}
],
"companyUrl": "https://www.linkedin.com/company/microsoft"
}In AI assistants, the MCP server runs this action as the create_post tool.
In the CLI this is linkedin post create:
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).
label(optional) – custom label for tracking this action in workflow completion.text(required) – post text, must be up to 3000 characters.mentions(optional) – people and companies to mention intext. Write@[key]where the mention should appear, and describe thatkeyhere. Maximum 20 items.key(required) – placeholder name used in the text as@[key]. From 1 to 30 characters: letters, digits,_or-.name(required) – name to find the person or company by, from 1 to 100 characters.urn(optional) – URN of the entity:urn:li:member:<id>for a person,urn:li:organization:<id>for a company.personHashedUrl(optional) – hashed LinkedIn profile URL of the person.companyHashedUrl(optional) – hashed LinkedIn company page URL.
attachments(optional) – array of media attachments. Maximum 9 items.url(required) – publicly accessible URL of the file to attach.type(required) – type of attachment:image,video, ordocument.name(required when type isdocument) – display name for the document.
companyUrl(optional) – LinkedIn company page URL. When provided, the post will be published on behalf of the company. Requires content admin access to the company page.then(optional) – object or array of child actions to be executed on the created post.
Mention rules
- Provide at most one of
urn,personHashedUrlandcompanyHashedUrlper mention. - Every
@[key]in the text must have a matching mention, and every mention must appear in the text. - Two mentions cannot share the same
key. nameis required even when an identifier is given, because LinkedIn resolves a mention through its own name suggestions. The identifier only decides which of the offered namesakes is taken. See publishing posts for the full explanation.
Attachment limits
- Maximum 9 images per post (JPEG, PNG, GIF, WebP, max 8mb).
- Maximum 1 video per post (MP4, MOV, WebM, max 200 mb).
- Maximum 1 document per post (PDF, max 100 mb).
- Cannot mix different attachment types (e.g., images and video together).
Result options
- Successful post creation:
{
"actionType": "st.createPost",
"label": "post1",
"success": true,
"data": {
"postUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789",
"postUrn": "urn:li:activity:1234567890123456789",
"then": { ... }
}
}label– included only if specified in the action parameters.data.postUrl– URL of the created post.data.postUrn– URN of the created post.data.then– results of child actions execution.
postUrlandpostUrnarenullwhen the post was published but LinkedIn did not return its address. In that case the child actions inthendid not run. Do not retry: the post is already live.
- Failed post creation:
{
"actionType": "st.createPost",
"label": "weeklyUpdate1",
"success": false,
"error": {
"type": "companyNotFound",
"message": "Provided URL is not an existing LinkedIn company."
}
}label– included only if specified in the action parameters.error.type– enum with the following possible values:textTooLong– post text exceeds 3000 characters limit.companyNotFound– specified company page was not found on LinkedIn.noPostingPermission– no permission to post on behalf of this company.mentionNotResolved– a person or company the post text mentions was not among the options LinkedIn offered for that name. Nothing was published.unsupportedAttachmentType– attachment type is not supported. Useimage,video, ordocument.missingDocumentName– document attachment requires anamefield.urlNotAccessible– attachment URL is not publicly accessible or returned an error.fileTooLarge– attachment file exceeds the maximum allowed size.unsupportedMimeType– file's MIME type is not supported by LinkedIn.tooManyAttachments– more than 9 attachments were provided.mixingNotAllowed– cannot mix different attachment types (e.g., images with video).