POST/api/demos/logistique/v1/shipments
Create a shipment
Records a parcel, works out its price, delivery window and refusal risk, and returns the tracking number and the label.
| Field | Type | Required | Description |
|---|---|---|---|
reference | string≤ 40 | no | Your order number, returned as is. |
recipient | object | yes | The recipient. |
recipient.name | string2–80 | yes | Their name. Replaced by a demo name in the sandbox. |
recipient.phone | string | yes | An Algerian mobile. Masked and replaced in the sandbox; only a hash is kept. |
destination | object | yes | Where to deliver. |
destination.wilaya | integer1–69 | yes | The wilaya code, 1 to 69. |
destination.commune | string2–60 | yes | A commune of that wilaya: its id or its name, in Arabic, French or Latin letters. |
destination.landmark | string≤ 160 | no | A landmark rather than an address: « opposite the mosque », « behind the post office ». |
mode | stringhomestop-desk | yes | home or stop-desk (collected at an agency). |
agency | string | no | The pick-up agency for a stop-desk; by default the wilaya’s own. |
weight_kg | number0.05–70 | yes | Weight in kilograms. |
dimensions_cm | object | no | Dimensions in centimetres, for the volumetric weight. |
dimensions_cm.length | integer1–300 | yes | Length. |
dimensions_cm.width | integer1–300 | yes | Width. |
dimensions_cm.height | integer1–300 | yes | Height. |
cod_amount | integer0–1000000 | yes | Cash to collect at the door, in dinars; 0 for a prepaid parcel. |
declared_value | integer0–5000000 | no | Declared value for insurance; by default the amount collected. |
product | string2–120 | yes | What the parcel holds, in a few words. |
quantity | integer1–99 | no | Number of items. |
options | array≤ 6insurancefragileexchangeconfirmationopen-on-deliveryexpress | no | Options: insurance, fragile, exchange, confirmation, open before paying, express. |
note | string≤ 200 | no | An instruction for the courier. |
| Field | Type | Required | Description |
|---|---|---|---|
tracking_number | string | yes | Tracking number: KH and ten digits, the last a check digit. |
reference | string | no | Your order number, returned as is. |
state | stringValues (19)pending-confirmationconfirmedawaiting-pickuppicked-upat-origin-hubin-line-haulat-destination-hubout-for-deliverydeliveredattempt-failedrescheduledat-stop-deskcollected-from-stop-deskrefusedreturn-in-transitreturnedexchangelostcancelled | yes | The parcel’s state. |
price | object | yes | The shipment’s price. |
price.ht | integer | yes | Before tax. |
price.tva | integer | yes | VAT. |
price.ttc | integer | yes | Including tax. |
price.lines[] | array | yes | The breakdown, line by line. |
price.lines[].key | string | yes | What the line is: transport, collection fee, an option… |
price.lines[].amount | integer | yes | Its amount including tax. |
price.indicative | boolean | yes | Always true: the rate is indicative. |
sla | object | yes | The promised delivery window, in hours after pick-up. |
sla.min_hours | integer | yes | At the earliest. |
sla.max_hours | integer | yes | At the latest. |
risk | object | yes | The estimated refusal risk, with its reasons in the seller space. |
risk.score | integer0–100 | yes | 0 to 100. |
risk.band | stringlowmediumhigh | yes | Low, medium or high. |
label_url | string | yes | The 10 × 15 label as a PDF (a specimen in the demonstration). |
tracking_url | string | yes | The tracking page to send the buyer. |
created_at | datetime | yes | When it was created. |
curl -X POST 'https://algeriaagency.com/api/demos/logistique/v1/shipments' \
-H 'X-Api-Key: kh_test_••••••••••••••••••••7Q2m' \
-H 'Idempotency-Key: 6f1c2d0e-commande-0412' \
-H 'Content-Type: application/json' \
-d '{
"reference": "CMD-2026-0412",
"recipient": {
"name": "Destinataire démo n° 42",
"phone": "06 •• •• 48 17"
},
"destination": {
"wilaya": 16,
"commune": "Bab Ezzouar",
"landmark": "en face de la mosquée El Feth"
},
"mode": "home",
"weight_kg": 0.8,
"cod_amount": 2500,
"product": "Coffret soins visage",
"options": [
"confirmation"
]
}'const response = await fetch('https://algeriaagency.com/api/demos/logistique/v1/shipments', {
method: 'POST',
headers: {
'X-Api-Key': process.env.KHATT_API_KEY, // kh_test_••••••••••••••••••••7Q2m
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"reference": "CMD-2026-0412",
"recipient": {
"name": "Destinataire démo n° 42",
"phone": "06 •• •• 48 17"
},
"destination": {
"wilaya": 16,
"commune": "Bab Ezzouar",
"landmark": "en face de la mosquée El Feth"
},
"mode": "home",
"weight_kg": 0.8,
"cod_amount": 2500,
"product": "Coffret soins visage",
"options": [
"confirmation"
]
}),
})
if (!response.ok) throw new Error((await response.json()).error.code)
const data = await response.json()<?php
$ch = curl_init('https://algeriaagency.com/api/demos/logistique/v1/shipments');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Api-Key: ' . getenv('KHATT_API_KEY'), // kh_test_••••••••••••••••••••7Q2m
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{
"reference": "CMD-2026-0412",
"recipient": {
"name": "Destinataire démo n° 42",
"phone": "06 •• •• 48 17"
},
"destination": {
"wilaya": 16,
"commune": "Bab Ezzouar",
"landmark": "en face de la mosquée El Feth"
},
"mode": "home",
"weight_kg": 0.8,
"cod_amount": 2500,
"product": "Coffret soins visage",
"options": [
"confirmation"
]
}',
]);
$data = json_decode(curl_exec($ch), true);{
"tracking_number": "KH4831200573",
"reference": "CMD-2026-0412",
"state": "pending-confirmation",
"price": {
"ht": 437,
"tva": 83,
"ttc": 520,
"lines": [
{
"key": "transport",
"amount": 400
},
{
"key": "cod-fee",
"amount": 50
},
{
"key": "confirmation",
"amount": 70
}
],
"indicative": true
},
"sla": {
"min_hours": 12,
"max_hours": 24
},
"risk": {
"score": 21,
"band": "low"
},
"label_url": "/api/demos/logistique/v1/shipments/KH4831200573/label.pdf",
"tracking_url": "/demos/logistique/suivi/KH4831200573",
"created_at": "2026-10-19T10:42:00+01:00"
}