# Relay Orders

Using Relay the order data in an external commerce platform is translated into a single common schema, the Violet Order with a nested Violet Bag, in real time. You can fetch these orders using the Relay Get Orders endpoint.

**Get Orders**

`GET /v1/relay/merchants/{merchant_id}/orders`

**Optional Query Parameters**

The following query parameters can be used with Get Orders requests.

`size` - use the `size` field in your Relay request to define the total number of results. When no value is provided, the results will be limited to 20. The upper bound of this field will conform to the limitations of the external commerce platform.

`page` - when interacting with external commerce platforms that use page-based pagination, used the `page` field in your Relay request to define what page of results you want to retrieve. When no value is provided, the first page of results based on the value of `size` will be returned.

`next_page_cursor` - when interacting with external commerce platforms that use cursor-based pagination, used the `next_page_cursor` field in your Relay request to define that page of results you want to retrieve. For these platforms, the response body from the request will also include a `next_page_cursor` field which will provide the cursor for the next page, if any.

Sample Request for first page of 20 Shopify Orders.

`GET /v1/relay/merchants/{merchant_id}/orders?size=20`

<details>

<summary>Sample Response</summary>

```json
{
  "content": [{
    "customer": {
      "first_name": "First",
      "last_name": "Last",
      "email": "example@violet.io",
      "external_id": "1864204955938",
      "name": "First Last"
    },
    "bags": [{
      "external_id": "5378693890338",
      "status": "IN_PROGRESS",
      "fulfillment_status": "PROCESSING",
      "financial_status": "PAID",
      "skus": [{
        "name": "Product #5000 - Black / Small",
        "quantity": 1,
        "price": 4000,
        "line_price": 4000
      }],
      "sub_total": 4000,
      "shipping_total": 490,
      "tax_total": 0,
      "total": 4490,
      "taxes_included": false,
      "currency": "USD",
      "wallet_based_checkout": false,
      "bag_status": "IN_PROGRESS"
    }],
    "shipping_address": {
      "name": "First Last",
      "city": "PLEASANT GROVE",
      "state": "UT",
      "country": "US",
      "postal_code": "84062",
      "type": "SHIPPING",
      "first_name": "First",
      "last_name": "Last",
      "address_1": "4454 W CAMBRIDGE DR"
    },
    "billing_address": {
      "name": "First Last",
      "city": "PLEASANT GROVE",
      "state": "UT",
      "country": "US",
      "postal_code": "84062",
      "type": "BILLING",
      "first_name": "First",
      "last_name": "Last",
      "address_1": "4454 W CAMBRIDGE DR"
    },
    "sub_total": 4000,
    "shipping_total": 490,
    "tax_total": 0,
    "total": 4490,
    "status": "IN_PROGRESS",
    "priced": true,
    "wallet_based_checkout": false,
    "currency": "USD",
    "currency_symbol": "$",
    "order_status": "IN_PROGRESS",
    "intent_based_checkout": false
  }],
  "last": false,
  "number_of_elements": 1,
  "empty": false,
  "next_page_cursor": "eyJsYXN0X2lkIjo1Mzc4NjkzODkwMzM4LCJsYXN0X3ZhbHVlIjoiMjAyMy0wNy0yNCAxNzowMjo1OC40ODU2NzIiLCJkaXJlY3Rpb24iOiJuZXh0In0"
}
```

</details>


---

# Agent Instructions: 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:

```
GET https://docs.violet.io/relay/get-orders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
