
## Delete a comment

`DELETE /v1/posts/:id/comments/:commentId`

Deletes a comment from a Feed post. A deleted comment cannot be restored via the API — create a new one if needed.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` | number | yes | Post ID (path parameter). List: [GET /v1/posts](/docs/feed/posts/list) |
| `commentId` | number | yes | Comment ID (path parameter). Returned in the response of [POST /v1/posts/:id/comments](/docs/feed/comments/add) |

## Examples

### curl — personal key

```bash
curl -X DELETE https://vibecode.bitrix24.com/v1/posts/118/comments/41 \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE https://vibecode.bitrix24.com/v1/posts/118/comments/41 \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/posts/118/comments/41', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
if (res.status === 204) {
  console.log('Comment deleted')
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/posts/118/comments/41', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
if (res.status === 204) {
  console.log('Comment deleted')
}
```

## Response

On successful deletion the API returns HTTP status `204 No Content` with an empty body. Success is indicated by the response code, not the content.

## Response example

```
HTTP/1.1 204 No Content
```

## Error response example

403 — no permission to delete:

```json
{
  "success": false,
  "error": {
    "code": "COMMENT_ACCESS_DENIED",
    "message": "No delete perms"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_COMMENT_ID` | An invalid comment identifier was provided |
| 403 | `COMMENT_ACCESS_DENIED` | No permission to delete this comment |
| 404 | `COMMENT_NOT_FOUND` | No comment found with the given `commentId` |
| 403 | `SCOPE_DENIED` | The API key lacks the `log` scope |
| 401 | `TOKEN_MISSING` | The API key has no access tokens configured |

The full list of common API errors — [Errors](/docs/errors).

## See also

- [Add a comment](/docs/feed/comments/add)
- [Comments](/docs/feed/comments)
- [Posts](/docs/feed/posts)
- [Errors](/docs/errors)
