> 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/create-an-undeliverable-return-order.md).

# Create An Undeliverable Return Order

To create a return order for an order or package that could not be delivered to the shopper, send a `POST` request to `/api/v2.1/UndeliverableReturns`.

<details>

<summary>Required Parameters</summary>

| **Parameter**      | **Type** | **Description**                                                                                                                                                                                                                                   |
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| brandCode          | String   | <p>ESW’s unique identifier for the retailer.</p><p>Example: <code>GOC</code></p>                                                                                                                                                                  |
| packageReference   | String   | <p>The retailer's unique reference number for a package.</p><p>Example: <code>123456789A</code></p><p>Do not use special characters like <code>#</code>.</p><p>Not recommended: <code>AAA#1234</code></p><p>Recommended: <code>AAA1234</code></p> |
| emailAddress       | String   | <p>The email address of the shopper.</p><p>Example: <code><jane@janedoe.com></code></p>                                                                                                                                                           |
| requestUpdateLabel | Boolean  | Indicates if a label should be returned in the response. The values are `true` or `false`.                                                                                                                                                        |

</details>

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

When you send the API request, the system validates the request parameters and searches for the order/package in the ESW database. The system also ensures that an undeliverable return order does not already exist for the same package.

<details>

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

| **Response Code**     | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                      |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **201 - Created**     | <p>Indicates that an undeliverable return is created. Additionally:</p><ul><li>Each order article in the order is marked as Returned with the reason code as <code>CancelRuleInvoked</code> and linked to the return.</li><li>The event is created and assigned to the return in the database.</li><li>If the <code>"requestUpdateLabel": "true"</code> in the API request, the updated label is returned in the response.</li></ul> |
| **400 - Bad Request** | Indicates that the request does not contain the required details.                                                                                                                                                                                                                                                                                                                                                                    |
| **404 - Not Found**   | Indicates that the package could not be found. If any of the return order articles have already been returned previously, the API returns a response indicating that an undeliverable return order already exists.                                                                                                                                                                                                                   |

</details>

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

The following example shows how to create a return for an undeliverable order and get a returns label in the response.

<details>

<summary>Request body</summary>

{% code expandable="true" %}

```json
{
  "brandCode": "ABC",
  "packageReference": "123456789A",
  "emailAddress": "test@example.com",
  "requestUpdateLabel": true
}
```

{% endcode %}

</details>

### Response Example <a href="#response-example" id="response-example"></a>

<details>

<summary>Response body</summary>

{% code expandable="true" %}

```json
{
  "responseCode": 1,
  "responseMessage": "",
  "emailAddress": "test@example.com",
  "updateReturnLabel": "VGhpcyBpcyBhIHRlc3QgbGFiZWwgd2l0aCBub3RoaW5nIGluIGl0IGFzIGl0IGlzIGp1c3QgZm9yIGFuIGV4YW1wbGU="
}
```

{% 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/create-an-undeliverable-return-order.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.
