
## 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": { "sectionId": 31 } }`. Filtering by `catalogId` does not narrow the selection — see "Known specifics" |
| `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": { "sectionId": 31 },
    "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": { "sectionId": 31 },
    "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: { sectionId: 31 },
    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: { sectionId: 31 },
    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. Page through the results using `meta.hasMore`: a page whose `data` length equals `limit` can still be the last one.

## Response example

```json
{
  "success": true,
  "data": [
    {
      "id": 33,
      "name": "Footwear",
      "catalogId": 25,
      "code": "shoes"
    },
    {
      "id": 39,
      "name": "Dresses",
      "catalogId": 25,
      "code": "dresses"
    }
  ],
  "meta": {
    "total": 6,
    "hasMore": false,
    "durationMs": 533
  }
}
```

## 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."
  }
}
```

`catalogId` is in that list because the filter accepts it without an error. It still does not narrow the selection — see "Only sections of the CRM product catalog".

## 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`, `sectionId`. The filter also accepts `catalogId` without an error, but it does not narrow the selection |
| 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 |
| 429 | `RATE_LIMITED` | Rate limit exceeded: 300 requests per minute per portal. All API keys of the portal share one limit. The current limit is returned in the `x-ratelimit-limit` header. Retry after the delay in the `Retry-After` header |

For the full list of common API errors, see [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`, `sectionId`. Operators, `$ne`/`$contains`/`$nin` and filtering by `sort` return `400 UNSUPPORTED_FILTER`. The one exception is `catalogId`: the filter accepts it without an error, but it does not narrow the selection — see "Only sections of the CRM product catalog" below. Sorting (`order`) by `sort` and other fields works.

**Only sections of the CRM product catalog.** The method returns sections of the CRM product catalog — its ID comes in the `catalogId` field of every section. With the `catalogId` of an offers catalog or of a catalog that does not exist, the method returns all sections of the CRM product catalog, as if there were no filter, rather than an empty list. `$in` on `catalogId` does not narrow the selection either. Sections of another catalog are returned by [`GET /v1/catalog-sections`](/docs/entities/catalog-sections/list) with `filter[iblockId]`.

## 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)
