# Posts

Reading an employee's comments on all posts in the Bitrix24 Feed: text, files and the identifiers for deleting a comment.

**Scope:** `log` | **Base URL:** `https://vibecode.bitrix24.com/v1` | **Authorization:** `X-Api-Key`

## Documentation sections

- [User comments](/docs/posts/comments) — an employee's comments across the whole feed and the two identifiers of each comment

## What to know about comments

The [GET /v1/posts/comments](/docs/posts/comments/read) method selects one employee's comments across the whole feed, not the comments of a single post. The post of each comment is given in the `postId` field: the client uses it to pick out the comments of the post it needs.

Each comment has two identifiers. `id` is the comment ID in the feed: it is accepted by the `firstId` and `lastId` cursors and by the [Delete a feed comment](/docs/feed-comments/delete) method. `commentId` is the post comment ID: together with `postId`, it is accepted by the [Delete a comment](/docs/feed/comments/delete) method.

The posts themselves — creating, listing, updating and deleting them — are described in the [Posts](/docs/feed/posts) section of the Feed. Adding a comment to a single post and deleting it are described in the [Comments](/docs/feed/comments) section.

## Quick start

The two most recent comments of the key's user:

```bash
curl "https://vibecode.bitrix24.com/v1/posts/comments?limit=2" \
  -H "X-Api-Key: YOUR_API_KEY"
```

Response:

```json
{
  "success": true,
  "data": {
    "comments": [
      {
        "id": 6217,
        "commentId": 75,
        "postId": 327,
        "date": "2026-10-23T02:18:37+00:00",
        "text": "Moved the call with the contractor to Friday.",
        "attach": []
      },
      {
        "id": 6215,
        "commentId": 73,
        "postId": 327,
        "date": "2026-10-23T02:18:37+00:00",
        "text": "Added the quarterly results to the agenda.",
        "attach": []
      }
    ],
    "files": []
  }
}
```

## Full example

Collect all comments of the key's user and count how many each post has. The method returns comments in pages, from newest to oldest. The script requests the next page with `lastId` equal to the smallest `id` on the previous one.

```bash
BASE='https://vibecode.bitrix24.com/v1'
LAST_ID=0
: > comments.jsonl

# 1. Pages from newest to oldest: the next page starts after the smallest id of the previous one
while true; do
  PAGE=$(curl -s "$BASE/posts/comments?limit=100&lastId=$LAST_ID" \
    -H "X-Api-Key: YOUR_API_KEY")
  [ "$(echo "$PAGE" | jq '.data.comments | length')" -eq 0 ] && break
  echo "$PAGE" | jq -c '.data.comments[]' >> comments.jsonl
  LAST_ID=$(echo "$PAGE" | jq '[.data.comments[].id] | min')
done

# 2. How many comments each post has
jq -s 'group_by(.postId) | map({postId: .[0].postId, comments: length})' comments.jsonl
```

The loop ends when a page comes back with an empty `data.comments` array. Step 2 prints:

```json
[
  {
    "postId": 327,
    "comments": 3
  }
]
```

## Endpoint reference

| Method | Path | Bitrix24 method | Description |
|-------|------|---------------|----------|
| GET | [`/v1/posts/comments`](/docs/posts/comments/read) | log.blogcomment.user.get | Read an employee's comments on all feed posts |

## Error codes

### Section errors

| HTTP | Code | When |
|------|-----|-------|
| 400 | `INVALID_PARAMS` | `userId`, `firstId`, `lastId` or `limit` is not a positive integer. `firstId` and `lastId` also accept `0` |
| 400 | `INVALID_PARAMS` | The request contains a parameter the method does not accept |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the request. The error text is in `error.message` |
| 502 | `BITRIX_ERROR` | The Bitrix24 response does not have the expected shape: `Invalid comment response` |

### System errors

| HTTP | Code | When |
|------|-----|-------|
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `INVALID_API_KEY` | The key is not found or has been revoked |
| 401 | `TOKEN_MISSING` | The key has no portal tokens. An OAuth application key requires the `Authorization: Bearer` header |
| 403 | `SCOPE_DENIED` | The key does not have the `log` scope |
| 429 | `RATE_LIMITED` | The request rate to Bitrix24 was exceeded |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 accepted the request but did not respond in time |

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

## See also

- [Feed](/docs/feed)
- [Posts](/docs/feed/posts)
- [Feed comments](/docs/feed-comments)
- [Errors](/docs/errors)
