For AI agents: markdown of this page — /docs-content-en/entities/companies/search.md documentation index — /llms.txt

Search companies

POST /v1/companies/search

Search companies by conditions in the request body. Accepts the same filters as the company list and is designed for compound conditions and large result sets.

Request fields (body)

Parameter Type Default Description
Parameterfilter Typeobject Default— DescriptionFilter by GET /v1/companies/fields fields.
Filtering syntax. Example: { "industry": "IT" }
Parameterlimit Typenumber Default50 DescriptionNumber of records (up to 5000)
Parameteroffset Typenumber Default0 DescriptionSkip N records. Combined with a date-range filter wider than 14 days, the request is rejected — see UNSTABLE_OFFSET_PAGINATION in the "Errors" section
Parameterorder Typeobject Default— DescriptionSorting: { "title": "asc" }
Parameterselect Typestring[] Default— DescriptionField selection
ParameterautoWindow Typeboolean Defaulttrue DescriptionSplit the result set into weekly windows when filtering by a date range wider than 14 days. false disables splitting

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/companies/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "industry": "IT" },
    "limit": 10
  }'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/companies/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "industry": "IT" },
    "limit": 10
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/companies/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { industry: 'IT' },
    limit: 10,
  }),
})

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

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/companies/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { industry: 'IT' },
    limit: 10,
  }),
})

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

Response fields

Field Type Description
Fielddata Typearray DescriptionArray of companies (fields — see Fields)
Fieldmeta.total Typenumber DescriptionHow many records matched the filter
Fieldmeta.hasMore Typeboolean DescriptionWhether there are more records beyond limit
Fieldmeta.nextAfterId Typestring DescriptionThe identifier of the last returned record. Returned when the sort is strictly id ascending, while hasMore is true. Pass it back in the >id filter — a cheap replacement for a growing offset
Fieldmeta.durationMs Typenumber DescriptionRequest duration in milliseconds
Fieldmeta.autoWindowed Typeboolean Descriptiontrue if the result set was split into time windows
Fieldmeta.windowCount Typenumber DescriptionNumber of windows. Present with autoWindowed: true
Fieldmeta.batchWaves Typenumber DescriptionNumber of parallel request waves. Present with autoWindowed: true

The meta fields sit next to data, not inside it. Paginate using meta.hasMore: a data length equal to limit does not rule out the last page.

The card URL of any company from the data array is built from its id:

https://<portal>.bitrix24.com/crm/company/details/<id>/

<portal> is the Bitrix24 portal domain. Access is restricted by the employee's permissions in Bitrix24.

Response example

JSON
{
  "success": true,
  "data": [
    {
      "id": 1,
      "title": "Acme LLC",
      "industry": "IT",
      "assignedById": 1
    }
  ],
  "meta": {
    "total": 74,
    "hasMore": true,
    "durationMs": 537
  }
}

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

JSON
{
  "success": true,
  "data": [ /* ... */ ],
  "meta": {
    "total": 8,
    "hasMore": true,
    "autoWindowed": true,
    "windowCount": 131,
    "batchWaves": 3,
    "durationMs": 1494
  }
}

Error response example

403 — no scope:

JSON
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'crm' scope"
  }
}

Errors

HTTP Code Description
HTTP400 CodeUNSTABLE_OFFSET_PAGINATION Descriptionoffset 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
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the crm scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP429 CodeRATE_LIMITED DescriptionRate 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.

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.

The phone filter is not suitable for every search. A value without an operator is compared against the whole stored string: a company whose number is stored as +1 (202) 555-0123 matches that exact string, but not 12025550123, because the plus sign, spaces, parentheses, and hyphens are part of the value. The filter also checks only the first number stored on a record: if both a work number and a mobile number are stored, searching by the mobile one returns an empty list. To find a company by phone number in any format and by any of its numbers, use Duplicate search. The $contains operator does work here — it searches for a fragment of text inside the value, which makes it a practical approach for email: { "email": { "$contains": "@example.com" } }.

See also