# Sticker pack

Deleting a pack is irreversible: the pack disappears for everyone who added it, and its sticker files are deleted. You can get any pack; you can rename and delete only your own user pack.

## Get a pack

`GET /v1/chats/stickers/packs/:packId`

Returns a pack and its stickers — the messenger v2 method `im.v2.Sticker.Pack.get`. You can open any user pack in the Bitrix24 account, not only your own: this is how Bitrix24 shows the pack of a sticker that arrived in a message.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `packId` (path) | number | yes | Pack ID — `packs[].id` from the [list of packs](/docs/chats/stickers/packs) |
| `packType` | string | yes | `vendor` — a built-in pack, `custom` — a user pack |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/chats/stickers/packs/14?packType=vendor" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/chats/stickers/packs/14?packType=vendor" \
  -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/chats/stickers/packs/14?packType=vendor', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
console.log(data.pack.name, '— stickers:', data.stickers.length)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/stickers/packs/14?packType=vendor', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
console.log(data.pack.name, '— stickers:', data.stickers.length)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.pack` | object | The pack: `id`, `name`, `type`, `authorId` (`null` for a built-in pack), `isAdded` — the pack is in the user's list |
| `data.stickers` | array | Stickers of the pack: `id`, `packId`, `packType`, `uri` — a path in the Bitrix24 account without the domain, `type`, `width`, `height`, `sort` |

## Response example

```json
{
  "success": true,
  "data": {
    "stickers": [
      { "id": 1, "uri": "/bitrix/images/im/stickers/aiHelp/1.png?v1", "type": "image", "width": 512, "height": 512, "packId": 14, "packType": "vendor", "sort": 1 }
    ],
    "pack": { "id": 14, "name": "AI Help", "type": "vendor", "authorId": null, "isAdded": true }
  }
}
```

## Error response example

422 — there is no pack with this `id` and `packType`:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "PACK_NOT_AVAILABLE",
    "b24Code": "PACK_NOT_AVAILABLE"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `packId` is not a positive integer, `packType` is missing or is not `vendor` / `custom`, another parameter was passed |
| 401 | `TOKEN_MISSING` | The key has no configured Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key lacks the `im` scope |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 did not find the object; the portal code is in `error.b24Code` if supplied |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; `error.b24Code` is `PACK_NOT_AVAILABLE` if the pack does not exist |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |

## Rename a pack

`PATCH /v1/chats/stickers/packs/:packId`

Changes the name of a user pack — the method `im.v2.Sticker.Pack.rename`. Only the author can rename a pack; built-in packs cannot be changed.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `packId` (path) | number | yes | Pack ID |
| `packType` | string | yes | Pack type. Only `custom` can be changed |

## Request body fields

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `name` | string | yes | New name: non-empty, up to 255 characters as stored by Bitrix24 (an emoji above U+FFFF counts as 10 characters) |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/chats/stickers/packs/3?packType=custom" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Team stickers"}'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/chats/stickers/packs/3?packType=custom" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Team stickers"}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/stickers/packs/3?packType=custom', {
  method: 'PATCH',
  headers: { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Team stickers' }),
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/stickers/packs/3?packType=custom', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Team stickers' }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.result` | boolean | `true` — the name was changed |

## Response example

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

## Error response example

403 — the pack is built-in or belongs to another user:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ACCESS_DENIED",
    "message": "ACCESS_DENIED"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `MISSING_PARAMS` | The `name` field is missing |
| 400 | `INVALID_PARAMS` | `name` is empty, not a string or longer than 255 characters; the body contains a field other than `name` (`packType` goes in the query parameters); `packId` or `packType` is invalid |
| 401 | `TOKEN_MISSING` | The key has no configured Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key lacks the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 403 | `BITRIX_ACCESS_DENIED` | The pack is built-in or its author is another user |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 did not find the object; the portal code is in `error.b24Code` if supplied |
| 422 | `BITRIX_ERROR` | `error.b24Code`: `PACK_NOT_FOUND` — the pack does not exist, `EMPTY_PACK_NAME` — Bitrix24 considered the name empty |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |

## Delete a pack

`DELETE /v1/chats/stickers/packs/:packId`

Deletes a user pack — the method `im.v2.Sticker.Pack.delete`. The pack disappears for everyone who added it, and the sticker files are deleted. The pack cannot be restored. Only the author can delete a pack; built-in packs cannot be deleted.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `packId` (path) | number | yes | Pack ID |
| `packType` | string | yes | Pack type. Only `custom` can be deleted |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/stickers/packs/3?packType=custom" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/stickers/packs/3?packType=custom" \
  -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/chats/stickers/packs/3?packType=custom', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/stickers/packs/3?packType=custom', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.result` | boolean | `true` — the pack was deleted |

## Response example

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

## Error response example

422 — the pack does not exist, for example because it has already been deleted:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "PACK_NOT_FOUND",
    "b24Code": "PACK_NOT_FOUND"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `packId` is not a positive integer, `packType` is missing or invalid, another parameter or body field was passed |
| 401 | `TOKEN_MISSING` | The key has no configured Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key lacks the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 403 | `BITRIX_ACCESS_DENIED` | The pack is built-in or its author is another user |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 did not find the object; the portal code is in `error.b24Code` if supplied |
| 422 | `BITRIX_ERROR` | `error.b24Code`: `PACK_NOT_FOUND` — the pack does not exist |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |

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

## Known specifics

- A built-in pack and a user pack may have the same `id`, so `packType` is required.
- Bitrix24 trims leading and trailing spaces from the name. It treats the name `0` as empty and responds with `EMPTY_PACK_NAME`.
- Bitrix24 would silently truncate a name longer than 255 characters, so such a request is rejected before it reaches Bitrix24.
- Sticker error codes (`PACK_NOT_FOUND`, `PACK_NOT_AVAILABLE`, `EMPTY_PACK_NAME`) come without a message text: `message` equals the code.

## See also

- [List of packs](/docs/chats/stickers/packs)
- [Add and remove a pack](/docs/chats/stickers/link)
- [Delete stickers from a pack](/docs/chats/stickers/pack-stickers)
