## Search services

`POST /v1/catalog-services/search`

Searches the services of a product catalog by conditions passed in the request body.

Unlike [`GET /v1/catalog-services`](./list.md), the `filter`, `select`, `sort`, `limit`, and `offset` parameters are passed in the JSON body rather than in the query string — conditions on several fields are set as a nested structure. Like the list, search requires `filter.iblockId` — without this field, the request returns `400`. The response format is the same as for the list.

## Request fields (body)

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `filter` | object | yes | — | Filtering by the fields of [`GET /v1/catalog-services/fields`](./fields.md). The `iblockId` key is required — the product catalog ID from [`GET /v1/catalogs`](/docs/entities/catalogs/list); this catalog has an empty `productIblockId`. `iblockSectionId` with an ID from [`GET /v1/catalog-sections`](/docs/entities/catalog-sections/list) selects the services of one section.<br>[Filtering syntax](/docs/filtering). Example: `{ "iblockId": 25, "iblockSectionId": 281 }` |
| `select` | string[] | no | — | Field selection: `["iblockId", "id", "name", "code"]`. If the parameter is passed, it must include `iblockId` and `id`. Without `select`, the response carries a reduced set of fields: the symbolic code, external code, sort order, VAT rate, texts, images, and catalog properties are returned only when listed explicitly — [Service fields](./fields.md) lists which ones |
| `sort` | string | no | — | Sort field. The `-` prefix means descending: `"-id"` |
| `limit` | number | no | `50` | Number of records (up to 5000) |
| `offset` | number | no | `0` | Offset from the start of the selection. Rejected when combined with a date-range filter wider than 14 days — see `UNSTABLE_OFFSET_PAGINATION` in the "Errors" section |
| `autoWindow` | boolean | no | `true` | Split the result set into weekly windows when filtering by a date range wider than 14 days. `false` disables splitting |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-services/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "iblockId": 25, "iblockSectionId": 281 },
    "limit": 10
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-services/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "iblockId": 25, "iblockSectionId": 281 },
    "limit": 10
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-services/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { iblockId: 25, iblockSectionId: 281 },
    limit: 10,
  }),
})

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/catalog-services/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { iblockId: 25, iblockSectionId: 281 },
    limit: 10,
  }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | Array of services. For the fields of each item, see [Service fields](./fields.md) |
| `meta.total` | number | How many records matched the filter |
| `meta.hasMore` | boolean | Whether there are more records beyond `limit` |
| `meta.durationMs` | number | Request duration in milliseconds |
| `meta.autoWindowed` | boolean | `true` if the result set was split into time windows |
| `meta.windowCount` | number | Number of windows. Present with `autoWindowed: true` |
| `meta.batchWaves` | number | Number of parallel request waves. Present with `autoWindowed: true` |

The `meta` fields sit next to `data`, not inside it. Paginate using `meta.hasMore`: a `data` array whose length equals `limit` can still be the last page.

## Response example

```json
{
  "success": true,
  "data": [
    {
      "active": true,
      "available": false,
      "bundle": false,
      "createdBy": 1295,
      "dateActiveFrom": null,
      "dateActiveTo": null,
      "dateCreate": "2026-10-08T20:50:59.000Z",
      "iblockId": 25,
      "iblockSectionId": 281,
      "id": 7231,
      "measure": 9,
      "modifiedBy": 1295,
      "name": "Air conditioner installation",
      "timestampX": "2026-10-08T20:50:59.000Z",
      "type": 7,
      "vatIncluded": true
    },
    {
      "active": true,
      "available": false,
      "bundle": false,
      "createdBy": 1295,
      "dateActiveFrom": null,
      "dateActiveTo": null,
      "dateCreate": "2026-10-08T20:51:00.000Z",
      "iblockId": 25,
      "iblockSectionId": 281,
      "id": 7233,
      "measure": 9,
      "modifiedBy": 1295,
      "name": "Air conditioner cleaning",
      "timestampX": "2026-10-08T20:51:00.000Z",
      "type": 7,
      "vatIncluded": true
    }
  ],
  "meta": {
    "total": 2,
    "hasMore": false,
    "durationMs": 165
  }
}
```

## Error response example

400 — the required filter was not passed:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_REQUIRED_FILTER",
    "message": "POST /v1/catalog-services/search requires filter fields: iblockId. Example body: { \"filter\": {\"iblockId\":\"...\"} }"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `MISSING_REQUIRED_FILTER` | The required `filter.iblockId` filter was not passed. The request is rejected before Bitrix24 is called — the message contains the name of the missing field and a request body example |
| 400 | `UNKNOWN_FILTER_FIELD` | Filtering by a field the service does not have. The message contains the list of available fields |
| 400 | `UNKNOWN_SORT_FIELD` | Sorting by a field the service does not have. The message contains the list of available fields |
| 400 | `UNKNOWN_SELECT_FIELD` | `select` contains a name the service does not have. The message contains the list of available fields |
| 400 | `SELECT_FIELD_NOT_RETURNED` | `select` contains `iblockSection` — this name is not supported in the selection. The main section comes in `iblockSectionId` |
| 400 | `UNSTABLE_OFFSET_PAGINATION` | `offset` greater than zero together with a date-range filter wider than 14 days. Two different retrieval algorithms produce inconsistent results, so the request is rejected. Fetch everything in a single request with `limit` up to 5000, or pass `autoWindow: false` with sorting by `id`, or split the date range into parts yourself |
| 422 | `BITRIX_ERROR` | `select` does not include `iblockId` (`Required select fields: iblockId`) |
| 422 | `BITRIX_ERROR` | `select` does not include `id` (`Required select fields: id`) |
| 422 | `BITRIX_ERROR` | `filter.iblockId` holds the ID of an offer catalog, not a product catalog (`productType is not allowed for this catalog`) |
| 422 | `BITRIX_ERROR` | There is no catalog with the specified `iblockId` (`iblock is not catalog`) |
| 403 | `SCOPE_DENIED` | The API key does not have the `catalog` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not passed |
| 429 | `RATE_LIMITED` | Rate limit exceeded: 300 requests per minute per portal, all API keys of the portal share one limit. The exact value arrives in the `x-ratelimit-limit` header (the cap is divided across replicas). Retry after the delay in the `Retry-After` header |

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

## Known specifics

**Time-window splitting.** A date-range filter wider than 14 days, such as `"dateCreate": { "$gte": "2023-01-01T00:00:00Z", "$lte": "2026-10-09T00:00:00Z" }`, is automatically split into weekly windows executed in parallel waves. `meta` then returns `autoWindowed: true`, the number of windows `windowCount`, and the number of waves `batchWaves`. The `autoWindow: false` parameter disables splitting. While splitting is active, an `offset` greater than zero is rejected with `UNSTABLE_OFFSET_PAGINATION`.

## See also

- [List services](/docs/entities/catalog-services/list)
- [Create a service](/docs/entities/catalog-services/create)
- [Get a service](/docs/entities/catalog-services/get)
- [Service fields](/docs/entities/catalog-services/fields)
- [Filtering syntax](/docs/filtering)
- [API reference](/docs/api-reference)
