[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fcatalog-measures\u002Fcreate":3,"docs-tabs-entities\u002Fcatalog-measures\u002Fcreate":6},{"content":4,"lastmod":5},"## Create a unit of measure\n\n`POST \u002Fv1\u002Fcatalog-measures`\n\nAdds 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.\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `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 \u002Fv1\u002Fcatalog-measures`](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Flist) |\n| `measureTitle` | string | yes | Unit of measure name |\n| `symbol` | string | no | Short symbol, for example `pkg` |\n| `symbolIntl` | string | no | International symbol |\n| `symbolLetterIntl` | string | no | International letter code, for example `PCE` |\n| `isDefault` | string | no | Default unit: `Y` or `N`. If the field is omitted, the unit is created with `N` |\n\nFull field list — [`GET \u002Fv1\u002Fcatalog-measures\u002Ffields`](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Ffields).\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcatalog-measures\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"code\": 9917,\n    \"measureTitle\": \"Documentation test\",\n    \"symbol\": \"dt\",\n    \"symbolIntl\": \"td\",\n    \"symbolLetterIntl\": \"TDC\"\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcatalog-measures\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"code\": 9917,\n    \"measureTitle\": \"Documentation test\",\n    \"symbol\": \"dt\",\n    \"symbolIntl\": \"td\",\n    \"symbolLetterIntl\": \"TDC\"\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcatalog-measures', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    code: 9917,\n    measureTitle: 'Documentation test',\n    symbol: 'dt',\n    symbolIntl: 'td',\n    symbolLetterIntl: 'TDC',\n  }),\n})\n\nconst { success, data } = await res.json()\nconsole.log('Measure ID:', data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcatalog-measures', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    code: 9917,\n    measureTitle: 'Documentation test',\n    symbol: 'dt',\n    symbolIntl: 'td',\n    symbolLetterIntl: 'TDC',\n  }),\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\nThe response comes with status `201` and contains the full created record.\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.id` | number | ID of the created unit. Pass it in the product's `measure` field |\n| `data.code` | number | OKEI unit code |\n| `data.measureTitle` | string | Unit of measure name |\n| `data.symbol` | string \\| null | Short symbol. `null` if not provided |\n| `data.symbolIntl` | string \\| null | International symbol. `null` if not provided |\n| `data.symbolLetterIntl` | string \\| null | International letter code. `null` if not provided |\n| `data.isDefault` | string | `Y` — default unit, `N` — not default |\n| `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`. On a route that wraps the field map itself, an object under `fields` is rejected with `400 NESTED_FIELDS_ENVELOPE` when the schema does not declare `fields`; pass fields flat at the JSON root. |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"code\": 9917,\n    \"id\": 17,\n    \"isDefault\": \"N\",\n    \"measureTitle\": \"Documentation test\",\n    \"symbol\": \"dt\",\n    \"symbolIntl\": \"td\",\n    \"symbolLetterIntl\": \"TDC\"\n  }\n}\n```\n\n## Error response example\n\n400 — fractional unit code, the record is not created:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Field \\\"code\\\" must be an integer; Bitrix24 silently truncates fractional values.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 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.` |\n| 400 | `NESTED_FIELDS_ENVELOPE` | The body contains an object under `fields` instead of root-level fields; the unit is not created |\n| 400 | `INVALID_PARAMS` | `code` is not an integer, for example `9917.5` |\n| 400 | `INVALID_PARAMS` | `isDefault` is neither `Y` nor `N` |\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` |\n| 403 | `SCOPE_DENIED` | The API key does not have the `catalog` scope |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**An unknown scalar field does not stop creation.** If the body contains an unknown scalar field alongside `code` and `measureTitle`, the unit is created with status `201`, and a warning in `meta.warnings` reports that the field may not have been saved. An object under `fields` is rejected with `400 NESTED_FIELDS_ENVELOPE` before creation: send fields at the JSON root. Check field names against [`GET \u002Fv1\u002Fcatalog-measures\u002Ffields`](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Ffields), and verify the result by checking the values in `data`, not just `success`.\n\n## See also\n\n- [List units of measure](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Flist)\n- [Get a unit of measure](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Fget)\n- [Update a unit of measure](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Fupdate)\n- [Delete a unit of measure](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Fdelete)\n- [Unit of measure fields](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Ffields)\n- [Create a catalog product](\u002Fdocs\u002Fentities\u002Fcatalog-products\u002Fcreate)\n- [Batch](\u002Fdocs\u002Fbatch)\n- [Limits and optimization](\u002Fdocs\u002Foptimization)\n","2026-10-15",{},1795415190866]