For AI agents: markdown of this page — /docs-content-en/entities/invoices/search.md documentation index — /llms.txt
Search invoices
POST /v1/invoices/search
Advanced invoice search with filtering, sorting and auto-pagination. Supports up to 5000 records.
Request fields (body)
| Parameter | Type | Description |
|---|---|---|
filter |
object | Filtering by GET /v1/invoices/fields fields.Filter syntax. Example: ?filter[stageId]=DT31_5:N |
sort |
string | Sorting. The - prefix — descending |
limit |
number | Number of records (default 50, max 5000) |
offset |
number | Skip N records. Together with a date-range filter wider than 14 days it is rejected — see UNSTABLE_OFFSET_PAGINATION in the "Errors" section |
select |
array | List of returned fields |
autoWindow |
boolean | Split the result set into weekly windows when filtering by a date range wider than 14 days. Defaults to true. false disables splitting |
Filter syntax
Three formats are supported:
{ "filter": { ">=opportunity": 100000 } }
{ "filter": { "opportunity": { "$gte": 100000 } } }
{ "filter": { "opportunity": { ">=": 100000 } } }
Examples
curl — personal key
curl -X POST https://vibecode.bitrix24.com/v1/invoices/search \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filter": {
">=opportunity": 100000,
"assignedById": 1
},
"sort": "-createdTime",
"limit": 100
}'
curl — OAuth application
curl -X POST https://vibecode.bitrix24.com/v1/invoices/search \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"filter": {
">=opportunity": 100000,
"assignedById": 1
},
"sort": "-createdTime",
"limit": 100
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/invoices/search', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
filter: { '>=opportunity': 100000, assignedById: 1 },
sort: '-createdTime',
limit: 100,
}),
})
const { success, data, meta } = await res.json()
console.log(`Found: ${meta.total}`)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/invoices/search', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
filter: { '>=opportunity': 100000, assignedById: 1 },
sort: '-createdTime',
limit: 100,
}),
})
const { success, data, meta } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
data |
array | Array of invoices |
meta.total |
number | Total number of records matching 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. Pages must be walked by meta.hasMore: a data length equal to limit does not rule out the last page.
The card URL of any invoice from the data array is its id:
https://<portal>.bitrix24.com/crm/type/31/details/<id>/
31 — the entityTypeId of the smart invoice in Bitrix24. <portal> — the Bitrix24 account domain. Access is restricted by the employee's permissions in Bitrix24.
Response example
{
"success": true,
"data": [
{
"id": 891,
"title": "Invoice for services",
"stageId": "DT31_5:N",
"opportunity": 150000,
"currencyId": "USD",
"assignedById": 1,
"createdTime": "2026-04-15T14:30:00+00:00"
}
],
"meta": {
"total": 12,
"hasMore": false,
"durationMs": 240
}
}
With a date-range filter wider than 14 days, meta additionally returns autoWindowed, windowCount, and batchWaves:
{
"success": true,
"data": [ /* ... */ ],
"meta": {
"total": 16,
"hasMore": true,
"autoWindowed": true,
"windowCount": 131,
"batchWaves": 3,
"durationMs": 3090
}
}
Error response example
403 — no scope:
{
"success": false,
"error": {
"code": "SCOPE_DENIED",
"message": "This endpoint requires 'crm' scope"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 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 |
| 403 | SCOPE_DENIED |
API key lacks the crm scope |
| 401 | TOKEN_MISSING |
API key has no configured tokens |
| 400 | INVALID_REQUEST |
Invalid filter or parameters |
Full list of common API errors — 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.
See also
- List invoices — simple retrieval with filters
- Invoice fields — full list of fields
- Batch requests — search via batch
- Entity API — general principles