# Hide or like comment

> Hide, unhide, like, or unlike a comment.

Canonical: <https://www.tryadeli.com/docs/api/comments/update-comment>

`PATCH https://app.tryadeli.com/api/v1/comments/{commentId}`

Authorization: `Bearer <API key>` — see [Authentication](https://www.tryadeli.com/docs/authentication)

**Path parameters**

| Name        | Type     | Required | Description                                                                                                                                                                    |
| ----------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `commentId` | `string` | Yes      | The provider's comment id: a numeric string everywhere but YouTube, whose ids are URL-safe base64. One that does not match the platform's format returns 400 invalid\_request. |

**Body**

| Name        | Type                                                 | Required | Description                                                                       |
| ----------- | ---------------------------------------------------- | -------- | --------------------------------------------------------------------------------- |
| `platform`  | `"instagram" \| "facebook" \| "tiktok" \| "youtube"` | Yes      |                                                                                   |
| `accountId` | `uuid`                                               | Yes      |                                                                                   |
| `profileId` | `uuid`                                               |          | Optional, because accountId names its profile. If you pass both, they must agree. |
| `hidden`    | `boolean`                                            |          | Hide (true) or unhide (false).                                                    |
| `liked`     | `boolean`                                            |          | TikTok only. Like (true) or unlike (false).                                       |
| `postId`    | `string`                                             |          | TikTok only, required with hidden: the post the comment is on.                    |

On YouTube, `hidden: true` holds the comment for review, where only the channel
sees it, and `hidden: false` publishes it again. `liked` returns
`422 not_supported` on every platform but TikTok.

Send at least one of `hidden` and `liked`. Returns `200` with the new state:
`{ platform, accountId, profileId, comment: { id, hidden?, liked? } }`.

**Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`,
`422 connection_expired`, `422 not_supported`, `429 rate_limited`,
`502 provider_error`.

## Request examples

**cURL**

```bash
curl --fail-with-body -X PATCH "https://app.tryadeli.com/api/v1/comments/7301000000000000001" \
  -H "Authorization: Bearer $ADELI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "platform": "tiktok",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "postId": "7300000000000000000",
  "hidden": true
}'
```

**JavaScript**

```javascript
const response = await fetch("https://app.tryadeli.com/api/v1/comments/7301000000000000001", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    platform: "tiktok",
    accountId: "00000000-0000-0000-0000-000000000000",
    postId: "7300000000000000000",
    hidden: true,
  }),
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

response = requests.patch(
    "https://app.tryadeli.com/api/v1/comments/7301000000000000001",
    headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"},
    json={
        "platform": "tiktok",
        "accountId": "00000000-0000-0000-0000-000000000000",
        "postId": "7300000000000000000",
        "hidden": True,
    },
)
print(response.json())
```

## Responses

### 200

```json
{
  "platform": "tiktok",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "profileId": "00000000-0000-4000-8000-000000000001",
  "comment": { "id": "7301000000000000001", "hidden": true }
}
```

### 422

```json
{
  "error": {
    "code": "not_supported",
    "message": "Instagram comments cannot be liked through this API"
  }
}
```
