
## Update section

`PATCH /v1/catalog-sections/:id`

Modifies an existing catalog section. Fields are passed flat at the root of the JSON. Send only the fields you want to change — the rest keep their current values.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Section identifier |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `name` | string | no | Section name |
| `iblockSectionId` | number | no | Parent section ID. `0` moves the section to the top level |
| `code` | string | no | Section symbolic code |
| `xmlId` | string | no | External identifier |
| `sort` | number | no | Sort index |
| `active` | boolean | no | Whether the section is active |
| `description` | string | no | Section description |
| `iblockId` | number | no | Catalog ID. Filled in automatically from the current record if not passed |

`id` is passed in the path (`/v1/catalog-sections/:id`); it cannot be passed in the body — it is read-only. Bitrix24 requires the `iblockId` and `name` fields on every change, so when they are absent from the body they are taken from the current record — passing a single changed field is enough.

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/catalog-sections/215" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sort": 200
  }'
```

### curl — OAuth app

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/catalog-sections/215" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sort": 200
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-sections/215', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    sort: 200,
  }),
})

const { success, data } = await res.json()
console.log('New order:', data.sort)
```

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-sections/215', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    sort: 200,
  }),
})

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

## Response fields

Returns the full updated section object.

| Field | Type | Description |
|------|-----|---------|
| `id` | number | Section identifier |
| `iblockId` | number | Catalog ID |
| `iblockSectionId` | number \| null | Parent section ID. `null` — top-level section |
| `name` | string | Section name |
| `code` | string \| null | Section symbolic code |
| `xmlId` | string \| null | External identifier |
| `sort` | number | Sort index |
| `active` | boolean | Whether the section is active |
| `description` | string \| null | Section description |
| `descriptionType` | string | Description format: `text` or `html` |

## Response example

```json
{
  "success": true,
  "data": {
    "active": true,
    "code": null,
    "description": null,
    "descriptionType": "text",
    "iblockId": 25,
    "iblockSectionId": null,
    "id": 215,
    "name": "New arrivals",
    "sort": 200,
    "xmlId": null
  }
}
```

## Error response example

422 — a section with the given `id` does not exist:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Required fields: iblockId"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 422 | `BITRIX_ERROR` | A section with the given `id` does not exist — substituting `iblockId` from the current record did not work, Bitrix24 responds with `Required fields: iblockId` |
| 400 | `READONLY_FIELD` | `id` was passed in the body — this field is filled in by the system and is not accepted on update |
| 403 | `SCOPE_DENIED` | The key is missing the `catalog` scope |
| 401 | `MISSING_API_KEY` | `X-Api-Key` was not passed |

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

## See also

- [Create section](/docs/entities/catalog-sections/create)
- [List sections](/docs/entities/catalog-sections/list)
- [Get section](/docs/entities/catalog-sections/get)
- [Delete section](/docs/entities/catalog-sections/delete)
- [Catalogs](/docs/entities/catalogs)
- [Batch](/docs/batch)
- [Limits and optimization](/docs/optimization)
