# st.retrievePostComments

This action allows you to retrieve comments for a certain post.

## Constraints

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

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

> ⬇️ **Child Actions:** [st.doForComments](/docs/action-st-do-for-comments).

## Parameters

```json
{
  "actionType": "st.retrievePostComments",
  "postUrl": "https://www.linkedin.com/posts/post1",
  "replies": true,
  "limit": 10,
  "sort": "mostRelevant",
  "label": "post1Comments",
  "then": { ... }
}
```

- `postUrl` (required for root start, forbidden for parent start) – LinkedIn URL of the post.
- `replies` (optional, default: `true`) – when set to `true`, the action includes replies to the comments in the results.
- `limit` (optional) – number of comments to retrieve. Also applies to the replies if `replies` set to `true`. Defaults to **10**, with a maximum value of **500**.
- `sort` (optional, default: `mostRelevant`) – enum representing comments sorting. Options:
  - `mostRelevant` – show most relevant comments first.
  - `mostRecent` – show most recent comments first.
- `label` (optional) – custom label for tracking this action in workflow completion.
- `then` (optional) – object or array of child actions to be executed for each retrieved comment (see [st.doForComments](/docs/action-st-do-for-comments)).

## Result options

1. **Successful comments retrieval:**

```json
{
  "actionType": "st.retrievePostComments",
  "label": "post1Comments",
  "success": true,
  "data": [
    {
      "commentUrn": "urn:li:comment:(urn:li:activity:1234567890123456789,9876543210)",
      "commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(9876543210%2Curn%3Ali%3Aactivity%3A1234567890123456789)",
      "commenterUrl": "https://www.linkedin.com/in/john-doe",
      "commenterName": "John Doe",
      "commenterHeadline": "Product Manager",
      "commenterType": "person",
      "time": "3d",
      "text": "Great work!",
      "image": null,
      "isReply": false,
      "reactionsCount": 3,
      "repliesCount": 2
    },
    {
      "commentUrn": "urn:li:comment:(urn:li:activity:1234567890123456789,9876543211)",
      "commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(9876543211%2Curn%3Ali%3Aactivity%3A1234567890123456789)",
      "commenterUrl": "https://www.linkedin.com/in/person1",
      "commenterName": "Jane Doe",
      "commenterHeadline": "Helping companies to use AI",
      "commenterType": "person",
      "time": "3d",
      "text": "Agree with you!",
      "image": null,
      "isReply": true,
      "reactionsCount": 0,
      "repliesCount": 0
    },
    {
      "commentUrn": "urn:li:comment:(urn:li:activity:1234567890123456789,9876543212)",
      "commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(9876543212%2Curn%3Ali%3Aactivity%3A1234567890123456789)",
      "commenterUrl": "https://www.linkedin.com/company/company1",
      "commenterName": "CloseAI",
      "commenterHeadline": "2548 followers",
      "commenterType": "company",
      "time": "1w",
      "text": null,
      "image": "https://static.linkedin.com/image1.jpg",
      "isReply": false,
      "reactionsCount": 8,
      "repliesCount": 4
    }
  ]
}
```

- `label` – included only if specified in the action parameters.
- `data` – array of comments.
  - `commentUrn` – LinkedIn URN of the comment, if available. It can be used to build a `commentUrl` for comment-scoped actions.
  - `commentUrl` – canonical deep-link URL of the comment, if available. It can be used as the `commentUrl` input for [st.openComment](/docs/action-st-open-comment), [st.reactToComment](/docs/action-st-react-to-comment), or [st.replyToComment](/docs/action-st-reply-to-comment).
  - `commenterUrl` – public URL of the person or company.
  - `commenterName` – full name of the person or company.
  - `commenterHeadline` – headline of the person or company.
  - `commenterType` – commenter type. Enum with the following values:
    - `person` – commenter is a person.
    - `company` – commenter is a company.
  - `time` – relative time when the comment was posted, as shown by LinkedIn (e.g. `3d`, `1w`).
  - `text` – text of the comment, if available.
  - `image` – URL of an image attached to the comment, if available.
  - `isReply` – boolean indicating whether the comment is a reply to another comment.
  - `reactionsCount` – number of reactions on the comment.
  - `repliesCount` – number of replies to the comment.
  - `then` – results of child actions execution, present only when child actions are applied via [st.doForComments](/docs/action-st-do-for-comments).

2. **Failed comments retrieval:**

```json
{
  "actionType": "st.retrievePostComments",
  "success": false,
  "label": "post1",
  "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.
