Cancel order
Requests cancellation of an order. A 201 response means the cancellation request was received — not necessarily that the order is cancelled yet.
Check the cancellationStatus in the response:
- orders that can be cancelled immediately (for example, those not yet dispatched) come back
canceledright away - others come back
pendingand are reviewed asynchronously before being approved or denied
For requests that return pending, listen for the order.cancellationrequest.created and order.cancellationrequest.updated events to learn the outcome — see Order Cancellation Requests events.
POST
/{id}/cancelPath parameters
idstringrequiredThe ID of the order to cancel
Request body
application/jsonreasonstringrequiredReason for the cancellation
Responses
201Cancellation requested. The response reflects the current `cancellationStatus`: usually `pending` (queued for asynchronous review), but already `canceled` for orders that are cancelled immediately.
cancellationStatusstringStatus of the cancellation request. `pending`: the request is awaiting review. `approved` or `canceled`: the order has been cancelled. `denied`: the request was rejected and the order continues processing.
Allowed:
approveddeniedpendingcanceledcancellationReasonstringReason for the cancellation request
requestedAtstring<date-time>requiredTimestamp when the cancellation was requested
400Bad request - Invalid input data
codestringrequiredError code indicating the type of error
messagestringrequiredHuman-readable error message explaining what went wrong
detailsobject[]Detailed validation errors when applicable
Show propertiesHide properties
Array of
objectfieldstringrequirederrorstringrequired401Unauthorized - Missing or invalid authentication
codestringrequiredError code indicating the type of error
messagestringrequiredHuman-readable error message explaining what went wrong
detailsobject[]Detailed validation errors when applicable
Show propertiesHide properties
Array of
objectfieldstringrequirederrorstringrequired500Internal server error
codestringrequiredError code indicating the type of error
messagestringrequiredHuman-readable error message explaining what went wrong
detailsobject[]Detailed validation errors when applicable
Show propertiesHide properties
Array of
objectfieldstringrequirederrorstringrequiredRequest
curl -X POST "https://api.sibipro.com/orders/string/cancel" \
-H "Content-Type: application/json" \
-d '{
"reason": "Customer requested a cancellation"
}'const response = await fetch("https://api.sibipro.com/orders/string/cancel", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"reason": "Customer requested a cancellation"
})
});Response
{
"cancellationStatus": "pending",
"cancellationReason": "Customer requested a cancellation",
"requestedAt": "2024-01-20T12:00:00Z"
}{
"code": "string",
"message": "The request contains invalid parameters",
"details": [
{
"field": "customer.email",
"error": "Invalid email"
},
{
"field": "address.postalCode",
"error": "Invalid"
}
]
}{
"code": "string",
"message": "The request contains invalid parameters",
"details": [
{
"field": "customer.email",
"error": "Invalid email"
},
{
"field": "address.postalCode",
"error": "Invalid"
}
]
}{
"code": "string",
"message": "The request contains invalid parameters",
"details": [
{
"field": "customer.email",
"error": "Invalid email"
},
{
"field": "address.postalCode",
"error": "Invalid"
}
]
}