[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fshipment-items\u002Fupdate":3,"docs-tabs-entities\u002Fshipment-items\u002Fupdate":6},{"content":4,"lastmod":5},"## Update a shipment item\n\n`PATCH \u002Fv1\u002Fshipment-items\u002F:id`\n\nChanges the product quantity and the external code of a shipment item in an online store order.\n\nFields are passed flat at the JSON root, without a `fields` wrapper. How a quantity change affects the free quantity of the basket item is described in [Shipment items](\u002Fdocs\u002Fentities\u002Fshipment-items).\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `id` (path) | number | yes | Shipment item ID, a non-negative integer. List: [`GET \u002Fv1\u002Fshipment-items`](.\u002Flist.md) |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `quantity` | number | yes | New product quantity in the shipment. Pass it in every request, including when only `xmlId` changes. A fractional value is stored without rounding. A numeric string with a decimal point is also accepted, for example `\"0.5\"`. An increase is limited by the free quantity of the basket item |\n| `xmlId` | string | no | External code |\n| `orderDeliveryId` | number | no | RO. Set only on [creation](.\u002Fcreate.md). To move the item to another shipment, delete it and create it again |\n| `basketId` | number | no | RO. Set only on [creation](.\u002Fcreate.md) |\n| `reservedQuantity` | number | no | RO. Reserved quantity |\n\nFull list of fields: [`GET \u002Fv1\u002Fshipment-items\u002Ffields`](.\u002Ffields.md).\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipment-items\u002F1353\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"quantity\": 0.75,\n    \"xmlId\": \"vibe-doc-si-1\"\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipment-items\u002F1353\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"quantity\": 0.75,\n    \"xmlId\": \"vibe-doc-si-1\"\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipment-items\u002F1353', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    quantity: 0.75,\n    xmlId: 'vibe-doc-si-1',\n  }),\n})\n\nconst { success, data } = await res.json()\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipment-items\u002F1353', {\n  method: 'PATCH',\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    quantity: 0.75,\n    xmlId: 'vibe-doc-si-1',\n  }),\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | `true` on success |\n| `data` | object | The updated shipment item with all fields |\n| `data.id` | number | Shipment item ID |\n| `data.orderDeliveryId` | number | Shipment ID |\n| `data.basketId` | number | Basket item ID |\n| `data.quantity` | number | Product quantity in the shipment after the change |\n| `data.reservedQuantity` | number | Reserved quantity |\n| `data.xmlId` | string | External code |\n| `data.dateInsert` | datetime | Creation date, ISO 8601 |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"basketId\": 1387,\n    \"dateInsert\": \"2026-10-07T09:55:27.000Z\",\n    \"id\": 1353,\n    \"orderDeliveryId\": 1207,\n    \"quantity\": 0.75,\n    \"reservedQuantity\": 0,\n    \"xmlId\": \"vibe-doc-si-1\"\n  }\n}\n```\n\n## Error response example\n\n404 — no shipment item with this `id`:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"shipment item is not exists\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `READONLY_FIELD` | The body contains a read-only field: `orderDeliveryId`, `basketId`, `reservedQuantity`, `id` and others. The field name is in `message` |\n| 400 | `EMPTY_UPDATE_BODY` | The request body is empty or is not a JSON object |\n| 400 | `INVALID_PARAMS` | A field value does not match its type, for example the string `\"abc\"` in the numeric `quantity`. The field name is in `message` |\n| 400 | `INVALID_PARAMS` | `id` in the path is not a non-negative integer |\n| 404 | `ENTITY_NOT_FOUND` | No shipment item with this `id`: `shipment item is not exists` |\n| 404 | `ENTITY_NOT_FOUND` | The item belongs to the system shipment, and the passed `quantity` equals the current one. The change is not saved: `shipmentItem \u003Cid> not found` |\n| 422 | `BITRIX_ERROR` | The item belongs to the system shipment, and a new `quantity` is passed. The change is not saved: `System shipment cannot be modified`, `b24Code` is `150` |\n| 422 | `BITRIX_ERROR` | The body has no `quantity`, for example only `xmlId` or only a field with an unknown name is passed: `Required fields: quantity` |\n| 422 | `BITRIX_ERROR` | The new `quantity` exceeds the quantity available to the basket item, `b24Code` is `SALE_SHIPMENT_ITEM_LESS_AVAILABLE_QUANTITY` |\n| 422 | `BITRIX_ERROR` | Bitrix24 rejected the change for another reason. The reason is in `message` |\n| 403 | `BITRIX_ACCESS_DENIED` | The key's user has no permission to modify orders in Bitrix24 |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key works in read-only mode |\n| 403 | `SCOPE_DENIED` | The API key does not have the `sale` scope |\n| 403 | `MANAGEMENT_KEY_NO_ENTITY_ACCESS` | The request is made with a management key. Entities require an application key or a personal key with the `sale` scope |\n| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is not passed |\n| 401 | `INVALID_API_KEY` | The passed API key is not found |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n\nFull list of common API errors: [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Shipment items](\u002Fdocs\u002Fentities\u002Fshipment-items)\n- [Get a shipment item](.\u002Fget.md)\n- [Create a shipment item](.\u002Fcreate.md)\n- [Delete a shipment item](.\u002Fdelete.md)\n- [Shipment item fields](.\u002Ffields.md)\n- [Shipments](\u002Fdocs\u002Fentities\u002Fshipments)\n- [Basket items](\u002Fdocs\u002Fentities\u002Fbasket-items)\n","2026-10-07",{},1795415295138]