Delete Order
Delete an order from the system. The order can only be deleted if it has the status PLACED (has not been processed for fulfillment).
DELETE
/v1/client/shipment/delete/:unique_order_numberThis endpoint allows you to delete a shipment. The shipment must only have the status PLACED to be able to delete it. It is necessary to add the Bearer token to the request headers.
Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | β Yes | Bearer token obtained from /token/generate endpoint |
Examples
- cURL
- JavaScript
- Python
curl -X DELETE https://apisandbox.eonwms.com/v1/client/shipment/delete/ORDERTEST-104 \
-H "Authorization: Bearer YOUR_TOKEN"
const uniqueOrderNumber = 'ORDERTEST-104';
const response = await fetch(
`https://apisandbox.eonwms.com/v1/client/shipment/delete/${uniqueOrderNumber}`,
{
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
}
);
const result = await response.json();
if (response.ok) {
console.log('Order deleted successfully');
} else {
console.error('Error:', result.fault.message);
}
import requests
unique_order_number = 'ORDERTEST-104'
response = requests.delete(
f'https://apisandbox.eonwms.com/v1/client/shipment/delete/{unique_order_number}',
headers={
'Authorization': 'Bearer YOUR_TOKEN'
}
)
result = response.json()
if response.status_code == 200:
print('Order deleted successfully')
else:
print(f'Error: {result["fault"]["message"]}')
Responses
200Success - Order deleted
{
"code": 200,
"fault": null,
"success": {
"arguments": {},
"type": "success",
"message": "Order deleted successfully."
}
}
401Unauthorized - Invalid token
{
"code": 401,
"fault": {
"arguments": {
"Authorization": "invalid"
},
"type": "InvalidAuthorizationException",
"message": "The request is unauthorized, the access token is invalid."
}
}
422Unprocessable - Order already processed
{
"code": 422,
"fault": {
"arguments": {
"orderStatus": "PLACED"
},
"type": "alreadyFulfilled",
"message": "The order COD00001 has already been fulfilled and cannot be cancelled."
}
}
Deletion Rulesβ
Allowed States for Deletionβ
You can only delete orders that are in PLACED status. This means:
- β The order was created but not processed
- β Inventory has not been verified
- β No labels have been generated
- β The picking process has not started
NOT Allowed Statesβ
You cannot delete orders in the following states:
- β READY - Inventory has already been reserved and the order has begun its preparation process
- β FULFILLED - The order is already prepared and ready to be shipped
- β SEND - The order has already been shipped
- β DELIVERED - The order has already been delivered
Common Use Casesβ
1. Customer Cancellationβ
async function cancelOrderByCustomer(orderNumber) {
// First verify the order status
const statusResponse = await fetch(
`https://apisandbox.eonwms.com/shipment/client/order-status/${orderNumber}`,
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
const statusData = await statusResponse.json();
const currentStatus = statusData.data.find(s => s.current).status;
if (currentStatus === 'PLACED') {
// Proceed with deletion
const deleteResponse = await fetch(
`https://apisandbox.eonwms.com/v1/client/shipment/delete/${orderNumber}`,
{
method: 'DELETE',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
if (deleteResponse.ok) {
return { success: true, message: 'Order cancelled successfully' };
}
} else {
return {
success: false,
message: `Cannot cancel. Current status: ${currentStatus}`
};
}
}
2. Clean Up Test Ordersβ
async function cleanTestOrders(prefix = 'TEST-') {
// Get list of orders (this endpoint is not documented yet)
const deletedOrders = [];
const notDeletedOrders = [];
for (const order of testOrders) {
if (order.uniqueOrderNumber.startsWith(prefix)) {
try {
const response = await fetch(
`https://apisandbox.eonwms.com/v1/client/shipment/delete/${order.uniqueOrderNumber}`,
{
method: 'DELETE',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
if (response.ok) {
deletedOrders.push(order.uniqueOrderNumber);
} else {
notDeletedOrders.push(order.uniqueOrderNumber);
}
} catch (error) {
console.error(`Error deleting ${order.uniqueOrderNumber}`);
}
}
}
return { deleted: deletedOrders, notDeleted: notDeletedOrders };
}
Important Considerationsβ
Irreversible Action
Order deletion is permanent and irreversible. Once deleted:
- You will not be able to recover the order information
- There will be no record in the history
- You will need to create a new order if necessary
Alternative: Cancelled Status
If you need to keep a record of the order for auditing or reporting, consider:
- Contacting support to change the status to CANCELLED instead of deleting it
- Implementing a custom field to mark orders as "cancelled" in your system
Inventory
When you delete an order in PLACED status:
- Inventory is not affected because it had not been reserved yet
- If the order was already in READY or later status, inventory is not automatically released