<!-- Generated from the canonical 99 Digital API documentation. Do not edit this file. -->

Canonical page: https://docs.99digital.co.il/facebook-api/instagram-pages/all-comments

# All Comments

`POST https://api.99digital.co.il/instagram/page/getComments`

This endpoint allows you to see all the comments of a post or a comment in your page (comments that were created by the API or directly on Instagram).

**Settings**:

| Setting | Value |
| --- | --- |
| URL | `https://api.99digital.co.il/instagram/page/getComments` |
| Method | JSON via POST |
| Header | Your API key for the service (the `apiKey` header) |

**Body**:

| Parameter | Description / Example | Mandatory | Example |
| --- | --- | --- | --- |
| from | The ID you received for the connection | yes | 463745743546345 |
| mediaId | The post ID (media ID) you want to get the comments from | no\* | 15625364215_56994166514 |
| commentId | The comment ID you wish to get all the comments inside it (its replies) | no\* | 634645636423_5675674565 |
| limit | How many comments to get (limit pagination), between 1 and 100. Default if not provided: 25 | no | 25 |
| after | If you are using limit paging, you can provide the "after" value from the previous response to load the next batch | no | U56WDF34FA4TER3DA..... |

\* Either mediaId or commentId is required, not both. If you send both, the commentId is used.

**Response**:

```json
{
  "status": "OK",
  "from": "463745743546345",
  "target": "15625364215_56994166514",
  "count": 25,
  "comments": [{
    "id": "119324881085321_122093459712345",
    "text": "Hello fans!",
    "username": "some_user",
    "from": { "id": "1234567890", "username": "some_user" },
    "created_time": 1783596120,
    "like_count": 3,
    "hidden": false,
    "parent_id": "634532636346"
  }],
  "paging": { "after": "QVFIU...", "hasNext": true },
  "reason": 1
}
```

**Response-Explain**:

| Parameter | Description |
| --- | --- |
| status | OK or FAIL |
| count | Total comments in this batch |
| target | The mediaId or commentId you provided (the commentId, if you sent both) |
| from | Your ID for the service |

**comments** and **paging**:

| Value | Information |
| --- | --- |
| id | This is the commentId |
| text | The body of the comment |
| username | The username of the person that wrote the comment |
| from | id, username of the comment creator |
| created_time | Comment create time. UNIX UTC timestamp (int seconds) |
| like_count | The total likes this comment has |
| hidden | true - the comment is hidden in the page. false - this comment is live on Instagram |
| parent_id | The parent comment id (in case this is a comment to a comment). It is part of a reply only (when you send commentId) |
| paging | Key that contains two values: "after", which represents the parameter to send if you wish to get the next batch, and "hasNext", which is true if you have more data to load, or false if this is the last data |

**reason**:

| Value | Information |
| --- | --- |
| 1 | Not FAIL. The status is OK |
| 2 | Your "from" account does not exist (for example, its onboarding is not finished yet) or is missing, or JSON syntax error |
| 3 | Wrong apiKey (the apiKey header is missing or wrong) |
| 4 | mediaId or commentId is missing (or is not a valid ID) |
| 6 | Wrong connection type. Your keys/ID are correct, but you are using the wrong endpoint (for example: your onboarding was for Facebook Messenger, but you are using this Instagram endpoint) |
| 7 | The connection is not active (it was disabled) |
| 8 | "limit" is not a number between 1 and 100 |
| 10 | You must do the onboarding again, the connection has expired |
| 11 | A permission is missing: the connection does not have Meta's permission for this action |
| 12 | Rate limit error. Too many requests. Please wait a few minutes and try again |
| 13 | The mediaId or commentId is invalid or wrong: the post or comment was not found, or it is not accessible |
| 15 | Meta rejected the request: an invalid parameter, or a policy violation |
| 18 | General error, try again |

**Remarks**:

- Each comment's `id` is the `commentId` for
  [Create Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/create-comment),
  [Hide Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/hide-comment),
  [Delete Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/delete-comment) and
  [Private Reply](https://docs.99digital.co.il/facebook-api/instagram-pages/private-reply).

## Authentication

`apiKey` in the header — Your API key for the service.

## Request body

Content type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | Yes | The ID you received for the connection. Example: `463745743546345`. |
| `mediaId` | string | No | The post ID (media ID) you want to get the comments from. Either `mediaId` or `commentId` is required, not both. Example: `17895695668004550`. |
| `commentId` | string | No | The comment ID you wish to get all the comments inside it (its replies). Either `mediaId` or `commentId` is required, not both; if you send both, `commentId` is used. Example: `17870913679156914`. |
| `limit` | integer | No | How many comments to get (limit pagination), between 1 and 100. Default if not provided: 25. Default: `25`. Minimum: 1. Maximum: 100. Example: `25`. |
| `after` | string | No | If you are using limit paging, you can provide the `after` value from the previous response (`paging.after`) to load the next batch. Example: `QVFIUmF4YWJjZGVmZ2hpams`. |

### Example: Comments of a post

The comments of a post, by its `mediaId`.

```json
{
  "from": "463745743546345",
  "mediaId": "17895695668004550"
}
```

### Example: Replies to a comment

The comments inside a comment (its replies), by its `commentId`.

```json
{
  "from": "463745743546345",
  "commentId": "17870913679156914"
}
```

### Example: Next batch

The next 25 comments, with the `paging.after` value of the previous response.

```json
{
  "from": "463745743546345",
  "mediaId": "17895695668004550",
  "limit": 25,
  "after": "QVFIUmF4YWJjZGVmZ2hpams"
}
```

## Responses

### 200 — The request was processed. Both a successful and a failed request answer with HTTP 200 — check `status`, and `reason` when it is FAIL.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `status` | string | (one of: OK) OK or FAIL. `OK` — the request succeeded, and the comments of this batch are in `comments`. Always `OK`. |
| `from` | string | (one of: OK) Your ID for the service. Example: `463745743546345`. |
| `target` | string | (one of: OK) The mediaId or commentId you provided (the commentId, if you sent both). Example: `17895695668004550`. |
| `count` | integer | (one of: OK) Total comments in this batch. Example: `25`. |
| `comments` | array of object | (one of: OK) The comments of this batch. Empty when there are none. |
| `comments[].id` | string | (one of: OK) This is the commentId. Use it with [Create Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/create-comment), [Hide Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/hide-comment), [Delete Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/delete-comment) and [Private Reply](https://docs.99digital.co.il/facebook-api/instagram-pages/private-reply). Example: `17870913679156914`. |
| `comments[].text` | string | (one of: OK) The body (text) of the comment. |
| `comments[].username` | string | (one of: OK) The username of the person that wrote the comment. |
| `comments[].from` | object | (one of: OK) The id and username of the comment creator. |
| `comments[].from.id` | string | (one of: OK) The ID of the comment creator. |
| `comments[].from.username` | string | (one of: OK) The username of the comment creator. |
| `comments[].created_time` | integer | (one of: OK) Comment create time. UNIX UTC timestamp (int seconds). Example: `1783596120`. |
| `comments[].like_count` | integer | (one of: OK) The total likes this comment has. |
| `comments[].hidden` | boolean | (one of: OK) `true` — the comment is hidden in the page. `false` — this comment is live on Instagram. |
| `comments[].parent_id` | string | (one of: OK) The parent comment id (in case this is a comment to a comment). It is part of a reply only (when you send `commentId`). |
| `paging` | object | (one of: OK) Key that contains two values: `after`, which represents the parameter to send if you wish to get the next batch, and `hasNext`, which is true if you have more data to load, or false if this is the last data. |
| `paging.after` | string | (one of: OK) The parameter to send (as `after`) if you wish to get the next batch. Empty when there is nothing after this batch. |
| `paging.hasNext` | boolean | (one of: OK) `true` if you have more data to load, or `false` if this is the last data. |
| `reason` | integer | (one of: OK) 1 — not FAIL, the status is OK. Always `1`. |
| `status` | string | (one of: FAIL) FAIL — the request was not carried out. `reason` says why. Always `FAIL`. |
| `reason` | integer | (one of: FAIL) The status explanation in case of FAIL. One of: `2` — Your "from" account does not exist (for example, its onboarding is not finished yet) or is missing, or JSON syntax error; `3` — Wrong apiKey (the apiKey header is missing or wrong); `4` — mediaId or commentId is missing (or is not a valid ID); `6` — Wrong connection type. Your keys/ID are correct, but you are using the wrong endpoint (for example: your onboarding was for Facebook Messenger, but you are using this Instagram endpoint); `7` — The connection is not active (it was disabled); `8` — "limit" is not a number between 1 and 100; `10` — You must do the onboarding again, the connection has expired; `11` — A permission is missing: the connection does not have Meta's permission for this action; `12` — Rate limit error. Too many requests. Please wait a few minutes and try again; `13` — The `mediaId` or `commentId` is invalid or wrong: the post or comment was not found, or it is not accessible; `15` — Meta rejected the request: an invalid parameter, or a policy violation; `18` — General error, try again. |
| `from` | string | (one of: FAIL) Your ID for the service. Included only when Meta rejected the request (reasons 10 and up). Example: `463745743546345`. |

#### Example: OK

The comments of a post, with more to load.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "target": "17895695668004550",
  "count": 2,
  "comments": [
    {
      "id": "17870913679156914",
      "text": "Hello fans!",
      "username": "some_user",
      "from": {
        "id": "1234567890",
        "username": "some_user"
      },
      "like_count": 3,
      "hidden": false,
      "created_time": 1783596120
    },
    {
      "id": "17870913679156999",
      "text": "Is this available in blue?",
      "username": "another_user",
      "from": {
        "id": "1234567891",
        "username": "another_user"
      },
      "like_count": 0,
      "hidden": false,
      "created_time": 1783592520
    }
  ],
  "paging": {
    "after": "QVFIUmF4YWJjZGVmZ2hpams",
    "hasNext": true
  },
  "reason": 1
}
```

#### Example: Replies

The replies to a comment — each with its `parent_id`.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "target": "17870913679156914",
  "count": 1,
  "comments": [
    {
      "id": "17870913679157777",
      "text": "Thank you for the comment!",
      "username": "my_business",
      "from": {
        "id": "17841400000000000",
        "username": "my_business"
      },
      "like_count": 1,
      "hidden": false,
      "parent_id": "17870913679156914",
      "created_time": 1783599720
    }
  ],
  "paging": {
    "after": "QVFIUmVwbGllc2FiY2RlZg",
    "hasNext": false
  },
  "reason": 1
}
```

#### Example: No comments

Nothing to show.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "target": "17895695668004550",
  "count": 0,
  "comments": [],
  "paging": {
    "after": "",
    "hasNext": false
  },
  "reason": 1
}
```

#### Example: Reason 13

The post or comment was not found, or it is not accessible.

```json
{
  "status": "FAIL",
  "reason": 13,
  "from": "463745743546345"
}
```
