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

Search units of measure

POST /v1/catalog-measures/search

Searches product catalog units of measure by conditions passed in the request body as a JSON object.

Request fields (body)

Field Type Required Description
Fieldfilter Typeobject Requiredno DescriptionFiltering by the fields from GET /v1/catalog-measures/fields.
Filtering syntax. Example: {"isDefault": "N"}
Fieldsort Typestring | object | array Requiredno DescriptionSorting as a string "-code", where the minus means descending, as an object {"code": "desc"}, or as an array of strings ["-code"]. If omitted, records are sorted by id in ascending order
Fieldorder Typeobject Requiredno DescriptionSynonym of sort in object form: {"code": "desc"}
Fieldselect Typestring[] Requiredno DescriptionField selection: ["id", "code"]. A comma-separated string is also accepted: "id,code"
Fieldlimit Typenumber Requiredno DescriptionNumber of records, from 1 to 5000. Default 50
Fieldoffset Typenumber Requiredno DescriptionSkip N records. Default 0
FieldautoWindow Typeboolean Requiredno DescriptionSplit the result set into date windows. The unit of measure schema has no date fields, so the value does not affect the result

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-measures/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "isDefault": "N" },
    "sort": "-code",
    "limit": 2
  }'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-measures/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "isDefault": "N" },
    "sort": "-code",
    "limit": 2
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-measures/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { isDefault: 'N' },
    sort: '-code',
    limit: 2,
  }),
})

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-measures/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { isDefault: 'N' },
    sort: '-code',
    limit: 2,
  }),
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typearray DescriptionArray of units of measure
Fielddata[].id Typenumber DescriptionUnit identifier. Pass it in the product's measure field
Fielddata[].code Typenumber DescriptionUnit code in the Russian National Classifier of Units of Measurement (OKEI)
Fielddata[].measureTitle Typestring | null DescriptionUnit of measure name
Fielddata[].symbol Typestring | null DescriptionShort symbol
Fielddata[].symbolIntl Typestring | null DescriptionInternational symbol
Fielddata[].symbolLetterIntl Typestring | null DescriptionInternational letter code
Fielddata[].isDefault Typestring DescriptionDefault unit: Y or N
Fieldmeta.total Typenumber DescriptionNumber of records matching the filter
Fieldmeta.hasMore Typeboolean DescriptionWhether there are more records beyond limit
Fieldmeta.durationMs Typenumber DescriptionRequest duration in milliseconds
Fieldmeta.warnings Typearray DescriptionRequest parsing warnings. Present when select contains a name outside the schema (code UNKNOWN_SELECT_FIELD) or when limit: 0 is passed (code LIMIT_ZERO_IGNORED: the value is ignored and the default page is returned)

Response example

JSON
{
  "success": true,
  "data": [
    {
      "code": 166,
      "id": 7,
      "isDefault": "N",
      "measureTitle": null,
      "symbol": null,
      "symbolIntl": "kg",
      "symbolLetterIntl": "KGM"
    },
    {
      "code": 163,
      "id": 5,
      "isDefault": "N",
      "measureTitle": null,
      "symbol": null,
      "symbolIntl": "g",
      "symbolLetterIntl": "GRM"
    }
  ],
  "meta": {
    "total": 5,
    "hasMore": true,
    "durationMs": 192
  }
}

Error response example

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

JSON
{
  "success": false,
  "error": {
    "code": "UNKNOWN_SORT_FIELD",
    "message": "Unknown sort field 'nope' for entity 'catalog-measures'. Available: id, code, measureTitle, symbol, symbolIntl, symbolLetterIntl, isDefault"
  }
}

Errors

HTTP Code Description
HTTP400 CodeUNKNOWN_FILTER_FIELD DescriptionFiltering by a field that is not in the unit of measure schema. The message lists the available fields
HTTP400 CodeUNKNOWN_SORT_FIELD DescriptionSorting by a field that is not in the schema. The message lists the available fields
HTTP400 CodeINVALID_FILTER_OPERATOR DescriptionUnknown operator in a filter condition, for example $foo. The message lists the supported operators
HTTP400 CodeINVALID_FILTER_OPERATOR DescriptionA logical key $or, $and, or $not in the filter. For an OR condition on one field, use the $in operator. For an OR across different fields, send parallel requests via POST /v1/batch
HTTP400 CodeINVALID_SORT_TYPE Descriptionsort is not a string, an object, or an array of strings
HTTP400 CodeINVALID_SELECT_TYPE Descriptionselect is not a string or an array of strings
HTTP400 CodeINVALID_LIMIT Descriptionlimit is not a number
HTTP403 CodeSCOPE_DENIED DescriptionThe API key lacks the catalog scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
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.

See also