> 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/grp-returns-api/response-codes.md). Agents can also search and read this documentation through its [MCP server](https://developer.esw.com/~gitbook/mcp).

# Response Codes

HTTP response codes and endpoint-specific error codes for the ESW Returns API.

All the versions of the Returns API expose the API errors in two ways - HTTP response codes as well as human-readable messages in the `JSON` format.

## Standard HTML Response Codes <a href="#standard-html-response-codes" id="standard-html-response-codes"></a>

The following table lists the standard HTTP responses codes:

| **Status Code**        | **Description**                                                                                                                                                             |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 (OK)               | This response indicates that your request was successful. For instance, when the API request is valid, and the return status is updated.                                    |
| 201 (Resource Created) | This response code indicates that the request has succeeded, and a new resource has been created. For instance, when the undeliverable return is created successfully.      |
| 400 (Bad Request)      | This response indicates that your request contains errors and could not be completed. For instance, if the request payload is empty or if mandatory parameters are missing. |
| 403 (Forbidden)        | This response code indicates that access is forbidden.                                                                                                                      |
| 404 (Not found)        | This response is returned if the system is unable to locate the order in the system.                                                                                        |

## API Specific Error Codes <a href="#api-specific-error-codes" id="api-specific-error-codes"></a>

The following table lists the unique error responses for both versions of the Returns API:

### `GetReturn` <a href="#getreturn" id="getreturn"></a>

| **Code** | **Message**                          | **Description**                                             |
| -------- | ------------------------------------ | ----------------------------------------------------------- |
| 0        | RequestDoesNotContainAllRequiredInfo | A required field is missing.                                |
| 2        | ReturnOrderNotFound                  | The system could not find the return order in the database. |

### `UpdateReturn` <a href="#updatereturn" id="updatereturn"></a>

| **Code** | **Message**                                        | **Description**                                                                  |
| -------- | -------------------------------------------------- | -------------------------------------------------------------------------------- |
| 0        | RequestDoesNotContainAllRequiredInfo               | A required field is missing.                                                     |
| 1        | ReturnOrderNotFound                                | The system could not find the return order in the database.                      |
| 2        | ReturnOrderNotUpdatedReturnIsAlreadyOnHold         | The return order is on hold.                                                     |
| 3        | ReturnOrderNotUpdatedReturnOrderWasNotOnHold       | The return order is not on hold.                                                 |
| 4        | ReturnOrderNotUpdatedOrderArticlesDoNotMatch       | The order articles in the request do not match the articles in the return order. |
| 5        | ReturnOrderNotUpdatedReturnHasAlreadyBeenProcessed | The return has already been processed.                                           |
| 7        | ReturnOrderNotUpdatedReturnHasAlreadyHadActivity   | The return order had an activity, for example, the status was changed.           |
| 8        | ReturnOrderNotUpdatedReturnHasAlreadyBeenCancelled | The return order is already cancelled.                                           |

### `CreateReturn` <a href="#createreturn" id="createreturn"></a>

| **Code** | **Message**                                         | **Description**                                                                                           |
| -------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| 0        | RequestDoesNotContainAllRequiredInfo                | A required field is missing.                                                                              |
| 1        | OrderNotFound                                       | The system could not find the order in the database.                                                      |
| 2        | ReturnOrderNotCreatedCancelOrderIsNotAllowed        | The return order could not be created because the order cancellation is not allowed.                      |
| 3        | ReturnOrderNotCreatedCancelOrderIsNotValidForReturn | The return order could not be created because the matching order articles are not available for a return. |
| 6        | ReturnOrderNotCreatedLabelFailed                    | The return label could not be generated.                                                                  |

### `UndeliverableReturns` <a href="#undeliverablereturns" id="undeliverablereturns"></a>

| **Code** | **Message**                                       | **Description**                                |
| -------- | ------------------------------------------------- | ---------------------------------------------- |
| 0        | RequestDoesNotContainAllRequiredInfo              | A required field is missing.                   |
| 1        | PackageNotFound                                   | The system is unable to find the package.      |
| 2        | PackageItemHasAlreadyBeenProcessedAsUndeliverable | An undeliverable return order already exists.  |
| 3        | AtleastOnePackageItemHasAlreadyBeenReturned       | The order articles have already been returned. |


---

# 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/returns-api/grp-returns-api/response-codes.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.
