[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fshipments\u002Fcreate":3,"docs-tabs-entities\u002Fshipments\u002Fcreate":6},{"content":4,"lastmod":5},"## Create a shipment\n\n`POST \u002Fv1\u002Fshipments`\n\nCreates a shipment in an existing online store order and assigns a delivery service to it.\n\nFields are passed flat at the JSON root, without a `fields` wrapper.\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `orderId` | number | yes | ID of the order in which the shipment is created. List: [`GET \u002Fv1\u002Forders`](\u002Fdocs\u002Fentities\u002Forders\u002Flist). Cannot be changed after creation |\n| `deliveryId` | number | yes | Delivery service ID. List: [`GET \u002Fv1\u002Fdelivery-services`](\u002Fdocs\u002Fentities\u002Fdelivery-services\u002Flist) |\n| `allowDelivery` | boolean | no | Whether delivery is allowed. If omitted, the shipment is created with `false` |\n| `statusId` | string | no | Delivery status. List: [`GET \u002Fv1\u002Forder-statuses?filter[type]=D`](\u002Fdocs\u002Fentities\u002Forder-statuses\u002Flist). If omitted, the shipment gets the Bitrix24 account's initial delivery status, `DN` in the example below |\n| `trackingNumber` | string | no | Tracking number |\n| `deliveryDocNum` | string | no | Shipment document number |\n| `deliveryDocDate` | datetime | no | Shipment document date |\n| `priceDelivery` | number | no | Delivery price. If omitted, the delivery service price is used |\n| `basePriceDelivery` | number | no | Base delivery price |\n| `responsibleId` | number | no | ID of the responsible employee. List: [`GET \u002Fv1\u002Fusers`](\u002Fdocs\u002Fentities\u002Fusers\u002Flist). If omitted, the responsible person is assigned automatically |\n| `companyId` | number | no | CRM company ID. List: [`GET \u002Fv1\u002Fcompanies`](\u002Fdocs\u002Fentities\u002Fcompanies\u002Flist). The company's existence is not checked |\n| `comments` | string | no | Shipment comment |\n| `xmlId` | string | no | External code. If omitted, it is generated automatically |\n\nFull field list — [`GET \u002Fv1\u002Fshipments\u002Ffields`](.\u002Ffields.md).\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipments\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"orderId\": 1027,\n    \"deliveryId\": 1,\n    \"trackingNumber\": \"VIBE-DOC-1\",\n    \"comments\": \"Test shipment for documentation\"\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipments\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"orderId\": 1027,\n    \"deliveryId\": 1,\n    \"trackingNumber\": \"VIBE-DOC-1\",\n    \"comments\": \"Test shipment for documentation\"\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipments', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    orderId: 1027,\n    deliveryId: 1,\n    trackingNumber: 'VIBE-DOC-1',\n    comments: 'Test shipment for documentation',\n  }),\n})\n\nconst { success, data } = await res.json()\nconsole.log('Shipment ID:', data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fshipments', {\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    orderId: 1027,\n    deliveryId: 1,\n    trackingNumber: 'VIBE-DOC-1',\n    comments: 'Test shipment for documentation',\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. The response HTTP status is `201` |\n| `data` | object | The created shipment with all fields — [Shipment fields](.\u002Ffields.md) |\n| `data.id` | number | ID of the created shipment |\n| `data.accountNumber` | string | Shipment number: the order number and the shipment's sequence number separated by `\u002F` |\n| `data.deducted` | boolean | The \"shipped\" mark. Always `false` for a new shipment |\n| `data.deliveryName` | string | Name of the delivery service from `deliveryId` |\n| `data.shipmentItems` | array | Shipment items. An empty array if no items have been added yet |\n| `data.system` | boolean | System shipment. Always `false` for a shipment created via the API |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"accountNumber\": \"1027\u002F2\",\n    \"allowDelivery\": false,\n    \"basePriceDelivery\": 500,\n    \"canceled\": false,\n    \"comments\": \"Test shipment for documentation\",\n    \"companyId\": null,\n    \"currency\": \"USD\",\n    \"customPriceDelivery\": false,\n    \"dateAllowDelivery\": null,\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\": null,\n    \"deliveryId\": 1,\n    \"deliveryName\": \"Courier delivery\",\n    \"deliveryXmlId\": null,\n    \"discountPrice\": 0,\n    \"empAllowDeliveryId\": null,\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-1\",\n    \"trackingStatus\": null,\n    \"updated1c\": false,\n    \"version1c\": null,\n    \"xmlId\": \"bx_6ac4cdd46e442\"\n  }\n}\n```\n\n## Error response example\n\n422 — no order with this `orderId` exists:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"Unable to load the order\",\n    \"b24Code\": \"0\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `MISSING_REQUIRED_FIELDS` | The required field `orderId` or `deliveryId` is missing or empty. The field name is in `message` |\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, such as `customPriceDelivery` or `accountNumber`. The field name is in `message` |\n| 400 | `INVALID_PARAMS` | A field value does not match its type, such as a word in the numeric `deliveryId` or an object in the text `comments`. The field name is in `message` |\n| 422 | `BITRIX_ERROR` | Bitrix24 rejected the creation. For example, no order with this `orderId` exists — `Unable to load the order` |\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## See also\n\n- [Shipments](\u002Fdocs\u002Fentities\u002Fshipments)\n- [Get a shipment](.\u002Fget.md)\n- [Update a shipment](.\u002Fupdate.md)\n- [Set the \"shipped\" mark](.\u002Fship.md)\n- [Delete a shipment](.\u002Fdelete.md)\n- [Shipment items](\u002Fdocs\u002Fentities\u002Fshipment-items)\n- [Orders](\u002Fdocs\u002Fentities\u002Forders)\n- [Delivery services](\u002Fdocs\u002Fentities\u002Fdelivery-services)\n","2026-10-06",{},1795415295729]