## Update a unit of measure

`PATCH /v1/catalog-measures/:id`

Partially updates an existing unit of measure in the product catalog reference list. Send only the fields you change. The body is flat, with no `fields` wrapper.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Unit of measure ID. List: [`GET /v1/catalog-measures`](/docs/entities/catalog-measures/list) |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `code` | number | no | Unit code from the Russian National Classifier of Units of Measurement (OKEI), an integer. Unique within the Bitrix24 account. `null` is not accepted |
| `measureTitle` | string | no | Unit of measure name |
| `symbol` | string \| null | no | Short symbol. `null` clears the field |
| `symbolIntl` | string \| null | no | International symbol. `null` clears the field |
| `symbolLetterIntl` | string \| null | no | International letter symbol. `null` clears the field |
| `isDefault` | string | no | Default unit: `Y` or `N`. `null` is not accepted |
| `id` | number | no | `RO`. The ID is set in the path only. In the body it is rejected with `400 READONLY_FIELD` |

Clearing with `null` works only in a single request. For the batch write limitation, see [Catalog units of measure](/docs/entities/catalog-measures).

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/catalog-measures/17" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "measureTitle": "Documentation test 2"
  }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/catalog-measures/17" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "measureTitle": "Documentation test 2"
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-measures/17', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    measureTitle: 'Documentation test 2',
  }),
})

const { success, data } = await res.json()
console.log('Measure title:', data.measureTitle)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-measures/17', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    measureTitle: 'Documentation test 2',
  }),
})

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

## Response fields

The response returns the full record after the update, including the fields that did not change.

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.id` | number | Unit of measure ID |
| `data.code` | number | OKEI unit code |
| `data.measureTitle` | string \| null | Unit of measure name |
| `data.symbol` | string \| null | Short symbol |
| `data.symbolIntl` | string \| null | International symbol |
| `data.symbolLetterIntl` | string \| null | International letter symbol |
| `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 element has `code: "UNRECOGNIZED_WRITE_FIELD"`, `field` with the field name, and `message` |

## Response example

```json
{
  "success": true,
  "data": {
    "code": 9917,
    "id": 17,
    "isDefault": "N",
    "measureTitle": "Documentation test 2",
    "symbol": "dt",
    "symbolIntl": "td",
    "symbolLetterIntl": "TDC"
  }
}
```

## Error response example

404 — no unit of measure with this `id`:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "measure does not exist."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | No unit of measure with this `id` exists on the portal |
| 400 | `INVALID_PARAMS` | The path `id` is not a non-negative integer. The message is `id must be a non-negative integer` |
| 400 | `INVALID_PARAMS` | `code` is not an integer, for example `1.5` |
| 400 | `INVALID_PARAMS` | `null` is passed in `code` or `isDefault` |
| 400 | `INVALID_PARAMS` | `isDefault` is neither `Y` nor `N` |
| 400 | `EMPTY_UPDATE_BODY` | The request body is empty. Pass at least one field |
| 400 | `READONLY_FIELD` | `id` is passed in the body |
| 422 | `BITRIX_ERROR` | The new `code` is already taken by another unit on the portal. The message is `Duplicate entry for key [code]`, and the response also contains `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 |

For the full list of common API errors, see [Errors](/docs/errors).

## Known specifics

**A field with a misspelled name does not stop the request.** If the body contains only an unknown field, the response comes back with status `200`, the record does not change, and a warning in `meta.warnings` reports the skipped field. Check field names against [`GET /v1/catalog-measures/fields`](/docs/entities/catalog-measures/fields), and verify success by the values in `data`, not only by `success`.

## See also

- [Get a unit of measure](/docs/entities/catalog-measures/get)
- [Create a unit of measure](/docs/entities/catalog-measures/create)
- [List units of measure](/docs/entities/catalog-measures/list)
- [Delete a unit of measure](/docs/entities/catalog-measures/delete)
- [Unit of measure fields](/docs/entities/catalog-measures/fields)
- [Batch](/docs/batch)
- [Limits and optimization](/docs/optimization)
