
## Update a post

`PATCH /v1/posts/:id`

Modifies an existing post in the Bitrix24 Feed. Pass only the fields you want to change.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` | number | yes | Post ID (path parameter). List: [GET /v1/posts](/docs/feed/posts/list) |

## Request body fields

| Field | Type | Description |
|------|-----|---------|
| `text` | string | New post text. Supports BB-code: `[b]`, `[i]`, `[url]` and other formatting tags |
| `title` | string | New post title |
| `recipients` | string[] | New recipient list (can be combined in an array):<br>`UA` — all employees on your Bitrix24,<br>`U<id>` — employee (`GET /v1/users`),<br>`D<id>` — department without sub-departments,<br>`DR<id>` — department with sub-departments (`GET /v1/departments`),<br>`SG<id>` — workgroup or project (`GET /v1/workgroups`) |
| `files` | array | Files to attach to the post. Each element is a `["file_name", "<base64 content>"]` pair. The file is uploaded to the author's Drive and attached to the post.<br>Example: `[["estimate.pdf", "JVBERi0xLjQ…"]]` |

## Examples

### curl — personal key

```bash
curl -X PATCH https://vibecode.bitrix24.com/v1/posts/303 \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Updated post text. [b]Important[/b]: deadlines have shifted."
  }'
```

### curl — OAuth application

```bash
curl -X PATCH https://vibecode.bitrix24.com/v1/posts/303 \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Updated post text. [b]Important[/b]: deadlines have shifted."
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/posts/303', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: 'Updated post text. [b]Important[/b]: deadlines have shifted.',
  }),
})

const { success, data } = await res.json()
console.log('Updated post:', data)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/posts/303', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: 'Updated post text. [b]Important[/b]: deadlines have shifted.',
  }),
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `data` | number | ID of the updated post |

## Response example

```json
{
  "success": true,
  "data": 303
}
```

## Error response example

404 — post not found:

```json
{
  "success": false,
  "error": {
    "code": "POST_NOT_FOUND",
    "message": "No post found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `POST_NOT_FOUND` | Post with the given `id` not found |
| 400 | `INVALID_POST_ID` | Invalid post `id` |
| 400 | `INVALID_RECIPIENTS` | Invalid values in `recipients` |
| 403 | `BITRIX_ACCESS_DENIED` | No permission to change this post |
| 403 | `SCOPE_DENIED` | The API key lacks the `log` scope |
| 401 | `TOKEN_MISSING` | The API key has no access tokens configured |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the post update (error text in `message`) |

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

## Known specifics

**Partial update preserves the title.** A request with only the `text` field (without `title`) does not reset the title — the previous `title` value remains, only the text is updated.

## See also

- [Create a post](/docs/feed/posts/create)
- [Delete a post](/docs/feed/posts/delete)
- [Posts](/docs/feed/posts)
- [Feed](/docs/feed)
- [Errors](/docs/errors)
