# st.openPost

> 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 open a post to retrieve its data and perform additional post-related actions if needed.

:::surface node
In the Node SDK this is `linkedapi.fetchPost` – the call is below, under [Parameters](#parameters).
:::

:::surface python
In the Python SDK this is `linkedapi.fetch_post` – the call is below, under [Parameters](#parameters).
:::

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

## Constraints

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

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

> ⬇️ **Child Actions:** [st.reactToPost](/docs/action-st-react-to-post), [st.createRepost](/docs/action-st-create-repost), [st.commentOnPost](/docs/action-st-comment-on-post), [st.retrievePostComments](/docs/action-st-retrieve-post-comments), [st.retrievePostReactions](/docs/action-st-retrieve-post-reactions).

## Parameters

```json tab=HTTP
{
  "actionType": "st.openPost",
  "label": "post1",
  "postUrl": "https://www.linkedin.com/posts/post1",
  "basicInfo": true,
  "then": { ... }
}
```

```typescript tab=Node
const workflow = await linkedapi.fetchPost.execute({
  postUrl: "https://www.linkedin.com/posts/post1"
});

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

```python tab=Python
from linkedapi import FetchPostParams

workflow = linkedapi.fetch_post.execute(
    FetchPostParams(
        post_url="https://www.linkedin.com/posts/post1",
    )
)

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

```bash tab=CLI
linkedin post fetch https://www.linkedin.com/posts/post1
```

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

:::surface node,python
In the SDK this is the `fetchPost` method. It always returns basic information: `basicInfo`, like `label` and `then`, exists only in workflow JSON. It takes the other parameters below and returns the result below in `data`.

Each `retrieve…` flag of `fetchPost` adds one child action, and its data comes back under its own property of `data`:

| Flag | Child action | Configuration | Property of `data` |
| --- | --- | --- | --- |
| `retrieveComments` | [`st.retrievePostComments`](/docs/action-st-retrieve-post-comments) | `commentsRetrievalConfig`: `limit`, `sort`, `replies` | `comments` |
| `retrieveReactions` | [`st.retrievePostReactions`](/docs/action-st-retrieve-post-reactions) | `reactionsRetrievalConfig`: `limit` | `reactions` |

A configuration object takes effect only with its flag set to `true`, and takes the parameters of its child action – their defaults and limits are on the child's page. For example, the 20 most recent comments with their replies:
:::

:::surface node
```typescript
const workflow = await linkedapi.fetchPost.execute({
  postUrl: "https://www.linkedin.com/posts/post1",
  retrieveComments: true,
  commentsRetrievalConfig: { limit: 20, sort: "mostRecent", replies: true }
});
```
:::

:::surface python
```python
from linkedapi import FetchPostParams

workflow = linkedapi.fetch_post.execute(
    FetchPostParams(
        post_url="https://www.linkedin.com/posts/post1",
        retrieve_comments=True,
        comments_retrieval_config={"limit": 20, "sort": "mostRecent", "replies": True},
    )
)
```
:::

:::surface node,python
When a child action fails, its error comes back in `errors` and the rest of `data` is still returned.
:::

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

```bash
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 includes `commentUrn` and `commentUrl`. Pass a `commentUrl` to `comment react` / `comment reply` to engage with that comment.
:::

- `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.
- `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.
- `basicInfo` (optional, default: `false`) – when set to `true`, the action includes basic post information in the results.
- `then` (optional) – object or array of child actions to be executed within this action.

## Result options

1. **Successful post opening with `basicInfo` set to `true`:**

```json
{
  "actionType": "st.openPost",
  "label": "post1",
  "success": true,
  "data": {
    "url": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789",
    "activityUrn": "urn:li:activity:1234567890123456789",
    "time": "2023-01-02T12:30:00Z",
    "type": "original",
    "author": {
      "type": "person",
      "name": "Example Person",
      "urn": "urn:li:member:123456789",
      "profileUrl": "https://www.linkedin.com/in/example-person",
      "headline": "Product Marketing Lead",
      "viewerState": { "connectionDegree": "2nd" }
    },
    "reposter": null,
    "text": "Check out our latest product launch!",
    "repostText": null,
    "hashtags": ["product", "launch"],
    "mentions": ["https://www.linkedin.com/company/example-company"],
    "externalLinks": ["https://example.com/launch"],
    "images": [
      "https://static.linkedin.com/image1.jpg",
      "https://static.linkedin.com/image2.jpg"
    ],
    "documentSlides": [],
    "hasVideo": false,
    "videoThumbnail": null,
    "hasPoll": false,
    "reactionsCount": 27,
    "commentsCount": 8,
    "repostsCount": 12,
    "viewerState": { "reaction": "like", "isOwn": false },
    "then": { ... }
  }
}
```

- `label` – included only if specified in the action parameters.
- `data` – basic information about the post and results of child actions execution.
  - `url` – URL of the post.
  - `activityUrn` – LinkedIn activity or UGC URN of the post, if available.
  - `time` – timestamp when the post was published.
  - `type` – type of the post. Enum with possible values:
    - `original` – for original posts.
    - `repost` – for reposts.
  - `author` – original content creator. Can be `null` if the actor cannot be parsed.
    - For person authors: `type`, `name`, `urn`, `profileUrl`, `headline`, `viewerState` with `connectionDegree` – `1st`, `2nd`, `3rd+`, or `null` if LinkedIn does not show it (see [viewer state](/docs/data-conventions#viewer-state)).
    - For company authors: `type`, `name`, `urn`, `companyUrl`.
  - `reposter` – person or company that reshared the post. Non-null only when `type` is `repost`.
    - For person reposters: `type`, `name`, `urn`, `profileUrl`, `headline`.
    - For company reposters: `type`, `name`, `urn`, `companyUrl`.
  - `urn` on an actor – [URN](/docs/data-conventions#linkedin-urns) of that person or company, or `null` when LinkedIn does not expose an identifier for the actor.
  - `text` – original author's post text, if available.
  - `repostText` – text added by the reposter on a repost with comment, if available.
  - `hashtags` – array of hashtags found in the post text, without leading `#`.
  - `mentions` – array of person and company profile URLs found in the post text.
  - `externalLinks` – array of outbound URLs found in the post text.
  - `images` – array of up to 3 preview image URLs, if available.
  - `documentSlides` – array of carousel or document slide image URLs, if available.
  - `hasVideo` – boolean indicating if the post contains a video.
  - `videoThumbnail` – URL of the video thumbnail, if available.
  - `hasPoll` – boolean indicating if the post contains a poll.
  - `reactionsCount` – number of reactions on the post.
  - `commentsCount` – number of comments on the post.
  - `repostsCount` – number of reposts on the post.
  - `viewerState` – what your account has done with the post, see [viewer state](/docs/data-conventions#viewer-state).
    - `reaction` – your reaction to the post (`like`, `celebrate`, `support`, `love`, `insightful`, `funny`), or `null` if you have not reacted or it could not be read.
    - `isOwn` – `true` if your account is the post author, `false` if someone else is, or `null` if this cannot be told.
  - `then` – results of child actions execution.

> This action reads actor identifiers from the post page itself, so it resolves `urn` for actors that post listings such as [st.retrieveFeed](/docs/action-st-retrieve-feed) or [st.retrievePersonPosts](/docs/action-st-retrieve-person-posts) cannot. If you need URNs for the authors of many posts, open the posts you care about rather than relying on the listing alone.

2. **Successful repost opening with `basicInfo` set to `true`:**

```json
{
  "actionType": "st.openPost",
  "label": "post1",
  "success": true,
  "data": {
    "url": "https://www.linkedin.com/feed/update/urn:li:activity:2345678901234567890",
    "activityUrn": "urn:li:activity:2345678901234567890",
    "time": "2023-01-03T09:15:00Z",
    "type": "repost",
    "author": {
      "type": "company",
      "name": "Example Company",
      "urn": "urn:li:organization:1234567",
      "companyUrl": "https://www.linkedin.com/company/example-company"
    },
    "reposter": {
      "type": "person",
      "name": "Example Reposter",
      "urn": "urn:li:member:234567890",
      "profileUrl": "https://www.linkedin.com/in/example-reposter",
      "headline": null
    },
    "text": "Original post content about the webinar.",
    "repostText": "A useful summary for anyone planning a launch.",
    "hashtags": [],
    "mentions": [],
    "externalLinks": [],
    "images": [],
    "documentSlides": [],
    "hasVideo": true,
    "videoThumbnail": "https://media.licdn.com/dms/image/video-cover.jpg",
    "hasPoll": false,
    "reactionsCount": 6,
    "commentsCount": 0,
    "repostsCount": 1,
    "viewerState": { "reaction": null, "isOwn": false },
    "then": { ... }
  }
}
```

3. **Successful post opening with `basicInfo` set to `false`:**

```json
{
  "actionType": "st.openPost",
  "label": "post1",
  "success": true,
  "data": {
    "then": { ... }
  }
}
```

- `label` – included only if specified in the action parameters.
- `data.then` – results of child actions execution.

4. **Failed post opening:**

```json
{
  "actionType": "st.openPost",
  "label": "post1",
  "success": false,
  "error": {
    "type": "postNotFound",
    "message": "The provided URL is not an existing LinkedIn 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.
