
## Search requisites

`POST /v1/requisites/search`

Search requisites with filters and auto-pagination. Similar to `GET /v1/requisites`, but parameters are passed in the request body — more convenient for complex filters with many conditions and for building requests programmatically.

## Request fields (body)

| Parameter | Type | Default | Description |
|----------|-----|-----------|---------|
| `filter` | object | — | Filtering by `GET /v1/requisites/fields` fields.<br>[Filtering syntax](/docs/filtering). Example: `{ "entityTypeId": 4, "entityId": 15 }` |
| `limit` | number | `50` | Number of records (up to 5000) |
| `offset` | number | `0` | Skip N records. Together with a date-range filter wider than 14 days it is rejected — see `UNSTABLE_OFFSET_PAGINATION` in the "Errors" section |
| `order` | object | — | Sorting: `{ "sort": "asc" }` |
| `select` | string[] | — | Field selection: `["id", "rqName", "rqInn"]` |
| `autoWindow` | boolean | `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/requisites/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "entityTypeId": 4, "active": true },
    "limit": 20,
    "order": { "sort": "asc" }
  }'
```

### curl — OAuth app

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/requisites/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "entityTypeId": 4, "active": true },
    "limit": 20,
    "order": { "sort": "asc" }
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/requisites/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { entityTypeId: 4, active: true },
    limit: 20,
    order: { sort: 'asc' },
  }),
})

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

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/requisites/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { entityTypeId: 4, active: true },
    limit: 20,
    order: { sort: 'asc' },
  }),
})

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

### Other scenarios

Search by INN:

```json
{ "filter": { "rqInn": "1234567890" } }
```

Search by a country preset field (French SIRET):

```json
{ "filter": { "rqSiret": "73282932000074" } }
```

International fields `rqSiret`, `rqSiren`, `rqRegon`, `rqKbe`, `rqCnpj` are schema fields — filter by them in camelCase.

All requisites of one company:

```json
{
  "filter": { "entityTypeId": 4, "entityId": 15 },
  "order": { "sort": "asc" }
}
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | Array of requisites (all fields — see [Requisite fields](/docs/entities/requisites/fields)) |
| `meta.total` | number | How many records matched the filter |
| `meta.hasMore` | boolean | Whether there is a next page |
| `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. 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": 42,
      "entityTypeId": 4,
      "entityId": 15,
      "presetId": 1,
      "name": "Primary requisite",
      "active": true,
      "sort": 500,
      "rqName": "Acme LLC",
      "rqInn": "1234567890",
      "rqKpp": "123456789",
      "rqOgrn": "1234567890123",
      "rqCompanyName": "Acme",
      "rqDirector": "John Smith",
      "createdAt": "2025-01-15T09:30:00+00:00"
    }
  ],
  "meta": {
    "total": 79,
    "hasMore": true,
    "durationMs": 188
  }
}
```

With a date-range filter wider than 14 days, `meta` additionally returns `autoWindowed`, `windowCount`, and `batchWaves`:

```json
{
  "success": true,
  "data": [ /* ... */ ],
  "meta": {
    "total": 174,
    "hasMore": true,
    "autoWindowed": true,
    "windowCount": 444,
    "batchWaves": 9,
    "durationMs": 20835
  }
}
```

## Error response example

403 — no scope:

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "Requires 'crm' scope"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 403 | `SCOPE_DENIED` | API key does not have the `crm` scope |
| 401 | `TOKEN_MISSING` | API key has no configured tokens |
| 400 | `INVALID_FILTER` | Error in the filter syntax |
| 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. Take 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 |

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

## Known specifics

**Time-window splitting.** A date-range filter wider than 14 days is automatically split into weekly windows executed in parallel waves, so the result set bypasses the ceiling of 5000 records per call. `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`.

**Field names in the filter.** Pass Vibecode schema fields in camelCase — `rqInn`, `rqKpp`, `entityTypeId`, `rqCompanyName`, `rqDirector`, plus international preset fields `rqEdrpou`, `rqKbe`, `rqRegon`, `rqSiret`, `rqCnpj` and rare service ones `rqIfns`, `rqUsrle`. Custom `UF_CRM_*` fields — in the original case.

**Pagination.** When `limit > 50`, the request is automatically split into several calls to Bitrix24. For large result sets use `offset` and paginated requests.

## See also

- [List requisites](/docs/entities/requisites/list) — GET request with query parameters
- [Requisite fields](/docs/entities/requisites/fields) — which fields are available in the filter
- [Filtering syntax](/docs/filtering)
- [Batch](/docs/batch) — combining several searches into one request
- [Limits and optimization](/docs/optimization) — rate limits
