Using order delete
The Order Delete endpoint in the Sitecore CDP Batch API enables you to delete an order and all order items associated with the order. After you delete an order, it is no longer visible in the guest profile. You cannot undo this operation. After you delete an order, you cannot retrieve the order or any related order items.
The Order Delete API uses a combination of the referenceId and orderedAt values to identify the order to delete. This is because some organizations recycle referenceId values so providing the orderedAt value ensures you are identifying the correct order for deletion.
To delete an order, you must upload a batch file containing the order. You must use delete mode.
The Order Delete endpoint then attempts to find any orders that match the referenceId and orderedAt values:
-
If the Order Delete endpoint finds one order with a matching
referenceIdvalue, the Order Delete endpoint returns a 200 ResponseOrder and associated entities deleted. The order is permanently deleted along with its order items. -
If the Order Delete endpoint finds more than one order with the same
referenceIdvalue and you didn't provide a date for theorderedAtvalue, the Order Delete endpoint returns a 400 Response More than one order exists with that referenceId, please supply the orderedAt date for the order you wish to delete. -
If the Order Delete endpoint doesn't find an order with the provided
referenceIdvalue andorderedAtvalue, the Order Delete endpoint returns a 404 Response No order found for the provided referenceId and orderedAt attributes.