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

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

# Create Comment

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

This endpoint allows you to create a comment on an existing post.

You can either comment on the post itself (it is called "top level comment") or comment on a comment (it is called "reply comment").

**Settings**:

| Setting | Value |
| --- | --- |
| URL | `https://api.99digital.co.il/instagram/page/createComment` |
| 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 media ID you wish to comment on (if top level comment) | no\* | 15625364215_56994166514 |
| commentId | The comment ID you wish to comment on (if reply comment) | no\* | 652346734563_3463234623 |
| body | The body of the comment. It can have plain text only and `\n` for a line break. Maximum 2,200 characters | yes | Thank you for the comment! |

\* You need to provide either the mediaId or the commentId, not both. If both are provided, the system will use the commentId (reply comment).

**Response**:

```json
{
  "status": "OK",
  "commentId": "15234562345623_952362434423178",
  "target": "15234562345623_425235245346",
  "body": "Thank you for the comment!",
  "timestamp": 1600115719,
  "from": "463745743546345",
  "reason": 1
}
```

**Response-Explain**:

| Parameter | Description |
| --- | --- |
| status | OK or FAIL |
| target | The original mediaId or commentId provided in the request (the commentId, if you sent both) |
| commentId | The new commentId created. You can use it to reply to the comment |
| timestamp | Time stamp of the message |
| from | Your ID for the service |
| body | The comment you wrote |

**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) |
| 5 | Missing or invalid content: the 'body' is missing or empty |
| 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 | The "body" is more than 2,200 characters long |
| 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 | The content you posted was rejected by Meta, or bad media / format / size, or an invalid parameter. It could also indicate a policy violation inside the content |
| 18 | General error, try again |

## 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 media ID you wish to comment on (if top level comment). You need to provide either the `mediaId` or the `commentId`, not both. Example: `17895695668004550`. |
| `commentId` | string | No | The comment ID you wish to comment on (if reply comment). You need to provide either the `mediaId` or the `commentId`, not both; if both are provided, the system uses the `commentId`. Example: `17870913679156914`. |
| `body` | string | Yes | The body of the comment. It can have plain text only and `\n` for a line break. Maximum 2,200 characters. Max length: 2200. Example: `Thank you for the comment!`. |

### Example: Top level comment

A comment on the post itself, by its `mediaId`.

```json
{
  "from": "463745743546345",
  "mediaId": "17895695668004550",
  "body": "Thank you for the comment!"
}
```

### Example: Reply comment

A comment on a comment, by its `commentId`.

```json
{
  "from": "463745743546345",
  "commentId": "17870913679156914",
  "body": "Thank you for the comment!\nWe will send you the details soon."
}
```

## 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 comment was created. Always `OK`. |
| `from` | string | (one of: OK) Your ID for the service. Example: `463745743546345`. |
| `timestamp` | integer | (one of: OK) Time stamp of the message (Unix time, in seconds). Example: `1600115719`. |
| `target` | string | (one of: OK) The original mediaId or commentId provided in the request (the commentId, if you sent both). Example: `17895695668004550`. |
| `commentId` | string | (one of: OK) The new commentId created. You can use it to reply to the comment. Example: `17870913679157777`. |
| `body` | string | (one of: OK) The comment you wrote. Example: `Thank you for the comment!`. |
| `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); `5` — Missing or invalid content — the 'body' is missing or empty; `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` — The 'body' is more than 2,200 characters long; `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` — The content you posted was rejected by Meta, or bad media / format / size, or an invalid parameter. It could also indicate a policy violation inside the content; `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 top level comment was created.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "timestamp": 1600115719,
  "reason": 1,
  "target": "17895695668004550",
  "commentId": "17870913679157777",
  "body": "Thank you for the comment!"
}
```

#### Example: OK — reply comment

The reply was created; `target` is the comment you replied to.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "timestamp": 1600115719,
  "reason": 1,
  "target": "17870913679156914",
  "commentId": "17870913679158888",
  "body": "Thank you for the comment!\nWe will send you the details soon."
}
```

#### Example: Reason 4

'mediaId' or 'commentId' is missing.

```json
{
  "status": "FAIL",
  "reason": 4
}
```

#### Example: Reason 5

'body' is missing or empty.

```json
{
  "status": "FAIL",
  "reason": 5
}
```

#### Example: Reason 8

'body' is more than 2,200 characters long.

```json
{
  "status": "FAIL",
  "reason": 8
}
```

#### Example: Reason 13

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

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