Create order shipment
Ship an order (book a carrier label or record a tracking number)
https://s.zo.sa/api/public/v1 /orders/{id}/shipments shipments.read_writeIdempotency-Key requiredThe Idempotency-Key header is required here (422 validation_failed without it): a carrier label is paid from the store's wallet, and a retry with the same key returns the first answer without booking or charging again. The order moves forward (ready for a label, shipping for a tracking number), as in the dashboard.
Request
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | required | At least 1 |
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Idempotency-Key | string | required | 1 to 120 visible ASCII characters. A write sent again with the same key runs once; the retry gets the first answer back with the header Idempotent-Replayed: true. Use a new key for each new write. 1 to 120 characters |
Request body
Either a label booked with a platform carrier (carrier; the label is paid from the store's wallet and needs the carrier_integration plan feature), or a tracking number from the store's own carrier contract.
Option 1
carrierstringrequiredA platform carrier code offered to the store, such as aramex.
Option 2
tracking_numberstringrequiredtracking_urlstring (uri)nullablecarrier_namestringnullable
cURL
curl -sS -X POST "https://s.zo.sa/api/public/v1/orders/1042/shipments" \
-H "Authorization: Bearer $ZO_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: erp-shipment-SO1042" \
-d '{
"tracking_number": "TRK123456789",
"carrier_name": "Own courier"
}'JavaScript
const response = await fetch('https://s.zo.sa/api/public/v1/orders/1042/shipments', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ZO_API_KEY}`,
Accept: 'application/json',
'Content-Type': 'application/json',
'Idempotency-Key': 'erp-shipment-SO1042',
},
body: JSON.stringify({
"tracking_number": "TRK123456789",
"carrier_name": "Own courier"
}),
});
console.log(response.status, await response.json());PHP
<?php
$ch = curl_init('https://s.zo.sa/api/public/v1/orders/1042/shipments');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ZO_API_KEY'),
'Accept: application/json',
'Content-Type: application/json',
'Idempotency-Key: erp-shipment-SO1042',
],
CURLOPT_POSTFIELDS => json_encode([
'tracking_number' => 'TRK123456789',
'carrier_name' => 'Own courier',
]),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, PHP_EOL, $body, PHP_EOL;Python
import os
import requests
response = requests.post(
"https://s.zo.sa/api/public/v1/orders/1042/shipments",
headers={
"Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
"Accept": "application/json",
"Idempotency-Key": "erp-shipment-SO1042",
},
json={
"tracking_number": "TRK123456789",
"carrier_name": "Own courier",
},
timeout=30,
)
print(response.status_code, response.json())A tracking number of the store's own carrier: no label and no wallet charge. The order moves to shipping.
{
"data": {
"id": 1,
"order_id": 1,
"carrier": "string",
"status": "label_created",
"tracking_number": null,
"tracking_url": null,
"cost": 5000,
"weight_grams": null,
"events": [
{
"status": "string",
"at": null,
"note": "string"
}
],
"created_at": "2026-11-23T06:01:53Z",
"updated_at": "2026-11-23T06:01:53Z"
}
}Example generated from the schema.
Responses
Response schema
dataobjectrequiredA shipment. The carrier's raw answer and the label file are never shown.11 fields
idintegerrequiredorder_idintegerrequiredcarrierstringrequiredA carrier code or manual.statusstringrequiredtracking_numberstringrequirednullabletracking_urlstringrequirednullablecostintegerrequiredHalalas.weight_gramsintegerrequirednullableeventsarray of objectsrequired3 fields
statusstringrequiredatstring (date-time)requirednullablenotestringPresent only when the event carries a note code.
created_atstring (date-time)requiredupdated_atstring (date-time)required
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.