> For the complete documentation index, see [llms.txt](https://help.citrusad.com/retail-media-interface/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.citrusad.com/retail-media-interface/integration/data-api/order-data-1/syncing-order-data-via-api.md).

# Syncing order data via API

## Syncing order data via backend (recommended)

To send order data to Epsilon Retail Media, use a command similar to the command below. Note that the data in the `orders` field below is dummy data, and is provided here only as an example. These examples all display the **standard integration**.

{% hint style="info" %}
**Integrating a marketplace sellerId?** Be sure to read the Marketplace sellerId section below.
{% endhint %}

### Single item orders

Below is the context for a customer who has purchased a single item:

```http
POST $BASE_URL/v1/orders HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "orders": [
       {
        "customerId": "npc-s243-ir",
        "teamId": "9f48572c-0a5b-4997-9a0e-ed74f4d32dc6",
        "sessionId": "5cat7-9964-4f",
        "dtmcookieid": "DTM_COOKIE_ID",
        "orderDate": "2021-12-02T15:00:00Z",
        "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
        "orderItems": [
            {
                  "gtin": "9891998566P",
                  "quantity": 3,
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"
                }
              ]
            }
    ]
}
```

If successful, the following object will be returned:

```http
HTTP/2 200
{
    "orders": [
        {
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "customerId": "npc-s243-ir",
            "sessionId": "5cat7-9964-4f",
            "dtmcookieid": "aaa_bbb_e345D",
            "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
            "orderItems": [
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                }
            ],
            "orderDate": "2021-12-02T15:00:00Z",
        }
    ]
}
```

{% hint style="warning" %}
**OrderDate format** OrderDate in the format above is read as UTC time. You will need to synchronise in UTC.

Alternatively, you can set an offset for your timezone, subsituting `Z` for `+HH:MM` relevant to your timezone. For example: “orderDate”: `“2021-12-02T15:00:00+10:00"` will specify the timezone is UTC+10.
{% endhint %}

### Multi-item orders

Below is the context for a customer who has purchased multiple items - there are multiple items in the `orderItems` array:

```http
POST $BASE_URL/v1/orders HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "orders": [
       {
        "customerId": "npc-s243-ir",
        "teamId": "9f48572c-0a5b-4997-9a0e-ed74f4d32dc6",
        "sessionId": "5cat7-9964-4f",
        "dtmcookieid": "DTM_COOKIE_ID",
        "orderDate": "2021-12-02T15:00:00Z",
        "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
        "orderItems": [
            {
                  "gtin": "9891998566P",
                  "quantity": 3,
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"
                }
              ]
            },
          {
                  "gtin": "9891998566P",
                  "quantity": 3,
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"
                }
              ]
            }
    ]
}
```

If successful, the following object will be returned:

```http
HTTP/2 200
{
    "orders": [
        {
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "customerId": "npc-s243-ir",
            "sessionId": "5cat7-9964-4f",
            "dtmcookieid": "aaa_bbb_e345D",
            "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
            "orderItems": [
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                },
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                }
            ],
            "orderDate": "2021-12-02T15:00:00Z",
        }
    ]
}
```

### Syncing multiple orders

If you are syncing multiple orders, you can send up to 100 items as a batch with each request. The number of requests you can make is unlimited. The payload order pushed is the same order as the result returned. This makes it possible for the data to remain congruent with the order representation in your backend.

```http
POST $BASE_URL/v1/orders HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "orders": [
       {
        "customerId": "npc-s243-ir",
        "teamId": "9f48572c-0a5b-4997-9a0e-ed74f4d32dc6",
        "sessionId": "5cat7-9964-4f",
        "dtmcookieid": "DTM_COOKIE_ID",
        "orderDate": "2021-12-02T15:00:00Z",
        "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
        "orderItems": [
            {
                  "gtin": "9891998566P",
                  "quantity": 3,
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"
                }
              ]
            },
        {
      		  "customerId": "rw3-v3ag-ol0",
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "sessionId": "2m342-2dfe-0f",
      		  "orderDate": "2021-12-02T15:00:00Z",
      		  "id": "i32dm3e4-c158-43d78-43ww32x-m2ide3e3",
      		  "orderItems": [
            {
                  "gtin": "9891998566P",
                  "quantity": 3,
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"
                }
              ]
            }
    ]
}
```

If successful, the following object will be returned:

```http
HTTP/2 200
{
    "orders": [
        {
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "customerId": "npc-s243-ir",
            "sessionId": "5cat7-9964-4f",
            "dtmcookieid": "aaa_bbb_e345D",
            "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
            "orderItems": [
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                }
            ],
            "orderDate": "2021-12-02T15:00:00Z"
        },
        {
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "customerId": "npc-s243-ir",
            "sessionId": "5cat7-9964-4f",
            "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
            "orderItems": [
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                }
            ],
            "orderDate": "2021-12-02T15:00:00Z"
        }
    ]
}
```

## Marketplace sellerId

If you are onboarding marketplace sellers you need to synchronise the `sellerId` where applicable when reporting orders. In the event the purchased product does not have a `sellerId`, it can be omitted.

{% hint style="danger" %}
**If you are not onboarding marketplace sellers, you do not need to specify sellerId in the order report**
{% endhint %}

Below is an example of an order where one product is from a marketplace seller and another is not a marketplace product:

```http
POST $BASE_URL/v1/orders HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "orders": [
       {
        "customerId": "npc-s243-ir",
        "teamId": "9f48572c-0a5b-4997-9a0e-ed74f4d32dc6",
        "dtmcookieid": "DTM_COOKIE_ID",
        "sessionId": "5cat7-9964-4f",
        "orderDate": "2021-12-02T15:00:00Z",
        "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
        "orderItems": [
            {
                  "gtin": "9891998566P",
                  "quantity": 3,
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"
                }
              ]
            },
          {
                  "gtin": "9891998566P",
                  "quantity": 3,
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                }
              ]
            }
    ]
}
```

### Retrieving order information

If you wish to verify order information within Epsilon Retail Media, you will make a GET request to the `/orders/` API with the order id.

```http
GET $BASE_URL/v1/orders/<ORDER_ID> HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
```

You will retrieve all information related to the order stored within the Epsilon Retail Media system.\
In the event the order is not found, it has likely not been ingested into the Epsilon Retail Media system.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.citrusad.com/retail-media-interface/integration/data-api/order-data-1/syncing-order-data-via-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
