Cancel order
Cancels the order and returns the payment to the balance. Repeated cancellations are safe.
POST /shipments/{id}/cancel
- Key Permission:
labels:cancel - Key: test or live
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string | yes | Order number or tracking number (in the address). |
reason |
string | no | Cancellation reason, up to 255 characters. |
In the address {id} is the order number (field id from the response) or tracking number.
Important to know
- Refund amount in
meta.refund_cents. If the order can no longer be canceled, a 409conflictwill be returned with the reason inerror.message. - Деньги за отменённый вами лейбл возвращаются на баланс через
meta.refund_delay_daysдней (дата вmeta.refund_due_at), поэтому сразу после отменыmeta.refund_centsравно 0, аmeta.refund_statusравноpending. Потом статус становитсяrefunded. - Repeating cancellation of an already canceled order is not an error:
meta.already_cancelled: truewill be returned. - Если отмену не удалось выполнить сразу, она принимается в обработку: придёт
meta.cancel_pending: true, аmeta.refund_centsбудет равен нулю. Заказ станетcancelled, когда отмена подтвердится. - Несколько заказов сразу отменяет
POST /shipments/cancel.
Request example
curl -X POST https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/cancel \
-H "Authorization: Bearer $SHIPPICKUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Customer cancelled the order"
}'<?php
$body = [
'reason' => 'Customer cancelled the order',
];
$ch = curl_init('https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/cancel');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SHIPPICKUP_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($body),
]);
$response = json_decode((string) curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
print_r([$status, $response]);
import os
import requests
body = {
"reason": "Customer cancelled the order",
}
r = requests.post(
"https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/cancel",
headers={
"Authorization": "Bearer " + os.environ["SHIPPICKUP_API_KEY"],
},
json=body,
timeout=30,
)
print(r.status_code, r.json())
const body = {
"reason": "Customer cancelled the order"
};
const res = await fetch("https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/cancel", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SHIPPICKUP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
console.log(res.status, await res.json());
Response example 200
JSON
{
"data": {
"id": "4f2a9c1e7b3d48a6c5e0f1d2b3",
"reference": "ORDER-10452",
"status": "cancelled",
"carrier": "UPS",
"service": "Express Saver",
"tracking_number": "1Z999AA10123456784",
"price_cents": 4120,
"currency": "USD",
"from": {
"name": "Acme Store",
"company": "Acme Inc",
"line1": "350 5th Ave",
"line2": "",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
},
"to": {
"name": "Anna Schmidt",
"company": "",
"line1": "Unter den Linden 1",
"line2": "",
"city": "Berlin",
"state": "",
"postal_code": "10117",
"country": "DE"
},
"declared_value_cents": 5000,
"chargeable_weight_g": 800,
"label_available": true,
"eta_from": "2026-12-10",
"eta_to": "2026-12-12",
"source": "api",
"created_at": "2026-12-04T10:15:30+00:00",
"delivered_at": null,
"cancelled_at": null,
"pickup": null
},
"meta": {
"already_cancelled": false,
"refund_cents": 0,
"refund_status": "pending",
"refund_due_at": "2026-12-15T10:15:30+00:00",
"refund_delay_days": 10
}
}Possible errors
| HTTP | Code | Description |
|---|---|---|
| 409 | conflict | Action is currently not possible for this order (e.g., order cannot be canceled or pickup already ordered). Reason text in error.message. |
| 404 | not_found | Object not found among your account's objects (order, address, invoice, webhook, member, or team invitation), or the order has no active pickup, or the method does not exist. Objects belonging to others appear as non-existent. |
| 403 | insufficient_scope | Key lacks the required permission, specified in error.details.required_scope. |
| 429 | rate_limited | Key request limit exceeded. Retry after the time specified in the Retry-After header. |