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

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

# Toggle Comments

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

This endpoint allows you to enable or disable comments on an Instagram post.

**Settings**:

| Setting | Value |
| --- | --- |
| URL | `https://api.99digital.co.il/instagram/page/toggleComments` |
| 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 do the action on: the mediaId you received from [Create Post](https://docs.99digital.co.il/facebook-api/instagram-pages/create-post), or the post's id in [All Posts](https://docs.99digital.co.il/facebook-api/instagram-pages/all-posts) | yes | 15625364215_56994166514 |
| enabled | 1 for allow comments. 0 for disable comments. If you leave it out, comments are allowed. true / false work too, as a number or a string; any other value returns reason 8 | no (default 1) | 1 |

**Response**:

```json
{
  "status": "OK",
  "mediaId": "15234562345623_952362434423178",
  "enabled": true,
  "timestamp": 1600115719,
  "from": "463745743546345",
  "reason": 1
}
```

**Response-Explain**:

| Parameter | Description |
| --- | --- |
| status | OK or FAIL |
| mediaId | The media ID of the post you changed |
| timestamp | Time stamp of the message |
| from | Your ID for the service |
| enabled | true if comments are now allowed on the post. false if they are disabled |

**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 is missing (or is not a valid media 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 | 'enabled' is not 1 or 0 (or true / false) |
| 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 media ID you provided is invalid or wrong: the post was not found, or it is not accessible |
| 15 | Meta rejected the request: an invalid parameter, or a policy violation |
| 18 | General error / wrong information or bad payload. Please check the payload again and 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 | Yes | The media ID you wish to do the action on — the `mediaId` you received from [Create Post](https://docs.99digital.co.il/facebook-api/instagram-pages/create-post), or the post's `id` in [All Posts](https://docs.99digital.co.il/facebook-api/instagram-pages/all-posts). Example: `17895695668004550`. |
| `enabled` | integer | No | Whether people can comment on the post: 1 for allow comments, 0 for disable comments. If you leave it out, comments are allowed. `true` / `false` work too, as a number or a string; any other value returns reason 8. One of: `0` — Disable comments — nobody can comment on the post; `1` — Allow comments — people can comment on the post. Default: `1`. |

### Example: Disable comments

Nobody can comment on the post.

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

### Example: Enable comments

People can comment on the post again.

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

## 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 change was made. 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`. |
| `mediaId` | string | (one of: OK) The media ID of the post you changed. Example: `17895695668004550`. |
| `enabled` | boolean | (one of: OK) `true` if comments are now allowed on the post. `false` if they are disabled. |
| `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 is missing (or is not a valid media 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` — 'enabled' is not 1 or 0 (or true / false); `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 media ID you provided is invalid or wrong: the post was not found, or it is not accessible; `15` — Meta rejected the request: an invalid parameter, or a policy violation; `18` — General error / wrong information or bad payload. Please check the payload again and 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

Comments are disabled on the post.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "timestamp": 1600115719,
  "reason": 1,
  "mediaId": "17895695668004550",
  "enabled": false
}
```

#### Example: OK — enabled

Comments are allowed on the post again.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "timestamp": 1600115719,
  "reason": 1,
  "mediaId": "17895695668004550",
  "enabled": true
}
```

#### Example: Reason 3

Wrong apiKey.

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

#### Example: Reason 13

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

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