# st.createRepost

> The API Reference is also the SDK and CLI reference. Consecutive code fences marked `tab=HTTP`, `tab=Node`, `tab=Python` and `tab=CLI` are the same call on each surface (a fence marked `tab=HTTP,CLI` is the same text for both), and a block between `:::surface <names>` and `:::` applies only to the surfaces it names. Identifiers in the text are written as in Node and in HTTP JSON (camelCase); the Python SDK spells methods, parameters and result attributes in snake_case (`sendMessage` → `send_message`, `reconnectionLink` → `reconnection_link`), while names inside HTTP JSON stay camelCase.

This action allows you to repost someone else's post or your own. You can repost it as is, or add your own commentary with optional mentions of people and companies.

:::surface node,python
In the SDK this is the `createRepost` method. It takes the parameters below except `label` and `then`, which exist only in workflow JSON, and returns the result below in `data`.
:::

:::surface cli
In the CLI this is `linkedin post repost` – the command is below, under [Parameters](#parameters).
:::

## Constraints

> ⏺️ **Root Start:** allowed, when `postUrl` or `postUrn` parameter is provided.

> ⬆️ **Parent Actions:** [st.openPost](/docs/action-st-open-post), [st.doForPosts](/docs/action-st-do-for-posts).

> ⬇️ **Child Actions:** N/A.

## Parameters

```json tab=HTTP
{
  "actionType": "st.createRepost",
  "label": "repost1",
  "postUrl": "https://www.linkedin.com/posts/post1",
  "text": "Worth reading, especially the part on onboarding. Great work @[author]!",
  "mentions": [
    {
      "key": "author",
      "name": "Example Person",
      "personHashedUrl": "https://www.linkedin.com/in/ACwAAAxxxxxxxxx"
    }
  ]
}
```

```typescript tab=Node
const workflow = await linkedapi.createRepost.execute({
  postUrl: "https://www.linkedin.com/posts/post1",
  text: "Worth reading, especially the part on onboarding. Great work @[author]!",
  mentions: [
    {
      key: "author",
      name: "Example Person",
      personHashedUrl: "https://www.linkedin.com/in/ACwAAAxxxxxxxxx"
    }
  ]
});

const { data, errors } = await linkedapi.createRepost.result(workflow.workflowId);
```

```python tab=Python
from linkedapi import CreateRepostParams

workflow = linkedapi.create_repost.execute(
    CreateRepostParams(
        post_url="https://www.linkedin.com/posts/post1",
        text="Worth reading, especially the part on onboarding. Great work @[author]!",
        mentions=[
            {
                "key": "author",
                "name": "Example Person",
                "person_hashed_url": "https://www.linkedin.com/in/ACwAAAxxxxxxxxx",
            },
        ],
    )
)

result = linkedapi.create_repost.result(workflow.workflow_id)
```

```bash tab=CLI
linkedin post repost https://www.linkedin.com/posts/post1 \
  --text 'Worth reading, especially the part on onboarding. Great work @[author]!' \
  --mention "author:Example Person:https://www.linkedin.com/in/ACwAAAxxxxxxxxx"
```

In AI assistants, the MCP server runs this action as the `create_repost` tool.

:::surface cli
In the CLI this is `linkedin post repost`:

```bash
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](/docs/action-st-create-post?surface=cli#parameters). 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`.
:::

- `label` (optional) – custom label for tracking this action in workflow completion.
- `postUrl` (required for root start unless `postUrn` is provided, forbidden for parent start) – LinkedIn URL of the post to repost.
- `postUrn` (optional) – [URN](/docs/data-conventions#linkedin-urns) of the post, accepted instead of `postUrl`. When both are provided, the URL must contain that same URN.
- `text` (optional) – your own commentary, up to **3000** characters. Without it the post is reposted as is.
- `mentions` (optional) – people and companies to mention in `text`. Write `@[key]` where the mention should appear, and describe that `key` here. 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](/docs/data-conventions#linkedin-urns) 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.

### Mention rules

- Provide at most one of `urn`, `personHashedUrl` and `companyHashedUrl` per 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`.
- `name` is 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](/docs/publishing-posts) for the full explanation.

## Result options

1. **Successful repost:**

```json
{
  "actionType": "st.createRepost",
  "label": "repost1",
  "success": true,
  "data": {
    "postUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789",
    "postUrn": "urn:li:activity:1234567890123456789"
  }
}
```

- `label` – included only if specified in the action parameters.
- `data.postUrl` – URL of the repost. A repost is a post of your own account, so this is not the URL of the post you reposted.
- `data.postUrn` – [URN](/docs/data-conventions#linkedin-urns) of the repost.

> `postUrl` and `postUrn` are `null` when the repost was published but LinkedIn did not return its address. Do not retry: the repost is already live.

2. **Failed repost:**

```json
{
  "actionType": "st.createRepost",
  "label": "repost1",
  "success": false,
  "error": {
    "type": "alreadyReposted",
    "message": "LinkedIn declined this repost because the account has already reposted this post."
  }
}
```

- `label` – included only if specified in the action parameters.
- `error.type` – enum with the following possible values:
  - `postNotFound` – provided URL is not an existing LinkedIn post.
  - `repostNotAllowed` – LinkedIn offers no repost control for this post.
  - `alreadyReposted` – the account has already reposted this post and LinkedIn declined to repost it again.
  - `mentionNotResolved` – a person or company the text mentions was not among the options LinkedIn offered for that name.
