Sifr Wahid Developers

API reference / Shipments

Create order shipment

Ship an order (book a carrier label or record a tracking number)

POST https://s.zo.sa/api/public/v1/orders/{id}/shipments
Scope shipments.read_writeIdempotency-Key required

The 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

NameTypeRequiredDescription
idintegerrequiredAt least 1

Headers

NameTypeRequiredDescription
Idempotency-Keystringrequired1 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

application/json required

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

  • carrierstringrequired
    A platform carrier code offered to the store, such as aramex.

Option 2

  • tracking_numberstringrequired
    Up to 80 characters
  • tracking_urlstring (uri)nullable
    Up to 255 characters
  • carrier_namestringnullable
    Up to 80 characters

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.

Response 201
{
  "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

201The new shipment.
Response schema
  • dataobjectrequired
    A shipment. The carrier's raw answer and the label file are never shown.
    11 fields
    • idintegerrequired
    • order_idintegerrequired
    • carrierstringrequired
      A carrier code or manual.
    • statusstringrequired
      One of label_created, picked_up, in_transit, out_for_delivery, delivered, failed, returned, cancelled
    • tracking_numberstringrequirednullable
    • tracking_urlstringrequirednullable
    • costintegerrequired
      Halalas.
    • weight_gramsintegerrequirednullable
    • eventsarray of objectsrequired
      3 fields
      • statusstringrequired
      • atstring (date-time)requirednullable
      • notestring
        Present only when the event carries a note code.
    • created_atstring (date-time)required
    • updated_atstring (date-time)required
401Missing, unknown, revoked or expired key.

An error object: {"error": {"code", "message", "fields"}}.

402feature_locked (carrier labels need the carrier_integration plan feature), or wallet_insufficient (the wallet holds less than the label costs; balance and required are given). Nothing was booked or charged.

An error object: {"error": {"code", "message", "fields"}}.

403The key lacks the scope (code insufficient_scope, naming it in scope), the caller's address is not allowed (ip_not_allowed), or the store is suspended (store_suspended: reads stay allowed, every write answers this).

An error object: {"error": {"code", "message", "fields"}}.

404No such row in this store (code not_found).

An error object: {"error": {"code", "message", "fields"}}.

409A write with the same Idempotency-Key is still running (code duplicate_request); retry shortly.

An error object: {"error": {"code", "message", "fields"}}.

422validation_failed, order_not_shippable (the order's status or a pickup order), shipment_exists (the order already has an open shipment), carrier_no_cod, carrier_overweight, address_missing or gift_pending.

An error object: {"error": {"code", "message", "fields"}}.

429Too many requests (code rate_limited); see Retry-After.

An error object: {"error": {"code", "message", "fields"}}.