> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opigno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get post comments

The list of post comments should be retrieved by a separate request, calling `getPostComments` query.

The query returns the list of comments related to the given post with the pagination and possibility
to change the order (default sorting is by the creation date, ascending).

<Note>
  A comment is basically a [`Post`](/OpignoEnterpriseAPI/Post/GetPost) object.
</Note>

The following arguments can be used in the query:

| Argument  | Type      | Description                                                                                                                              | Default |
| :-------- | :-------- | :--------------------------------------------------------------------------------------------------------------------------------------- | :------ |
| `postId`  | `Int`     | **Required**.  The post ID to get the related comments.                                                                                  | —       |
| `after`   | `Cursor`  | Returns results that come after the specified cursor. Should be used together with `first` parameter. Cannot be used if `before` is set. | —       |
| `before`  | `Cursor`  | Returns results that come before the specified cursor. Should be used together with `last` parameter. Cannot be used if `after` is set.  | —       |
| `first`   | `Integer` | Returns up to the first N elements from the list. Required if `after` parameter is set. Cannot be used together with `last`.             | —       |
| `last`    | `Integer` | Returns up to the first N elements from the list. Required if `before` parameter is set. Cannot be used together with `first`.           | —       |
| `reverse` | `Boolean` | Allows to change the order of the sorting to `DESC`.                                                                                     | `false` |

<CodeGroup>
  ```filename GraphQL theme={null}
    query getPostComments {
      getPostComments(postId: 169, first: 2) {
        edges {
          node {
            id
            text
            created
            isLiked
            likesNumber
            parentPost {
              id
            }
            authorUserContext {
              id
              uuid
            }
            cta {
              actionId
              title
              arguments {
                key
                value
              }
            }
          }
        }
        pageInfo {
          hasNextPage
          hasPreviousPage
          endCursor
        },
        totalItems
      }
    }
  ```

  ```File Query result [expandable] theme={null}
    {
      "data": {
        "getPostComments": {
          "edges": [
            {
              "node": {
                "id": "172",
                "text": "<p>comment from admin</p>\n",
                "created": 1751556345,
                "isLiked": false,
                "likesNumber": 0,
                "parentPost": {
                  "id": "169"
                },
                "authorUserContext": {
                  "id": "915",
                  "uuid": "5acfc440-88e0-4286-b089-c0f03575ed9a"
                },
                "cta": [
                  {
                    "actionId": "EDIT_POST",
                    "title": "Edit the comment",
                    "arguments": [
                      {
                        "key": "postId",
                        "value": "172"
                      }
                    ]
                  },
                  {
                    "actionId": "DELETE_POST",
                    "title": "Delete the comment",
                    "arguments": [
                    {
                      "key": "postId",
                      "value": "172"
                    }
                    ]
                  },
                  {
                    "actionId": "TOGGLE_LIKE",
                    "title": "Toggle like",
                    "arguments": [
                      {
                        "key": "postId",
                        "value": "172"
                      }
                    ]
                  }
                ]
              }
            },
            {
              "node": {
                "id": "173",
                "text": "<p>my comment</p>\n",
                "created": 1751556364,
                "isLiked": false,
                "likesNumber": 0,
                "parentPost": {
                  "id": "169"
                },
                "authorUserContext": {
                  "id": "3302",
                  "uuid": "fddab9cc-9379-4e39-b058-5709f0915ace"
                },
                "cta": [
                  {
                    "actionId": "DELETE_POST",
                    "title": "Delete the comment",
                    "arguments": [
                      {
                        "key": "postId",
                        "value": "173"
                      }
                    ]
                  },
                  {
                    "actionId": "TOGGLE_LIKE",
                    "title": "Toggle like",
                    "arguments": [
                      {
                        "key": "postId",
                        "value": "173"
                      }
                    ]
                  },
                  {
                    "actionId": "REMOVE_CONNECTION",
                    "title": "Remove from connections",
                    "arguments": [
                      {
                        "key": "userContextUuid",
                        "value": "fddab9cc-9379-4e39-b058-5709f0915ace"
                      }
                    ]
                  }
                ]
              }
            }
          ],
          "pageInfo": {
            "hasNextPage": false,
            "hasPreviousPage": false,
            "endCursor": "TzozMzoiRHJ1cGFsXG9waWdub19hcGlcV3JhcHBlcnNcQ3Vyc29yIjo0OntzOjE0OiIAKgBiYWNraW5nVHlwZSI7czoxMToib3BpZ25vX3Bvc3QiO3M6MTI6IgAqAGJhY2tpbmdJZCI7aToxNzM7czoxMDoiACoAc29ydEtleSI7czo3OiJjcmVhdGVkIjtzOjEyOiIAKgBzb3J0VmFsdWUiO2k6MTc1MTU1NjM2NDt9"
          },
          "totalItems": 2
        }
      }
    }
  ```
</CodeGroup>

The query returns the list of the `Post` objects. Detailed description and the full list of available properties can be found [here](/OpignoEnterpriseAPI/Post/GetPost).
