## Rename a pack

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

Changes the name of a user sticker pack — only the pack's author can rename it.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `packId` (path) | number | yes | Pack ID — `data.packs[].id` from the [list of packs](/docs/chats/stickers/packs) |
| `packType` (query) | string | yes | Pack type. Only `custom` packs 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

422 — the pack does not exist:

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

## 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`, the body is not a JSON object, `packId` or `packType` is invalid, another query parameter was passed or a parameter was repeated. `packType` goes in the query parameters, not in the body |
| 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 |

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.
- Leading and trailing spaces are trimmed from the name. The name `0` counts as empty — the response is `422` with `error.b24Code` set to `EMPTY_PACK_NAME`.

## See also

- [List of packs](/docs/chats/stickers/packs)
- [Get a pack](/docs/chats/stickers/pack-get)
- [Delete a pack](/docs/chats/stickers/pack-delete)
