[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fshipments\u002Fupdate":3,"docs-tabs-entities\u002Fshipments\u002Fupdate":6},{"content":4,"lastmod":5},"## Update a shipment\n\n`PATCH \u002Fv1\u002Fshipments\u002F:id`\n\nUpdates an existing shipment of an online store order. Omitted fields are preserved.\n\nFields are passed flat at the JSON root, without a `fields` wrapper. How omitted fields are preserved — [Shipments](\u002Fdocs\u002Fentities\u002Fshipments).\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `id` (path) | number | yes | Shipment ID. List: [`GET \u002Fv1\u002Fshipments`](.\u002Flist.md) |\n\n## Request fields (body)\n\n| Field | Type | Description |\n|------|-----|---------|\n| `trackingNumber` | string | Tracking number |\n| `deliveryDocNum` | string | Shipment document number |\n| `deliveryDocDate` | datetime | Shipment document date |\n| `allowDelivery` | boolean | Delivery is allowed |\n| `statusId` | string | Delivery status. List: [`GET \u002Fv1\u002Forder-statuses?filter[type]=D`](\u002Fdocs\u002Fentities\u002Forder-statuses\u002Flist) |\n| `deliveryId` | number | Delivery service ID. List: [`GET \u002Fv1\u002Fdelivery-services`](\u002Fdocs\u002Fentities\u002Fdelivery-services\u002Flist) |\n| `priceDelivery` | number | Delivery price |\n| `basePriceDelivery` | number | Base delivery price |\n| `responsibleId` | number | ID of the responsible employee. List: [`GET \u002Fv1\u002Fusers`](\u002Fdocs\u002Fentities\u002Fusers\u002Flist). An empty value, `null` or `0`, is not accepted |\n| `companyId` | number | CRM company ID. List: [`GET \u002Fv1\u002Fcompanies`](\u002Fdocs\u002Fentities\u002Fcompanies\u002Flist). The company's existence is not checked. An empty value is accepted only if the order has no company either — the `companyId` field in [`GET \u002Fv1\u002Forders\u002F:id`](\u002Fdocs\u002Fentities\u002Forders\u002Fget) |\n| `comments` | string | Shipment comment |\n| `xmlId` | string | External code |\n| `orderId` | number | RO. Set only on [creation](.\u002Fcreate.md) |\n| `deducted` | boolean | RO. Changed via [`ship`](.\u002Fship.md) and [`unship`](.\u002Funship.md) |\n| `customPriceDelivery` | boolean | RO. Manual delivery price flag |\n\nFull field list — [`GET \u002Fv1\u002Fshipments\u002Ffields`](.\u002Ffields.md).\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipments\u002F1205\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"trackingNumber\": \"VIBE-DOC-2\",\n    \"deliveryDocNum\": \"TN-1205\",\n    \"allowDelivery\": true\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipments\u002F1205\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"trackingNumber\": \"VIBE-DOC-2\",\n    \"deliveryDocNum\": \"TN-1205\",\n    \"allowDelivery\": true\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipments\u002F1205', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    trackingNumber: 'VIBE-DOC-2',\n    deliveryDocNum: 'TN-1205',\n    allowDelivery: true,\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\u002Fshipments\u002F1205', {\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    trackingNumber: 'VIBE-DOC-2',\n    deliveryDocNum: 'TN-1205',\n    allowDelivery: true,\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 with all fields, including omitted ones. All fields — [Shipment fields](.\u002Ffields.md) |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"accountNumber\": \"1027\u002F2\",\n    \"allowDelivery\": true,\n    \"basePriceDelivery\": 500,\n    \"canceled\": false,\n    \"comments\": \"Test shipment for documentation\",\n    \"companyId\": null,\n    \"currency\": \"USD\",\n    \"customPriceDelivery\": false,\n    \"dateAllowDelivery\": \"2026-10-06T11:31:17.000Z\",\n    \"dateCanceled\": null,\n    \"dateDeducted\": null,\n    \"dateInsert\": \"2026-10-06T11:30:44.000Z\",\n    \"dateMarked\": null,\n    \"dateResponsibleId\": \"2026-10-06T11:30:44.000Z\",\n    \"deducted\": false,\n    \"deliveryDocDate\": null,\n    \"deliveryDocNum\": \"TN-1205\",\n    \"deliveryId\": 1,\n    \"deliveryName\": \"Courier delivery\",\n    \"deliveryXmlId\": null,\n    \"discountPrice\": 0,\n    \"empAllowDeliveryId\": 1317,\n    \"empCanceledId\": null,\n    \"empDeductedId\": null,\n    \"empMarkedId\": null,\n    \"empResponsibleId\": 1317,\n    \"externalDelivery\": false,\n    \"id\": 1205,\n    \"id1c\": null,\n    \"marked\": false,\n    \"orderId\": 1027,\n    \"priceDelivery\": 500,\n    \"reasonMarked\": null,\n    \"reasonUndoDeducted\": null,\n    \"responsibleId\": 1295,\n    \"shipmentItems\": [],\n    \"statusId\": \"DN\",\n    \"statusXmlId\": null,\n    \"system\": false,\n    \"trackingDescription\": null,\n    \"trackingLastCheck\": null,\n    \"trackingNumber\": \"VIBE-DOC-2\",\n    \"trackingStatus\": null,\n    \"updated1c\": false,\n    \"version1c\": null,\n    \"xmlId\": \"bx_6ac4cdd46e442\"\n  }\n}\n```\n\n## Error response example\n\n400 — an empty `responsibleId` was passed:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Bitrix24 cannot preserve an empty shipment responsibleId and its assignment metadata. Set an explicit nonzero responsibleId or update the shipment in Bitrix24.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `READONLY_FIELD` | The body contains `deducted`. The response contains a `hint` with the [`ship`](.\u002Fship.md) and [`unship`](.\u002Funship.md) endpoints |\n| 400 | `READONLY_FIELD` | The body contains another read-only field: `customPriceDelivery`, `orderId`, `accountNumber` and others. The field name is in `message` |\n| 400 | `EMPTY_UPDATE_BODY` | The request body is empty |\n| 400 | `INVALID_PARAMS` | The body contains no known shipment field — `At least one writable shipment field is required.` |\n| 400 | `INVALID_PARAMS` | The same field is passed twice under different names, such as `trackingNumber` and `TRACKING_NUMBER` — `Duplicate field alias` |\n| 400 | `INVALID_PARAMS` | The responsible person would be empty after the write: `responsibleId` is passed as `null` or `0`, or it is omitted and the stored shipment has no responsible person. Pass a nonzero `responsibleId` |\n| 400 | `INVALID_PARAMS` | The shipment company would be empty after the write, while the order has a different company. Pass a nonzero `companyId` |\n| 400 | `INVALID_PARAMS` | The stored shipment has a manual delivery price (`customPriceDelivery` is `true`). Change such a shipment in the Bitrix24 interface |\n| 400 | `INVALID_PARAMS` | A field value does not match its type, such as a word in the numeric `priceDelivery` or an object in the text `comments`. 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 with this `id` exists |\n| 422 | `BITRIX_NO_EFFECT` | Bitrix24 did not return the shipment fields or the order needed to preserve the omitted fields. No write was performed |\n| 422 | `BITRIX_ERROR` | Bitrix24 rejected the write or the read of the shipment's order. The reason is in `message` |\n| 403 | `BITRIX_ACCESS_DENIED` | The key's user has no permission to edit orders in Bitrix24 |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |\n| 403 | `SCOPE_DENIED` | The API key does not have the `sale` scope |\n| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**Allowing delivery records the date and the employee.** After `allowDelivery: true`, the response contains the date delivery was allowed, `dateAllowDelivery`, and the ID of the employee who allowed it, `empAllowDeliveryId`.\n\n**Field names are also accepted in upper case.** `TRACKING_NUMBER` is saved the same way as `trackingNumber`.\n\n## See also\n\n- [Shipments](\u002Fdocs\u002Fentities\u002Fshipments)\n- [Get a shipment](.\u002Fget.md)\n- [Create a shipment](.\u002Fcreate.md)\n- [Set the \"shipped\" mark](.\u002Fship.md)\n- [Remove the \"shipped\" mark](.\u002Funship.md)\n- [Shipment fields](.\u002Ffields.md)\n- [Shipment items](\u002Fdocs\u002Fentities\u002Fshipment-items)\n","2026-10-06",{},1795415297111]