Cancel Order

To cancel an order

Cancel Orders: Clients can cancel orders. The Couriers can also cancel orders on behalf of the clients by using their own API key.

This endpoint is used to cancel orders.

NameTypeDescription
orderIdsArray of StringsRequired. An array of order IDs to cancel or delete before the order starts or completes. The body must be an array, even if only one order ID is included

Completed Orders cannot be deleted/cancelled, example request:

curl -i -X POST "https://onfleet.com/api/v2/taskOrders/cancel" \
     -u "c64f80ba83d7cfce8ae74f51e263ce93:"
		 -d {"orderIds": ["bShwrO6F7wQ4aqz9xAjhmzE4"]}

Response:

{
    "status": "success",
    "totalOrdersRemoved": 1
}

If you are a Courier and using your own API key instead of the Client's API key, you will need to specify the client and the orderIds to cancel an order

NameTypeDescription
clientStringRequired. To identify the client of which the order is coming from.
orderIdsArray of StringsRequired. An array of order IDs to cancel or delete before the order starts or completes. The body must be an array, even if only one order ID is included
curl -i -X POST "https://onfleet.com/api/v2/taskOrders/cancel" \
     -u "c64f80ba83d7cfce8ae74f51e263ce93:"
		 -d {"client":"K1hwVO637w54azpAxAj*DzM3", "orderIds": ["bShwrO6F7wQ4aqz9xAjhmzE4"]}