> For the complete documentation index, see [llms.txt](https://apidocs.gsped.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.gsped.com/gsped-api-english-version/spedizioni-e-dintorni/shipment/corrieri/dhl/resi-in-franchigia-rgr.md).

# Duty-free returns - RGR

Duty-free returns, or Returned Goods Relief (RGR), is a service offered by DHL to exempt the contract owner from customs duties for products returned from abroad (ONLY for outbound and return flows).

Gsped provides the **RGR** endpoint to generate the SPED file for the outbound shipment only, or to generate the RGR file for the return shipment.

## RGR endpoint

<mark style="color:green;">`POST`</mark> `https://api.gsped.it/[INSTANCE]/dhl/rgr`

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| x-api-key    | `YOUR API KEY`     |

**Body**

| Name                                                                              | Type   | Description                                                                                                                                 |
| --------------------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| flag\_reso<mark style="color:red;">\*</mark>                                      | number | <p>Whether or not this is a return shipment.<br><br><strong>Possible values:</strong><br>0 -> Outbound shipment<br>1 -> Return shipment</p> |
| client\_id<mark style="color:red;">\*</mark>                                      | number | Value provided by Gsped                                                                                                                     |
| num\_spedizione<mark style="color:red;">\*</mark>                                 | string | Shipment number (tracking number)                                                                                                           |
| colli<mark style="color:green;">\*</mark>                                         | number | Number of parcels                                                                                                                           |
| addebito\_dogana<mark style="color:green;">\*</mark>                              | number | <p>Numeric value indicating who bears the customs duties.<br><br><strong>Possible values:</strong><br>0 -> Recipient<br>1 -> Sender</p>     |
| valuta<mark style="color:green;">\*</mark>                                        | string | Three-character code indicating the reference currency (Example EUR)                                                                        |
| rcpt\_email<mark style="color:green;">\*</mark>                                   | string | Recipient's email address                                                                                                                   |
| rcpt\_name<mark style="color:green;">\*</mark>                                    | string | Recipient's name                                                                                                                            |
| rcpt\_addr<mark style="color:green;">\*</mark>                                    | string | Recipient's address                                                                                                                         |
| rcpt\_city<mark style="color:green;">\*</mark>                                    | string | Recipient's city                                                                                                                            |
| rcpt\_country\_code<mark style="color:green;">\*</mark>                           | string | Recipient's country as a 2-character ISO code                                                                                               |
| sender\_eori<mark style="color:green;">\*</mark>                                  | string | Sender's EORI code                                                                                                                          |
| ordersData<mark style="color:red;">\*</mark>                                      | object | Contains the details of the order and/or of the shipped goods                                                                               |
| ordersData.totale\_lordo<mark style="color:green;">\*</mark>                      | number | Total value of the shipped goods                                                                                                            |
| ordersData.invoice\_number<mark style="color:green;">\*</mark>                    | string | Invoice number and/or order reference                                                                                                       |
| ordersData.invoice\_date<mark style="color:green;">\*</mark>                      | string | Invoice date in YYYY-MM-DD format                                                                                                           |
| ordersData.detailsData<mark style="color:red;">\*</mark>                          | array  | Array containing the details of the shipped products                                                                                        |
| ordersData.detailsData.\*.sku<mark style="color:red;">\*</mark>                   | string | Product SKU                                                                                                                                 |
| ordersData.detailsData.\*.description<mark style="color:green;">\*</mark>         | string | Product description                                                                                                                         |
| ordersData.detailsData.\*.hs\_code<mark style="color:green;">\*</mark>            | string | Product HS Code                                                                                                                             |
| ordersData.detailsData.\*.country\_of\_origin<mark style="color:green;">\*</mark> | string | Product country of origin                                                                                                                   |
| ordersData.detailsData.\*.prezzo\_singolo<mark style="color:green;">\*</mark>     | number | Unit price of the product                                                                                                                   |
| ordersData.detailsData.\*.qty<mark style="color:green;">\*</mark>                 | number | Number of items shipped                                                                                                                     |
| ordersData.detailsData.\*.peso\_riga<mark style="color:green;">\*</mark>          | number | Product weight                                                                                                                              |
| originalAwbData                                                                   | object | <p>Contains the data of the outbound shipment.<br><br><strong>Please note:</strong> Only if this is a return (flag\_reso = 1)</p>           |
| originalAwbData.num\_spedizione                                                   | string | Tracking number of the outbound shipment                                                                                                    |
| originalAwbData.detailsData                                                       | array  | Array containing the details of the products shipped in the outbound shipment                                                               |
| originalAwbData.detailsData.\*.sku                                                | string | Product SKU                                                                                                                                 |

**Legend:**

<mark style="color:red;">\*</mark> -> Required data

<mark style="color:green;">\*</mark> -> Data required **ONLY** for an outbound shipment

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "ok"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "errors": [
        "The field colli must be numeric.",
        "The field colli must be greater than 0."
    ]
}
```

{% endtab %}
{% endtabs %}

## Examples

### Payload to generate the SPED file for outbound shipments:

```json
{
    "flag_reso": "0",
    "client_id": YOUR_CLIENT_ID,
    "num_spedizione": "123456789",
    "colli": "1",
    "addebito_dogana": "1",
    "valuta": "EUR",
    "rcpt_email": "test@gsped.com",
    "rcpt_name": "test destinatario",
    "rcpt_addr": "via palma 12",
    "rcpt_city": "Alessandria",
    "rcpt_country_code": "IT",
    "sender_eori": "codiceEori",
    "ordersData": {
        "totale_lordo": "55",
        "invoice_number": "fatt123",
        "invoice_date": "2024-07-08",
        "detailsData": [
            {
                "sku": "sku123",
                "description": "prodotto 123",
                "hs_code": "hsc123",
                "country_of_origin": "CO",
                "prezzo_singolo": "20",
                "qty": "1",
                "peso_riga": "2"
            },
            {
                "sku": "sku124",
                "description": "prodotto 124",
                "hs_code": "hsc124",
                "country_of_origin": "IT",
                "prezzo_singolo": "35",
                "qty": "1",
                "peso_riga": "1"
            }
        ]
    }
}
```

### Payload to generate the RGR file for return shipments:

```json
{
    "flag_reso": "1",
    "client_id": YOUR_CLIENT_ID,
    "num_spedizione": "123456789",
    "ordersData": {
        "detailsData": [
            {
                "sku": "sku123"
            },
            {
                "sku": "sku124"
            }
        ]
    },
    "originalAwbData": {
        "num_spedizione": "987654321"
    }
}
```

## Log

The files sent are saved in the gsped-etds bucket on S3.
