---
docId: doc_cc6f26d92ae649cfa027d22caeaaee52
title: Moderate comments
description: "Moderate comments at Meta and in the Platica inbox."
api:
  group: publicaciones
  auth: bearer
  operations:
    - operationId: moderatePostComment
      method: POST
      path: '/v1/posts/{postId}/comments/{commentId}/moderation'
      postmanName: Moderate a Comment
---

<script>
  import { Ways, Note } from '$lib/components';
</script>

# Moderate comments

Apply moderation at Meta and in Platica at the same time. You can protect a post even when the workspace has a pending payment.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X POST https://api.platic.ai/v1/posts/$POST_ID/comments/$COMMENT_ID/moderation \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "action": "hide" }'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.posts.comments.moderate("post_123", "comment_123", "hide");
```

</Ways.Way>
</Ways>

## Request body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `action` | string | ✓ | `hide`, `unhide`, `delete`, `spam` or `unspam` |

| Action | What it does |
|--------|--------------|
| `hide` / `unhide` | Hides the comment from the public, or shows it again |
| `delete` | Deletes it from Meta. It cannot be undone |
| `spam` | Hides it, blocks the contact and, if it is the root comment, resolves the thread |
| `unspam` | Reverts `spam` and reopens the thread if it had been resolved for spam |

```json
{
  "action": "hide"
}
```

## Response

`data` contains the comment's moderation state, with `message: "Comment moderated"`. You also receive `comment.updated` or `comment.deleted` through [webhooks](/api-reference/webhooks/payloads).

<Note type="warning">

With `COMMENT_META_MODERATION_FAILED` and `details.localStatePersisted: true`, Platica saved the moderation in the inbox, but Meta did not apply it. Retry the same call.

</Note>

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | `action` is not valid, or the credential covers several workspaces and `workspace` is missing |
| `404` | `NOT_FOUND` | The post or the comment does not exist in the workspace |
| `422`, `429`, `502` or `504` | `COMMENT_META_MODERATION_FAILED` | Meta rejected the moderation, rate limited requests, failed or did not answer. Platica already saved it in the inbox (`details.localStatePersisted: true`). See the warning above |

See [errors](/api-reference/posts#errors) for the codes in this section.
