For AI agents: markdown of this page — /docs-content-en/entities/shipments/create.md documentation index — /llms.txt
Create a shipment
POST /v1/shipments
Creates a shipment in an existing online store order and assigns a delivery service to it.
Fields are passed flat at the JSON root, without a fields wrapper.
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
orderId |
number | yes | ID of the order in which the shipment is created. List: GET /v1/orders. Cannot be changed after creation |
deliveryId |
number | yes | Delivery service ID. List: GET /v1/delivery-services |
allowDelivery |
boolean | no | Whether delivery is allowed. If omitted, the shipment is created with false |
statusId |
string | no | Delivery status. List: GET /v1/order-statuses?filter[type]=D. If omitted, the shipment gets the Bitrix24 account's initial delivery status, DN in the example below |
trackingNumber |
string | no | Tracking number |
deliveryDocNum |
string | no | Shipment document number |
deliveryDocDate |
datetime | no | Shipment document date |
priceDelivery |
number | no | Delivery price. If omitted, the delivery service price is used |
basePriceDelivery |
number | no | Base delivery price |
responsibleId |
number | no | ID of the responsible employee. List: GET /v1/users. If omitted, the responsible person is assigned automatically |
companyId |
number | no | CRM company ID. List: GET /v1/companies. The company's existence is not checked |
comments |
string | no | Shipment comment |
xmlId |
string | no | External code. If omitted, it is generated automatically |
Full field list — GET /v1/shipments/fields.
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/shipments" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"orderId": 1027,
"deliveryId": 1,
"trackingNumber": "VIBE-DOC-1",
"comments": "Test shipment for documentation"
}'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/shipments" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderId": 1027,
"deliveryId": 1,
"trackingNumber": "VIBE-DOC-1",
"comments": "Test shipment for documentation"
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/shipments', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
orderId: 1027,
deliveryId: 1,
trackingNumber: 'VIBE-DOC-1',
comments: 'Test shipment for documentation',
}),
})
const { success, data } = await res.json()
console.log('Shipment ID:', data.id)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/shipments', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
orderId: 1027,
deliveryId: 1,
trackingNumber: 'VIBE-DOC-1',
comments: 'Test shipment for documentation',
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | true on success. The response HTTP status is 201 |
data |
object | The created shipment with all fields — Shipment fields |
data.id |
number | ID of the created shipment |
data.accountNumber |
string | Shipment number: the order number and the shipment's sequence number separated by / |
data.deducted |
boolean | The "shipped" mark. Always false for a new shipment |
data.deliveryName |
string | Name of the delivery service from deliveryId |
data.shipmentItems |
array | Shipment items. An empty array if no items have been added yet |
data.system |
boolean | System shipment. Always false for a shipment created via the API |
Response example
{
"success": true,
"data": {
"accountNumber": "1027/2",
"allowDelivery": false,
"basePriceDelivery": 500,
"canceled": false,
"comments": "Test shipment for documentation",
"companyId": null,
"currency": "USD",
"customPriceDelivery": false,
"dateAllowDelivery": null,
"dateCanceled": null,
"dateDeducted": null,
"dateInsert": "2026-10-06T11:30:44.000Z",
"dateMarked": null,
"dateResponsibleId": "2026-10-06T11:30:44.000Z",
"deducted": false,
"deliveryDocDate": null,
"deliveryDocNum": null,
"deliveryId": 1,
"deliveryName": "Courier delivery",
"deliveryXmlId": null,
"discountPrice": 0,
"empAllowDeliveryId": null,
"empCanceledId": null,
"empDeductedId": null,
"empMarkedId": null,
"empResponsibleId": 1317,
"externalDelivery": false,
"id": 1205,
"id1c": null,
"marked": false,
"orderId": 1027,
"priceDelivery": 500,
"reasonMarked": null,
"reasonUndoDeducted": null,
"responsibleId": 1295,
"shipmentItems": [],
"statusId": "DN",
"statusXmlId": null,
"system": false,
"trackingDescription": null,
"trackingLastCheck": null,
"trackingNumber": "VIBE-DOC-1",
"trackingStatus": null,
"updated1c": false,
"version1c": null,
"xmlId": "bx_6ac4cdd46e442"
}
}
Error response example
422 — no order with this orderId exists:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "Unable to load the order",
"b24Code": "0"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | MISSING_REQUIRED_FIELDS |
The required field orderId or deliveryId is missing or empty. The field name is in message |
| 400 | READONLY_FIELD |
The body contains deducted. The response contains a hint with the ship and unship endpoints |
| 400 | READONLY_FIELD |
The body contains another read-only field, such as customPriceDelivery or accountNumber. The field name is in message |
| 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 |
| 422 | BITRIX_ERROR |
Bitrix24 rejected the creation. For example, no order with this orderId exists — Unable to load the order |
| 403 | BITRIX_ACCESS_DENIED |
The key's user has no permission to edit orders in Bitrix24 |
| 403 | WRITE_BLOCKED_READONLY_KEY |
The key is in read-only mode |
| 403 | SCOPE_DENIED |
The API key does not have the sale scope |
| 401 | MISSING_API_KEY |
The X-Api-Key header is missing |
| 401 | TOKEN_MISSING |
The API key has no configured tokens |
Full list of common API errors — Errors.