
## Add recipients

`POST /v1/posts/:id/share`

Grants access to the post to additional recipients — they see it in their Bitrix24 Feed. Adds recipients to those the post was already addressed to.

## Parameters

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

## Request body fields

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `recipients` | string[] | yes | Additional post recipients (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`) |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/posts/293/share" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recipients": ["SG5", "U1"]}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/posts/293/share" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"recipients": ["SG5", "U1"]}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/posts/293/share', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ recipients: ['SG5', 'U1'] }),
})
const { data } = await res.json()
console.log('Recipients added:', data)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/posts/293/share', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ recipients: ['SG5', 'U1'] }),
})
const { data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data` | boolean | `true` — the post is shared with the specified recipients |

## Response example

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

## Error response example

404 — post not found:

```json
{
  "success": false,
  "error": {
    "code": "POST_NOT_FOUND",
    "message": "Post 999999999 not found or not accessible with this key."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_POST_ID` | Post ID is not a positive integer |
| 400 | `MISSING_PARAMS` | `recipients` not provided, not an array, or empty |
| 400 | `INVALID_RECIPIENTS` | Bitrix24 rejected the recipients as invalid |
| 401 | `TOKEN_MISSING` | The API key has no access tokens configured |
| 403 | `SCOPE_DENIED` | The API key lacks the `log` scope |
| 403 | `BITRIX_ACCESS_DENIED` | No permission to change recipients of this post |
| 404 | `POST_NOT_FOUND` | Post with the given ID not found or not accessible to the key |
| 404 | `POST_NOT_FOUND_OR_INVALID_RECIPIENTS` | The post exists, but Bitrix24 rejected adding recipients — the post is inaccessible or one of the recipients is invalid |

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

## Known specifics

- **Recipients are added, not replaced.** Recipients passed in `recipients` are added to the audience the post was shared with at creation. To set the entire recipient set anew, update the post via [PATCH /v1/posts/:id](/docs/feed/posts/update).

## See also

- [Create a post](/docs/feed/posts/create)
- [List posts](/docs/feed/posts/list)
- [Update a post](/docs/feed/posts/update)
- [Posts](/docs/feed/posts)
