
## Update a section

`PATCH /v1/lists/:iblockId/sections/:sectionId`

Updates the fields of an existing list section. Pass the fields to change inside the `fields` object using the Bitrix24 field format.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `iblockId` (path) | string | yes | List ID or symbolic code. Use the `ID` or `CODE` field from [List of lists](/docs/lists/lists/list) |
| `sectionId` (path) | number | yes | Section ID, a positive integer from the `ID` field returned by [List sections](./list.md) |

## Request body fields

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `fields` | object | yes | Section fields to change. Keys are uppercase with underscores |
| `fields.NAME` | string | yes | Non-empty section name. Include it even when changing other fields. The current name is in the `NAME` field returned by [Get section](./get.md) |
| `fields.CODE` | string | no | Section symbolic code |
| `fields.SORT` | number | no | Sort index |
| `fields.ACTIVE` | string | no | Whether the section is active: `Y` or `N` |
| `fields.IBLOCK_SECTION_ID` | number | no | Parent section ID from the `ID` field returned by [List sections](./list.md). `0` moves the section to the root of the list |
| `fields.XML_ID` | string | no | External section ID for data exchange |
| `fields.EXTERNAL_ID` | string | no | Alias for `XML_ID` |
| `fields.DESCRIPTION` | string | no | Section description. An empty string clears the description |
| `fields.DESCRIPTION_TYPE` | string | no | Description format: `text` or `html` |
| `fields.PICTURE` | array | no | Section image: an array `["filename.png", "BASE64_DATA"]`. The second element contains the file content encoded in Base64 |
| `iblockTypeId` | string | no | Infoblock type. Values:<br>`lists` — regular lists, default<br>`lists_socnet` — workgroup lists<br>`bitrix_processes` — service workflows<br>`structure` — company-structure type (contains the built-in absence-calendar infoblock `absence`) |
| `socnetGroupId` | number | no | ID of the workgroup that contains the list. For a workgroup list, pass `iblockTypeId: "lists_socnet"` and the group ID from the `id` field returned by [List workgroups](/docs/entities/workgroups/list). Omit it for a regular list |

Pass the fields to change and `fields.NAME`. All other section settings keep their current values.

## Examples

### curl — personal key

```bash
curl -X PATCH https://vibecode.bitrix24.com/v1/lists/23/sections/215 \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fields": {
      "NAME": "North-Western region",
      "SORT": 200
    }
  }'
```

### curl — OAuth application

```bash
curl -X PATCH https://vibecode.bitrix24.com/v1/lists/23/sections/215 \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fields": {
      "NAME": "North-Western region",
      "SORT": 200
    }
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/lists/23/sections/215', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    fields: {
      NAME: 'North-Western region',
      SORT: 200,
    },
  }),
})

const { data } = await res.json()
console.log(data.updated)
```

### JavaScript — OAuth application

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

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

## Response fields

HTTP `200`. To retrieve the updated fields, call [Get section](./get.md).

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Update result |
| `data.updated` | boolean | `true` on successful update |

## Response example

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

## Error response example

422 — the section name `fields.NAME` is missing:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Required parameter \"NAME\" is missing",
    "b24Code": "ERROR_REQUIRED_PARAMETERS_MISSING"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `sectionId` is not a positive integer |
| 400 | `MISSING_REQUIRED_FIELDS` | `fields` is missing or is not an object |
| 400 | `INVALID_IBLOCK_TYPE` | `iblockTypeId` is not one of `lists`, `lists_socnet`, `bitrix_processes`, `structure` |
| 422 | `BITRIX_ERROR` | `fields.NAME` is missing, including when `fields` is empty. The response contains `b24Code: "ERROR_REQUIRED_PARAMETERS_MISSING"` |
| 422 | `BITRIX_ERROR` | `fields.NAME` is an empty string. The response contains `b24Code: "ERROR_UPDATE_SECTION"` |
| 422 | `BITRIX_ERROR` | The section or list does not exist. The response contains `b24Code: "ERROR_SECTION_NOT_FOUND"` |
| 422 | `BITRIX_ERROR` | The list type does not match the request parameters, for example when `socnetGroupId` is passed for a regular list. The response contains `b24Code: "0"` |
| 403 | `BITRIX_ACCESS_DENIED` | No permission to access the list or section |
| 409 | `LISTS_MODULE_NOT_ENABLED` | The Lists module is not enabled on the Bitrix24 portal |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key operates in read-only mode |
| 403 | `SCOPE_DENIED` | The key is missing the `lists` scope |
| 401 | `TOKEN_MISSING` | The key has no access tokens configured |

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

## See also

- [Get section](/docs/lists/sections/get)
- [Create a section](/docs/lists/sections/create)
- [Delete a section](/docs/lists/sections/delete)
- [Sections](/docs/lists/sections)
- [Elements](/docs/lists/elements)
