Skip to main content

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_number

This 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

ParameterTypeRequiredDescription
Authorizationstringβœ… YesBearer token obtained from /token/generate endpoint

Examples

curl -X DELETE https://apisandbox.eonwms.com/v1/client/shipment/delete/ORDERTEST-104 \
-H "Authorization: Bearer YOUR_TOKEN"

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