
## Search sections

`POST /v1/product-sections/search`

Search product sections with filtering and auto-pagination. Equivalent to `GET /v1/product-sections` with filters, but via POST — more convenient for complex queries with many conditions.

## Request fields (body)

| Parameter | Type | Default | Description |
|----------|-----|-----------|---------|
| `filter` | object | — | Exact-match and `$in` (IN set) only, by `id`, `name`, `xmlId`, `code`, `catalogId`, `sectionId`. Operators (`>`, `<`, `!`, `%`, `$ne`, `$contains`, `$nin`) and filtering by `sort` are not supported — you get `400 UNSUPPORTED_FILTER`.<br>[Filtering syntax](/docs/filtering). Example: `{ "filter": { "catalogId": 25 } }` |
| `limit` | number | `50` | Number of records (up to 5000) |
| `select` | string[] | — | Field selection: `["id", "name", "catalogId"]` |
| `order` | object | — | Sorting by field: `{ "sort": "asc" }` |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/product-sections/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "catalogId": 25 },
    "limit": 10,
    "select": ["id", "name", "catalogId", "code"]
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/product-sections/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "catalogId": 25 },
    "limit": 10,
    "select": ["id", "name", "catalogId", "code"]
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/product-sections/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { catalogId: 25 },
    limit: 10,
    select: ['id', 'name', 'catalogId', 'code'],
  }),
})

const { success, data, meta } = await res.json()
console.log('Found:', meta.total)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/product-sections/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { catalogId: 25 },
    limit: 10,
    select: ['id', 'name', 'catalogId', 'code'],
  }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | Array of sections |
| `data[].id` | number | Section identifier |
| `data[].name` | string | Section name |
| `data[].catalogId` | number | Catalog identifier |
| `data[].sectionId` | number | Parent section identifier. `null` for a root section |
| `data[].code` | string | Section symbolic code |
| `data[].xmlId` | string | External identifier |
| `meta.total` | number | Total number of records matching the filter |
| `meta.hasMore` | boolean | Whether more records exist beyond `limit` |
| `meta.durationMs` | number | Request duration in milliseconds |

The `meta` fields sit next to `data`, not inside it. Pages must be walked by `meta.hasMore`: a `data` length equal to `limit` does not rule out the last page.

## Response example

```json
{
  "success": true,
  "data": [
    {
      "id": 31,
      "catalogId": 25,
      "sectionId": null,
      "name": "Clothing",
      "code": "clothes",
      "xmlId": "666"
    },
    {
      "id": 45,
      "catalogId": 25,
      "sectionId": null,
      "name": "Filter section",
      "code": "filter-section",
      "xmlId": null
    }
  ],
  "meta": {
    "total": 37,
    "hasMore": true,
    "durationMs": 285
  }
}
```

## Error response example

400 — an operator or a non-filterable field in the filter:

```json
{
  "success": false,
  "error": {
    "code": "UNSUPPORTED_FILTER",
    "message": "UNSUPPORTED_FILTER: operators are not supported on 'product-sections' (near 'name'). Its Bitrix24 method (crm.productsection.list) filters by exact match only — operators are silently ignored by Bitrix24. Use exact match (field: value) or $in (field: {$in: [...]}) on: id, name, xmlId, code, catalogId, sectionId."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `UNSUPPORTED_FILTER` | An operator or a non-filterable field in the filter. Filter by exact match or `$in` on `id`, `name`, `xmlId`, `code`, `catalogId`, `sectionId` |
| 400 | `INVALID_FILTER` | Error while parsing the filter |
| 403 | `SCOPE_DENIED` | The API key does not have the `crm` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not provided |

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

## Known specifics

**Auto-pagination.** When `limit > 50` the request is split into several calls to the server. The maximum is 5000 records per call. If more match the filter, `meta.hasMore` will be `true`.

**Exact match only in the filter.** The method filters by exact match (and `$in`) on `id`, `name`, `xmlId`, `code`, `catalogId`, `sectionId`. Operators, `$ne`/`$contains`/`$nin` and filtering by `sort` return `400 UNSUPPORTED_FILTER`. Sorting (`order`) by `sort` and other fields works.

## See also

- [List sections](/docs/entities/product-sections/list)
- [Get section](/docs/entities/product-sections/get)
- [Section fields](/docs/entities/product-sections/fields)
- [Filtering syntax](/docs/filtering)
- [Batch](/docs/batch)
