> 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/core-concepts/documents-and-labels.md).

# Documents and Labels

The platform generates shipping labels through carrier integrations. Labels can be requested in multiple formats and retrieved via dedicated document endpoints.

{% tabs %}
{% tab title="Label Formats" %} <kbd>`PDF`</kbd>  <kbd>`ZPL`</kbd>  <kbd>`HTML`</kbd>  <kbd>`PNG`</kbd>  <kbd>`NoLabel`</kbd>

The format can be specified when creating shipments via the `labelFormat` field.
{% endtab %}

{% tab title="Document Types" %} <kbd>`ReturnLabel`</kbd>  <kbd>`LastMileLabel`</kbd>

Retrieve via `GET /{id}/return-orders/{num}/{docType}`.&#x20;

Documents have a status: `Processing`, `Ready`, or `Failed`.

After a return order is created, GRP asynchronously generates one or more documents. The `GetDocument` endpoint returns the document content and its current status.
{% endtab %}
{% endtabs %}

| Document Type   | Description                                                           | Typical Format  |
| --------------- | --------------------------------------------------------------------- | --------------- |
| `ReturnLabel`   | Carrier return shipping label for the shopper to affix to the parcel  | PDF / ZPL / PNG |
| `LastMileLabel` | Last-mile delivery label applied by the hub or consolidation facility | PDF / ZPL       |

#### Document status

<kbd>`Processing`</kbd>  <kbd>`Ready`</kbd>  <kbd>`Failed`</kbd>

{% hint style="warning" icon="traffic-light-go" %}

#### **Ready status**

Label generation is asynchronous. If `documentStatus` is `Processing`, retry after a short back-off (e.g. 2–5 seconds). If a label enters `Failed` state, it must be regenerated.
{% endhint %}

### Retrieving a document

Use `GET /{id}/return-orders/{returnOrderNumber}/{documentType}` where `documentType` is either `ReturnLabel` or `LastMileLabel`. The response includes the document content, content type, and generation status.

### Preprinted labels

For retailers using preprinted labels, `POST /{id}/label-requests` creates a label request tied to a specific outbound order reference and shipping reference. This triggers asynchronous label generation.

{% hint style="info" icon="circle-2" %}

#### **Duplicates**

Label requests are deduplicated by order reference + shipping reference. A `409` response indicates a label for this combination has already been requested.
{% endhint %}


---

# 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/grp-returns-api/core-concepts/documents-and-labels.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.
