## List sections

`GET /v1/lists/:iblockId/sections`

Returns the sections of the specified list. Sections group elements and can form a tree — a section may have a parent section.

## Parameters

| Parameter | Type | Req. | Default | Description |
|----------|-----|:-----:|:---------:|---------|
| `iblockId` (path) | string | yes | — | Numeric `IBLOCK_ID` or the list's symbolic code. Ids are available via `GET /v1/lists` |
| `iblockTypeId` (query) | string | no | `lists` | Infoblock type. Values:<br>`lists` — regular lists, default<br>`lists_socnet` — workgroup lists<br>`bitrix_processes` — service workflows |
| `filter` (query) | object | no | — | Filter by section fields — `ID`, `NAME`, `CODE`, `IBLOCK_SECTION_ID`, `SORT`.<br>[Filtering syntax](/docs/filtering). Example: `?filter={"NAME":"Documents"}` |
| `select` (query) | string | no | — | Comma-separated list of returned fields. Example: `?select=ID,NAME,CODE` |

## Examples

### curl — personal key

```bash
curl https://vibecode.bitrix24.com/v1/lists/121/sections \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl https://vibecode.bitrix24.com/v1/lists/121/sections \
  -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/lists/121/sections', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data, meta } = await res.json()
console.log('Sections:', meta.total)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/lists/121/sections', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const { data } = await res.json()
```

## Response fields

Response fields are in Bitrix24 form: upper-case keys with underscores, numeric values arrive as strings, unset fields are `null`.

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | Array of sections |
| `data[].ID` | string | Section id |
| `data[].NAME` | string | Section name |
| `data[].IBLOCK_SECTION_ID` | string | Parent section id. Arrives `null` for a root section |
| `data[].SORT` | string | Sort index |
| `data[].CODE` | string | Section symbolic code |
| `meta.total` | number | Total number of sections matching the request |

## Response example

```json
{
  "success": true,
  "data": [
    {
      "ID": "137",
      "NAME": "Sales department documents",
      "IBLOCK_SECTION_ID": null,
      "SORT": "100",
      "CODE": "sales_docs"
    },
    {
      "ID": "139",
      "NAME": "Marketing department documents",
      "IBLOCK_SECTION_ID": null,
      "SORT": "200",
      "CODE": "marketing_docs"
    }
  ],
  "meta": { "total": 2 }
}
```

## Error response example

400 — the `filter` parameter is not valid JSON:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_FILTER",
    "message": "filter must be valid JSON, e.g. filter={\"NAME\":\"%urgent%\"}."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_FILTER` | `filter` is not valid JSON |
| 400 | `INVALID_IBLOCK_TYPE` | `iblockTypeId` is not in the allowed set |
| 403 | `BITRIX_ACCESS_DENIED` | No access to the list, or a list with this id does not exist |
| 409 | `LISTS_MODULE_NOT_ENABLED` | The "Lists" module is not enabled on the portal |
| 403 | `SCOPE_DENIED` | The API key lacks the `lists` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

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

## Known specifics

**The tree is reconstructed from `IBLOCK_SECTION_ID`.** Sections arrive as a flat array. To build the tree, group sections by their `IBLOCK_SECTION_ID` value: for root sections it is `null`, for nested ones it is the parent section id.

## See also

- [Get section](/docs/lists/sections/get)
- [Create section](/docs/lists/sections/create)
- [Sections](/docs/lists/sections)
- [Filtering syntax](/docs/filtering)
