> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/returns-api/returns-api-v2.1/methods/retrieve-return-orders-within-a-date-range.md).

# Retrieve Return Orders Within A Date Range

To retrieve return orders within a specific date range and a return status (for example, created, on-hold, or processed), use the `GetReturnOrders` method and send a `GET` request to `/api/v2.1/Returns`.

<details>

<summary>Required Parameters</summary>

| **Parameter**     | **Type** | **Description**                                                                                                                                                                                                                                  |
| ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| returnOrderStatus | Integer  | <p>The status of the return order.</p><p>Example: <code>1</code></p>                                                                                                                                                                             |
| fromDate          | DateTime | <p>The starting date and time (UTC) when the <code>returnOrderStatus</code> was created.</p><p>Example: <code>2020-10-01T00:00:00.000Z</code></p>                                                                                                |
| toDate            | DateTime | <p>The ending date and time (UTC) when the <code>returnOrderStatus</code> was created.</p><p>Example: <code>2020-10-20T00:00:00.000Z</code></p><p>The <code>toDate</code> must be later than <code>fromDate</code> and within 31 days of it.</p> |

</details>

### Response <a href="#response" id="response"></a>

When you send the API request, the system validates these parameters along with the `brandCode` parameter (which is retrieved from the request’s Security Token) and searches for all return orders within the specified date range in the ESW database.

<details>

<summary><strong>HTTP Response Status</strong></summary>

| **Response Code**     | **Description**                                                                                                                                                          |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **200 - OK**          | Indicates that the validation is successful and the system is able to find the return order in the database. Detailed order information is returned in the API response. |
| **400 - Bad Request** | Indicates that validation failed due to missing parameters.                                                                                                              |
| **404 - Not Found**   | Indicates that the system is unable to locate the return order in the ESW database.                                                                                      |

</details>

### Request Example <a href="#request-example" id="request-example"></a>

The following example shows how to get return orders using `fromDate` and `toDate` along with `returnOrderStatus`.

`/api/v2.1/Returns?returnOrderStatus=1&fromDate=2020-10-01T00:00:00.000Z&toDate=2020-10-20T00:00:00.000Z`

<details>

<summary>Response Example</summary>

{% code expandable="true" %}

```json
{
  "responseMessage": 0,
  "returnOrders": [
    {
      "returnOrderNumber": "7601290",
      "returnCentreCode": "254",
      "brandOrderReference": "TH798651792",
      "brandReturnOrderNumber": "6001002976556",
      "eshopOrderReference": "5001006843442",
      "returnCarrierReference": "6001002976554",
      "creationTime": "2020-10-16T17:06:41.134Z",
      "returnOrderType": 0,
      "returnOrderStatus": 1,
      "returnOrderStatusTime": "2020-10-16T17:06:41.134Z",
      "createReturnLabel": "1234567890123456789012345678901234567890",
      "updateReturnLabel": "1234567890123456789012345678901234567890",
      "refundFailedReason": "WrongItem",
      "returnOrderRefunds": {
        "refundStatus": 1
      }
    },
    {
      "returnOrderNumber": "7601291",
      "returnCentreCode": "254",
      "brandOrderReference": "TH1231231",
      "brandReturnOrderNumber": "6001002976557",
      "eshopOrderReference": "5001006843443",
      "returnCarrierReference": "6001002976555",
      "creationTime": "2020-10-17T12:30:00.000Z",
      "returnOrderType": 0,
      "returnOrderStatus": 1,
      "returnOrderStatusTime": "2020-10-17T12:30:00.000Z",
      "createReturnLabel": "1234567890123456789012345678901234567890",
      "updateReturnLabel": "1234567890123456789012345678901234567890",
      "refundFailedReason": "WrongItem",
      "returnOrderRefunds": {
        "refundStatus": 1
      }
    }
  ],
  "responseCode": 0
}
```

{% endcode %}

</details>


---

# 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://developer.esw.com/returns-api/returns-api-v2.1/methods/retrieve-return-orders-within-a-date-range.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.
