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

Search inventory document items

POST /v1/catalog-document-elements/search

Searches inventory document items using conditions passed in the request body.

Returns the same records as GET /v1/catalog-document-elements, but conditions are passed as a JSON object rather than a query string: lists of values with $in, ranges with $gte and $lte, and several conditions at once.

Request fields (body)

Field Type Default Description
Fieldfilter Typeobject Default— DescriptionFilter by fields from GET /v1/catalog-document-elements/fields.
Filtering syntax. Example: {"docId": {"$in": [75, 79]}} — items of two documents, docId comes from GET /v1/catalog-documents
Fieldselect Typestring[] Default— DescriptionResponse fields: ["id", "docId", "amount"]. A comma-separated string is also accepted: "id,docId,amount". The id field is always returned. Names come from GET /v1/catalog-document-elements/fields
Fieldsort Typestring | object | string[] Default— DescriptionSorting: "-id" — descending, "amount" — ascending. An object {"amount": "desc"} and an array of strings ["-amount", "id"] are also accepted, as is the field name order instead of sort
Fieldlimit Typenumber Default50 DescriptionNumber of records, from 1 to 5000
Fieldoffset Typenumber Default0 DescriptionNumber of records to skip from the start of the result set

When limit is greater than 50, Vibecode assembles the response from several pages automatically. Request the next page with offset while meta.hasMore is true.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-document-elements/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "docId": { "$in": [75, 79] } },
    "select": ["id", "docId", "elementId", "amount", "storeTo"],
    "sort": "-id",
    "limit": 10
  }'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-document-elements/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "docId": { "$in": [75, 79] } },
    "select": ["id", "docId", "elementId", "amount", "storeTo"],
    "sort": "-id",
    "limit": 10
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-document-elements/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { docId: { $in: [75, 79] } },
    select: ['id', 'docId', 'elementId', 'amount', 'storeTo'],
    sort: '-id',
    limit: 10,
  }),
})

const { success, data, meta } = await res.json()
console.log('Items found:', meta.total)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-document-elements/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { docId: { $in: [75, 79] } },
    select: ['id', 'docId', 'elementId', 'amount', 'storeTo'],
    sort: '-id',
    limit: 10,
  }),
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typearray DescriptionArray of items. With select set — only the listed fields and id
Fielddata[].id Typenumber DescriptionItem ID
Fielddata[].docId Typenumber DescriptionInventory document ID. Document — GET /v1/catalog-documents/:id
Fielddata[].elementId Typenumber DescriptionProduct ID. Product — GET /v1/catalog-products/:id
Fielddata[].amount Typenumber | null DescriptionProduct quantity, null — not set
Fielddata[].purchasingPrice Typenumber | null DescriptionPurchase price per unit, null — not set
Fielddata[].storeFrom Typenumber | null DescriptionSource warehouse, null — no warehouse set. Warehouses — GET /v1/warehouses
Fielddata[].storeTo Typenumber | null DescriptionDestination warehouse, null — no warehouse set. Warehouses — GET /v1/warehouses
Fieldmeta.total Typenumber DescriptionTotal number of items matching the filter
Fieldmeta.hasMore Typeboolean DescriptionWhether there are more items beyond limit
Fieldmeta.durationMs Typenumber DescriptionRequest duration in milliseconds
Fieldmeta.warnings Typearray DescriptionRequest warnings, each with the fields code, message, field. Returned when select contains a name that is not in the schema — code UNKNOWN_SELECT_FIELD

Response example

JSON
{
  "success": true,
  "data": [
    {
      "id": 27,
      "docId": 75,
      "elementId": 6907,
      "amount": 5,
      "storeTo": 1
    },
    {
      "id": 21,
      "docId": 79,
      "elementId": 6907,
      "amount": 5,
      "storeTo": 3
    }
  ],
  "meta": {
    "total": 2,
    "hasMore": false,
    "durationMs": 138
  }
}

Error response example

400 — filter by a field that is not in the item schema:

JSON
{
  "success": false,
  "error": {
    "code": "UNKNOWN_FILTER_FIELD",
    "message": "Unknown filter field 'bogus' for entity 'catalog-document-elements'. Available: id, docId, elementId, amount, purchasingPrice, storeFrom, storeTo"
  }
}

Errors

HTTP Code Description
HTTP400 CodeUNKNOWN_FILTER_FIELD DescriptionFilter by a field that is not in the schema. The message lists the allowed fields
HTTP400 CodeUNKNOWN_SORT_FIELD DescriptionSorting by a field that is not in the schema. The message lists the allowed fields
HTTP400 CodeINVALID_FILTER_OPERATOR DescriptionThe filter contains an unsupported operator. The message lists the supported ones
HTTP400 CodeINVALID_LIMIT Descriptionlimit is not a number, for example the string "abc"
HTTP400 CodeINVALID_SELECT_TYPE Descriptionselect is neither a string nor an array of strings
HTTP400 CodeINVALID_SORT_TYPE Descriptionsort is not a string, an object, or an array of strings
HTTP400 CodeINVALID_REQUEST DescriptionThe request body is not a JSON object, for example an array
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeINVALID_API_KEY DescriptionThe API key passed was not found
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the catalog scope
HTTP429 CodeRATE_LIMITED DescriptionRate limit exceeded: 300 requests per minute per portal, all API keys of the portal share one limit. The effective value is in the x-ratelimit-limit header. Retry after the delay in the Retry-After header

Full list of common API errors — Errors.

See also