สำหรับเอเจนต์ AI: markdown ของหน้านี้ — /docs-content-en/entities/catalog-measures.md ดัชนีเอกสาร — /llms.txt
บทความในเอกสารมีให้บริการเป็นภาษาอังกฤษในขณะนี้
Catalog measures
Reference list of units of measure in the product catalog: pieces, kilograms, liters, and other units in which product quantity is specified. The unit identifier is passed in a product's measure field.
Bitrix24 API: catalog.measure.*
Scope: catalog
Create a unit of measure
POST /v1/catalog-measures
Adds a new unit of measure to the product catalog directory so that product quantities can be expressed in it. The request body is flat — no fields wrapper.
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
code |
number | yes | Unit code in the Russian National Classifier of Units of Measurement (OKEI), an integer. Unique within the Bitrix24 account. Codes already in use — see GET /v1/catalog-measures |
measureTitle |
string | yes | Unit of measure name |
symbol |
string | no | Short symbol, for example pkg |
symbolIntl |
string | no | International symbol |
symbolLetterIntl |
string | no | International letter code, for example PCE |
isDefault |
string | no | Default unit: Y or N. If the field is omitted, the unit is created with N |
Full field list — GET /v1/catalog-measures/fields.
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-measures" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": 9917,
"measureTitle": "Documentation test",
"symbol": "dt",
"symbolIntl": "td",
"symbolLetterIntl": "TDC"
}'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-measures" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"code": 9917,
"measureTitle": "Documentation test",
"symbol": "dt",
"symbolIntl": "td",
"symbolLetterIntl": "TDC"
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-measures', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
code: 9917,
measureTitle: 'Documentation test',
symbol: 'dt',
symbolIntl: 'td',
symbolLetterIntl: 'TDC',
}),
})
const { success, data } = await res.json()
console.log('Measure ID:', data.id)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-measures', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
code: 9917,
measureTitle: 'Documentation test',
symbol: 'dt',
symbolIntl: 'td',
symbolLetterIntl: 'TDC',
}),
})
const { success, data } = await res.json()
Response fields
The response comes with status 201 and contains the full created record.
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.id |
number | ID of the created unit. Pass it in the product's measure field |
data.code |
number | OKEI unit code |
data.measureTitle |
string | Unit of measure name |
data.symbol |
string | null | Short symbol. null if not provided |
data.symbolIntl |
string | null | International symbol. null if not provided |
data.symbolLetterIntl |
string | null | International letter code. null if not provided |
data.isDefault |
string | Y — default unit, N — not default |
meta.warnings |
array | Present only if the body contains a field that is not among the unit of measure fields. Each entry carries code: "UNRECOGNIZED_WRITE_FIELD", field with the field name, and message |
Response example
{
"success": true,
"data": {
"code": 9917,
"id": 17,
"isDefault": "N",
"measureTitle": "Documentation test",
"symbol": "dt",
"symbolIntl": "td",
"symbolLetterIntl": "TDC"
}
}
Error response example
400 — fractional unit code, the record is not created:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "Field \"code\" must be an integer; Bitrix24 silently truncates fractional values."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | MISSING_REQUIRED_FIELDS |
code or measureTitle is missing. The message names the first missing field, for example Body field "code" is required to create catalogMeasure. |
| 400 | INVALID_PARAMS |
code is not an integer, for example 9917.5 |
| 400 | INVALID_PARAMS |
isDefault is neither Y nor N |
| 422 | BITRIX_ERROR |
A unit with this code already exists in the Bitrix24 account. The message is Duplicate entry for key [code], and the response also carries error.b24Code |
| 403 | SCOPE_DENIED |
The API key does not have the catalog scope |
| 401 | TOKEN_MISSING |
The API key has no configured tokens |
| 401 | MISSING_API_KEY |
The X-Api-Key header is missing |
Full list of common API errors — Errors.
Known specifics
A field with a misspelled name does not stop creation. If the body contains an unknown field alongside code and measureTitle, the unit is created with status 201, and a warning in meta.warnings reports that this field may not have been saved. Check field names against GET /v1/catalog-measures/fields, and verify the result by checking the values in data, not just success.