# Comments

> Read, reply to, hide, like, and delete comments on Instagram, Facebook, TikTok, and YouTube posts.

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

Moderate the comments on your customer's own posts: read them, reply, hide the
ones that should not be seen, and delete.

**Reads come from Adeli's copy; writes go to the platform.** Adeli keeps each
connected account's recent posts and their comments, so listing comments
answers immediately instead of waiting on the platform. The copy is refreshed
from the platform in the background whenever it is read and is more than a
minute old (ten minutes on YouTube, whose quota is shared by every Adeli
customer), and Adeli updates it as soon as you reply, hide, like, or delete
through this API. Every response says when its comments were last refreshed
(`syncedAt`) and whether every thread is held yet (`complete`). Changes made
outside Adeli, such as a comment hidden in the Instagram app, appear after the
next refresh.

The four platforms do not allow the same things:

|                                   | Instagram                          | Facebook                        | TikTok                          | YouTube                                                                     |
| --------------------------------- | ---------------------------------- | ------------------------------- | ------------------------------- | --------------------------------------------------------------------------- |
| List comments and replies         | Yes                                | Yes                             | Yes, paged with `cursor`        | Yes, paged with `cursor`                                                    |
| Reply to a comment                | Yes                                | Yes                             | Yes                             | Yes                                                                         |
| Comment on the account's own post | No                                 | Yes                             | Yes                             | Yes                                                                         |
| Hide and unhide                   | Yes                                | Yes                             | Yes                             | Yes, by holding for review                                                  |
| Like and unlike                   | No                                 | No                              | Yes                             | No                                                                          |
| Delete                            | Any comment on the account's posts | Any comment on the Page's posts | Only comments the account wrote | The channel's own; anyone else's is rejected, optionally banning its author |

Comment ids and post ids are the provider's own: numeric strings everywhere but
YouTube, whose ids are URL-safe base64 (a reply's is `{parent}.{reply}`). Post ids
come from [`GET /api/v1/posts`](https://www.tryadeli.com/docs/api/posts) (`providerId`), or from the
`posts` that [List comments](https://www.tryadeli.com/docs/api/comments/list-comments) returns.

## Endpoints

- `GET /api/v1/comments` — [List comments](https://www.tryadeli.com/docs/api/comments/list-comments.md)
- `POST /api/v1/comments` — [Reply or comment](https://www.tryadeli.com/docs/api/comments/create-comment.md)
- `PATCH /api/v1/comments/{commentId}` — [Hide or like comment](https://www.tryadeli.com/docs/api/comments/update-comment.md)
- `DELETE /api/v1/comments/{commentId}` — [Delete comment](https://www.tryadeli.com/docs/api/comments/delete-comment.md)

## Permissions

Comment management needs a permission that connections made before it was
requested may lack. A read or write against such a connection returns
`422 connection_expired`; [reconnecting](https://www.tryadeli.com/docs/api/connect) the account and
approving the permission fixes it. On TikTok, reading needs `comment.list` and
writing needs `comment.list.manage`. On YouTube, both need
`youtube.force-ssl`, which every YouTube connection holds.

## YouTube quota

YouTube's API quota belongs to Adeli's Google Cloud project and is shared by
every connected channel: 10,000 units a day by default, reset at midnight
Pacific. A read costs 1 unit; every reply, comment, hide, and delete costs 50.
Once the day's quota is spent, YouTube calls return `429 quota_exhausted` with
the reset time, and reads keep answering from Adeli's copy.
