---
title: "Order delete data model"
slug: "order-delete-data-model"
abstract: "Describes the standard data model for deleting orders (Sitecore CDP Batch API)."
---
# Order delete data model

The Order Delete API uses a combination of the `referenceId` and `orderedAt` values to [delete an order](https://doc.sitecore.com/cdp/en/developers/api/batch-api/batch-api-offline-orders/using-order-delete.html "Using order delete"). This is because some organizations recycle `referenceId` values, so supplying the `orderedAt` value as well ensures you are identifying the correct order for deletion. Sitecore CDP identifies an order for deletion if the `orderedAt` value is within 24 hours of the `orderedAt` value sent in the request and the `referenceId` values are the same.

In rare circumstances, you must also use the `orderRef` attribute in the request to identify the correct order for deletion. You only need to do this if the order you want to delete has an `orderedAt` value that's within 24 hours of another order, and both orders have the same `referenceId` value. For example, you want to delete an order with an `orderedAt` value of `"2023-09-25T16:`17:16`.000Z"` and there's another order with an `orderedAt` value of `"2023-09-25T20:`47:55`.000Z"`. If both orders have the same `referenceId` value of `"B94TXY-1"`, you must also use the `orderRef` attribute in the request, as shown in the second JSON example.

To obtain the `orderRef` value, you can [use debug mode](https://doc.sitecore.com/cdp/en/users/sitecore-cdp/en/use-debug-mode-in-sitecore-cdp.html) to view the JSON of the guest profile and copy the `ref` value from the `orders` object. Alternatively, you can [use the data lake export service](https://doc.sitecore.com/cdp/en/developers/api/data-lake-export-service/data-entities-reference/orders.html "Orders") to obtain the `meta_ref` value which is the same as the `orderRef` value. You can also use Audience Export to obtain the `orderRef` value.

When you create a batch file, ensure that you include all [required attributes](https://doc.sitecore.com/cdp/en/developers/api/batch-api/batch-api-offline-orders/batch-file-formatting-requirements.html#UUID-4499e082-be7d-9ebb-4936-c178936c1e06_para-idm1903351877649584) in addition to any attributes from the following table:

:::tab{title="2.1"}

| Attribute | Description | Type | Example(s) |
| --- | --- | --- | --- |
| `ref` | A unique ID that identifies the JSON record during the upload process. This ID is not used inside Sitecore CDP to identify the guest or the record; it is for the upload process only. | string<br><br>Version 4 UUID | `"056621C2-C955-492D-B7EE-C77C6BDDFDEE"` |
| `schema` | The type of record contained in the `value` field that is being imported. This must be set to `"order"` when deleting orders.. | string | `"order"` |
| `mode` | The Batch API mode. This must be set to `"delete"`. | string | `"delete"` |
| `value` | Contains the entity to be deleted from Sitecore CDP. | JSON object | N/A |
| `orderRef` | A unique ID generated by Sitecore CDP to reference the order. | string | `"1202a558-5de3-46fc-8e45-eac7420f8c55"` |
| `referenceId` | A unique ID generated by your organization to reference the order. | string | `"B94TXY-1"` |
| `orderedAt` | The date and time the order was made. | ISO 8601 Date/Time UTC | `"2026-03-07T16:`15:11`.000Z"` |

Here's a JSON example that uses the `"referenceId"` and `"orderedAt"` attributes to delete an order:

```json
{
   "ref":"056621C2-C955-492D-B7EE-C77C6BDDFDEE",
   "schema":"order",
   "mode":"delete",
   "value":{
      "referenceId":"B94TXY-1",
      "orderedAt":"2026-03-07T16:`15:11`.000Z"
   }
}

```

Here's a JSON example that uses the `"orderRef"`, `"referenceId"`, and `"orderedAt"` attributes to delete an order:

```csharp
{
   "ref":"056621C2-C955-492D-B7EE-C77C6BDDFDEE",
   "schema":"order",
   "mode":"delete",
   "value":{
      "orderRef":"1202a558-5de3-46fc-8e45-eac7420f8c55",
      "referenceId":"B94TXY-1",
      "orderedAt":"2026-03-07T16:`15:11`.000Z"
   }
}

```

:::