Sifr Wahid Developers

API reference / Shipments

Cancel shipment

Cancel a shipment

DELETE https://s.zo.sa/api/public/v1/shipments/{id}
Scope shipments.read_write

A carrier label is cancelled only before the carrier picks the parcel up; its cost goes back to the wallet once the carrier confirms the label is void. A manual tracking number can be removed until delivery.

Request

Path parameters

NameTypeRequiredDescription
idintegerrequiredAt least 1

cURL

curl -sS -X DELETE "https://s.zo.sa/api/public/v1/shipments/640" \
  -H "Authorization: Bearer $ZO_API_KEY" \
  -H "Accept: application/json"

JavaScript

const response = await fetch('https://s.zo.sa/api/public/v1/shipments/640', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.ZO_API_KEY}`,
    Accept: 'application/json',
  },
});
console.log(response.status, await response.json());

PHP

<?php

$ch = curl_init('https://s.zo.sa/api/public/v1/shipments/640');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ZO_API_KEY'),
        'Accept: application/json',
    ],
]);
$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.delete(
    "https://s.zo.sa/api/public/v1/shipments/640",
    headers={
        "Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
        "Accept": "application/json",
    },
    timeout=30,
)
print(response.status_code, response.json())
Response 200
{
  "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

200The shipment, now cancelled.
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"}}.

402The store's plan does not include this feature (error code feature_locked, with the feature and the plan that has it). Every operation answers it with feature public_api when the key's store is not on the Pro plan.

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"}}.

422shipment_not_cancellable (the parcel is already with the carrier, delivered, or cancelled).

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

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

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