> 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/getting-started/get-started-with-esw/quick-start-guide/returns.md).

# Returns

Register an order, check return eligibility, and create a return order. About 30 minutes.

The GRP Returns API supports cross-border returns. It registers outbound orders, creates return orders, and generates shipping labels.

**Time:** about 30 minutes

**Environment:** sandbox

You will:

1. Register an outbound order when ESW Checkout did not create it.
2. Confirm the order and items are eligible for return.
3. Get available methods and create the return order.

### Before you begin

* Know your returns `identifier`. It appears in every path as `{identifier}`.
* Have sandbox client credentials with the `logistics.returns.api.all` scope.
* Request a token with the [Authentication quick start](https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide/authentication.md).

Orders created through ESW Checkout already exist as outbound orders. Only register orders created outside ESW Checkout.

All paths below are relative to `https://api.sandbox.esw.com`.

{% stepper %}
{% step %}

#### Get an access token

Request a token with `scope=logistics.returns.api.all`. Follow the [Authentication quick start](https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide/authentication.md), then store the token in `ESW_TOKEN`.
{% endstep %}

{% step %}

#### Create an outbound order

Skip this step for an ESW Checkout order. Otherwise, register the order before creating a return. Save this body as `outbound-order.json`.

{% code expandable="true" %}

```json
{
  "orderReference": "ORD-2026-0001",
  "contactInformation": {
    "firstName": "Jane",
    "lastName": "Smith",
    "address1": "350 Fifth Avenue",
    "city": "New York",
    "region": "NY",
    "postalCode": "10118",
    "countryIso": "US",
    "email": "jane.smith@example.com",
    "telephone": "+12125551234",
    "cultureLanguageIso": "en-US"
  },
  "orderItems": [
    {
      "productCode": "SKU-00123",
      "lineItemId": "1",
      "quantity": 1,
      "productDescription": "Classic Leather Wallet",
      "productCustomsDescription": "Leather wallet, full-grain cowhide",
      "countryOfOriginIso": "IT",
      "hsCode": "420232",
      "weight": { "weightTotal": 0.15, "weightUnit": "Kg" },
      "unitPrice": { "amount": 89.95, "currency": "EUR" },
      "shippingInformation": {
        "shippingReference": "REF6993876423",
        "shippingStatus": "Shipped",
        "statusDate": "2026-10-02T09:15:00Z"
      }
    }
  ]
}
```

{% endcode %}

```sh
curl --request POST "https://api.sandbox.esw.com/returns/v1/<identifier>/outbound-orders" \
  --header "Authorization: Bearer $ESW_TOKEN" \
  --header "Content-Type: application/json" \
  --data @outbound-order.json
```

ESW returns `201 Created` with the outbound order `id` and `orderItems`. An existing order returns `409 Conflict`, unless the request sets `canOverwrite` to `true`.
{% endstep %}

{% step %}

#### Check what can be returned

Look up the order with its `orderReference`:

```sh
curl "https://api.sandbox.esw.com/returns/v1/<identifier>/orders/ORD-2026-0001" \
  --header "Authorization: Bearer $ESW_TOKEN" \
  --header "Accept: application/json"
```

Use the response to confirm the order and items remain eligible:

| Field                              | Meaning                                      |
| ---------------------------------- | -------------------------------------------- |
| `noOfArticlesAvailableForReturn`   | Number of items that can still be returned   |
| `noOfArticlesUnavailableForReturn` | Number of items that cannot be returned      |
| `returnPeriodExpired`              | Whether the return window has closed         |
| `items[].availableForReturns`      | Whether a specific item can be returned      |
| `items[].returnWindow`             | The return window for that item              |
| `returnOrders[]`                   | Return orders already created for this order |
| {% endstep %}                      |                                              |

{% step %}

#### Get the available return methods

Before creating a return, request the supported methods for the order and items:

```sh
curl --request POST "https://api.sandbox.esw.com/returns/v1/<identifier>/return-methods/ORD-2026-0001" \
  --header "Authorization: Bearer $ESW_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "returnItems": [
      {
        "id": "<item ID from the order response>",
        "productCode": "SKU-00123",
        "lineItemId": "1"
      }
    ]
  }'
```

Select a supported method. Save its `returnMethod`, `paidBy`, and `carrierServiceRoute.eswCarrierIdentifier` values. Also save `carrierServiceRoute.id` and `carrierServiceRoute.isPaperlessRoute`.

```json
{
  "returnMethods": [
    {
      "returnMethod": "PUDO",
      "paidBy": "Retailer",
      "carrierServiceRoute": {
        "id": "<carrier service route ID>",
        "eswCarrierIdentifier": "<carrier identifier>",
        "isPaperlessRoute": false,
        "isLocationRequired": true
      }
    }
  ]
}
```

`returnMethod` is `Postal`, `PUDO`, `Collection`, or `Store`. `paidBy` is `Unpaid`, `Retailer`, or `Shopper`.

When `isLocationRequired` is `true`, find nearby drop-off locations with the shopper's country and postal code. Use `Inbound` for a return and the selected `carrierServiceRoute.id`.

```sh
curl --get "https://api.sandbox.esw.com/returns/v1/<identifier>/location/" \
  --header "Authorization: Bearer $ESW_TOKEN" \
  --header "Accept: application/json" \
  --data-urlencode "CountryCode=<shopper country ISO>" \
  --data-urlencode "PostalCode=<shopper postal code>" \
  --data-urlencode "RouteType=Inbound" \
  --data-urlencode "CarrierServiceRouteId=<selected carrier service route ID>" \
  --data-urlencode "MaxDistanceInKms=5" \
  --data-urlencode "MaxLocations=10"
```

Choose one entry from `locations[]` and send its `id` in `dropOffLocation` when you create the return. The other location fields are optional. See [Return Methods](https://developer.esw.com/returns-api/grp-returns-api/concepts/return-methods.md).
{% endstep %}

{% step %}

#### Create the return order

Save this body as `return-order.json`. It shows a `Postal` return. Replace `paidBy`, `carrierIdentifier`, and `isPaperlessRoute` with the values from the method you selected.

{% code expandable="true" %}

```json
{
  "consumerEmailAddress": "jane.smith@example.com",
  "cultureLanguageIso": "en-US",
  "returnItems": [
    {
      "id": "<item id used in the return methods request>",
      "productCode": "SKU-00123",
      "lineItemId": "1",
      "reasonCode": "<reason code configured for your brand>",
      "reasonComment": "Too small"
    }
  ],
  "returnMethod": "Postal",
  "paidBy": "Retailer",
  "carrierIdentifier": "<eswCarrierIdentifier from the return methods response>",
  "isPaperlessRoute": false
}
```

{% endcode %}

`isPaperlessRoute` is a Boolean. Send `true` or `false` without quotes, exactly as the return methods response gave it.

For a `PUDO` return where `isLocationRequired` is `true`, also send the selected location:

```json
{
  "consumerEmailAddress": "jane.smith@example.com",
  "cultureLanguageIso": "en-US",
  "returnItems": [
    {
      "id": "<item id used in the return methods request>",
      "productCode": "SKU-00123",
      "lineItemId": "1",
      "reasonCode": "<reason code configured for your brand>",
      "reasonComment": "Too small"
    }
  ],
  "returnMethod": "PUDO",
  "paidBy": "Retailer",
  "carrierIdentifier": "<eswCarrierIdentifier from the return methods response>",
  "isPaperlessRoute": false,
  "dropOffLocation": {
    "id": "<selected drop-off location ID>"
  }
}
```

Leave `dropOffLocation` out for `Postal` returns.

```sh
curl --request POST "https://api.sandbox.esw.com/returns/v1/<identifier>/orders/ORD-2026-0001/return-orders" \
  --header "Authorization: Bearer $ESW_TOKEN" \
  --header "Content-Type: application/json" \
  --data @return-order.json
```

Store these response values:

| Field                 | Use it to                                                             |
| --------------------- | --------------------------------------------------------------------- |
| `returnOrderNumber`   | Identify the return in every later call, such as updates and tracking |
| `returnsListingsGuid` | Link the return to ESW's listings for audit and reporting             |
| `returnItems[].id`    | Update the status of an individual returned item                      |
| `label`               | Decode and show it only when the return document status is `Ready`    |
| `isPaperlessRoute`    | Decide whether to show a label or a QR code                           |
| `paymentRedirectUrl`  | Send the shopper to pay, when the shopper pays for the return         |

Save `returnOrderNumber`. Use it for shopper tracking, support, and any later query.

A label can still be processing after return creation. Retrieve `GET /returns/v1/<identifier>/return-orders/<returnOrderNumber>/ReturnLabel` until `documentStatus` is `Ready`. Then decode `label`. If it is `Processing`, wait 10–30 seconds before retrying. Do not create another return order.
{% endstep %}
{% endstepper %}

### Rules that prevent first-call errors

* **Create the outbound order first.** Creating a return for an unknown `orderReference` returns `404`.
* **Reuse the return methods response.** Send the selected `returnMethod`, `paidBy`, `carrierIdentifier`, and `isPaperlessRoute` values unchanged. Use the ESW carrier identifier, not the consumer-facing name.
* **Keep the item `id` constant.** Use the same `id` for each item in the return methods request and the return order request.
* **Use a `reasonCode` configured for your brand.** It is a string, not a fixed list in the API. Get the codes for each market from `GET /returns/v1/<identifier>/configuration/countries/<countryIso>`.
* **Match product codes.** `productCode` and `lineItemId` must match the original order.
* **Provide `consumerEmailAddress`.** The shopper needs it for confirmations and tracking updates.
* **Send numbers, not strings.** Amounts and weights are JSON numbers.

### Common errors

| Status | Cause                                                                                                               | Fix                                                                                   |
| ------ | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `400`  | Validation failed, for example an invalid `returnMethod` or `paidBy` value, or a missing `dropOffLocation` for PUDO | Check the field named in the response and the values from the return methods response |
| `401`  | Token missing or invalid                                                                                            | Request a new token and resend                                                        |
| `403`  | Token lacks the `logistics.returns.api.all` scope                                                                   | Request a token with that scope                                                       |
| `404`  | Order reference or tenant not found                                                                                 | Create the outbound order first and check `identifier`                                |
| `409`  | The outbound order already exists                                                                                   | Set `canOverwrite` to `true` if you intend to replace it                              |

See [Response Codes](https://developer.esw.com/returns-api/grp-returns-api/response-codes.md) for endpoint-specific error codes.

### Next steps

* Read every field, including PUDO, paperless, and weight, in [Creating a Return Order](https://developer.esw.com/returns-api/resources/tutorials/creating-a-return-order.md)
* Learn how to change a return in [Updating a Return Order](https://developer.esw.com/returns-api/resources/tutorials/updating-a-return-order.md)
* Review [Return Order](https://developer.esw.com/returns-api/grp-returns-api/concepts/return-order.md) and [Tracking and Updates](https://developer.esw.com/returns-api/grp-returns-api/concepts/tracking-and-updates.md)
* Return to the [Quick Start Guide](https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide/returns.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
