> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eazecustoms.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RTO Integration

> Turn on RTO for a Shipment and read movement progress.

## What you can do

RTO is the cargo-handling process linked to a Shipment. You choose an RTO configuration, create a Shipment with RTO enabled, and read the movements Eaze Customs creates.

This is not a direct connection to a cargo-system API. You cannot create, retry, or correct a movement through the Public API.

## Before you start

The credential needs the `rto` module. Shipment routes also need `X-Eaze-Client-Ref`.

Call [List RTO Configurations](https://docs.eazecustoms.com/api-reference/rto/list-rto-configurations.md). Each item has `id` and `providerName`. Use `id` as `rtoConfigurationId`. The list is limited to configurations your client is allowed to use.

## Steps

```mermaid theme={null}
flowchart LR
  configs["List RTO configurations"] --> create["Create an RTO Shipment"]
  create --> movements["List movements"]
  movements --> detail["Get one movement"]
  detail --> done["Wait for rto.completed"]
```

**1. Create the Shipment**

Follow [Shipments](https://docs.eazecustoms.com/implementation/shipments.md). Set `enabledServices` to `["rto"]`, or add `rto` next to `clearance`.

Required with RTO: `rtoConfigurationId`, `rtoProcessType`, `packageCount`, and `totalWeight`.

**2. Read movements**

Call [List Movements](https://docs.eazecustoms.com/api-reference/rto/list-movements.md) with the Shipment ID. Call [Get Movement](https://docs.eazecustoms.com/api-reference/rto/get-movement.md) for one movement.

A movement is one provider message, such as an outbound report. Its status describes that message. It does not by itself mean the whole RTO process is finished.

**3. Watch completion**

Read the Shipment. `businessStatus.rto` is the overall process. Get Shipment also returns `businessData.rto` with the process, public configuration id, and account totals. `rto.completed` is sent when that overall status first reaches `COMPLETED`.

One movement reported or confirmed is earlier than overall completion. Use Get Shipment after the webhook. The webhook is a notification, not the full movement record. See [Webhook Events](https://docs.eazecustoms.com/webhooks/events.md) and [Deliveries & Retries](https://docs.eazecustoms.com/webhooks/retries.md).

Clearance and RTO proceed independently. A completed Declaration does not complete RTO, and a completed RTO process does not complete clearance.

## Working example

```bash theme={null}
curl 'https://staging.api.eazecustoms.com/public/v1/rto-configurations' \
  --header 'Authorization: Bearer EZ_11111111-1111-4111-8111-111111111111_exampleSecretValueNotReal' \
  --header 'X-Eaze-Client-Ref: ACME-AMS'
```

```json theme={null}
{
  "data": [
    { "id": "99999999-9999-4999-8999-999999999999", "providerName": "Example Cargo Handler" }
  ],
  "pagination": { "limit": 20, "hasMore": false, "nextCursor": null }
}
```

```bash theme={null}
curl --request POST 'https://staging.api.eazecustoms.com/public/v1/shipments' \
  --header 'Authorization: Bearer EZ_11111111-1111-4111-8111-111111111111_exampleSecretValueNotReal' \
  --header 'X-Eaze-Client-Ref: ACME-AMS' \
  --header 'Idempotency-Key: 8b1c0b3e-8a21-4c5d-9e10-1a2b3c4d5e71' \
  --header 'Content-Type: application/json' \
  --data '{
    "shipmentNumber": "SHP-2026-0148",
    "shipmentType": "IMPORT",
    "enabledServices": ["rto"],
    "rtoConfigurationId": "99999999-9999-4999-8999-999999999999",
    "rtoProcessType": "IMPORT_HANDLING",
    "packageCount": 4,
    "totalWeight": 86.4
  }'
```

A movement:

```json theme={null}
{
  "id": "12121212-1212-4212-8212-121212121212",
  "shipmentId": "22222222-2222-4222-8222-222222222222",
  "action": {
    "code": "OPB",
    "name": "Outbound",
    "processType": "IMPORT_HANDLING",
    "trigger": "AUTOMATIC"
  },
  "status": {
    "code": "REPORTED",
    "displayCode": "SENT_TO_PROVIDER",
    "label": "Sent to provider",
    "description": "The movement was sent to the RTO provider."
  },
  "reference": { "type": "AWB", "number": "07412345678" },
  "quantities": { "packages": 4, "unit": "PK", "grossWeightKg": "86.400", "declarations": 1 },
  "messageCount": 1
}
```

`status.code` is the stored state. `displayCode` is the label to show. `REPORTED` is displayed as `SENT_TO_PROVIDER`. `CONFIRMED` is displayed as `ACCEPTED_BY_PROVIDER`.

Get Shipment includes the RTO balances for the same Shipment:

```json theme={null}
{
  "businessStatus": { "rto": "IN_PROGRESS" },
  "businessData": {
    "rto": {
      "processType": "IMPORT_HANDLING",
      "configuration": { "id": "99999999-9999-4999-8999-999999999999" },
      "statusUpdatedAt": "2026-11-17T12:00:00.000Z",
      "durationDays": null,
      "expiryAlertLevel": "WARNING",
      "accountTotals": {
        "inbound": { "packages": 4, "weightKg": "12.50" },
        "stock": { "packages": 2, "weightKg": "6.25" },
        "inTransit": { "packages": 1, "weightKg": "3.00" },
        "outbound": { "packages": 1, "weightKg": "3.25" }
      }
    }
  }
}
```

`configuration.id` is the public id from List RTO Configurations. `durationDays` stays null while the process is still active. Weights are decimal strings. The full Shipment object also includes cargo and schedule. See [Shipments](https://docs.eazecustoms.com/implementation/shipments.md).

## Statuses and errors

| Movement code | Display code | What it means | What happens next |
| - | - | - | - |
| `DRAFT` | `DRAFT` | Not queued yet. | Eaze Customs continues the process. |
| `QUEUED` | `WAITING_TO_SEND` | Waiting to be sent. | No action through this API. |
| `REPORTED` | `SENT_TO_PROVIDER` | Sent to the provider. | Wait for acceptance. This is not overall completion. |
| `CONFIRMED` | `ACCEPTED_BY_PROVIDER` | The provider accepted this movement. | Other movements may still be open. |
| `SEND_FAILED` | `SEND_FAILED` | Delivery failed. | The overall Shipment status shows whether action is required. |
| `REJECTED` | `REJECTED` | The provider rejected this movement. | Review it in the portal. |
| `CANCELLED` | `CANCELLED` | The movement is no longer active. | No further processing of this movement. |

Overall Shipment RTO status:

| Status | What it means | What happens next |
| - | - | - |
| `NOT_INITIATED` | RTO has not started. | Wait, or confirm the Shipment was created with `rto`. |
| `WAITING_PROVIDER` | Waiting for the provider. | Keep reading the Shipment. |
| `IN_PROGRESS` | Handling is underway. | Keep reading movements. |
| `ACTION_REQUIRED` | Someone needs to act in the portal. | Do not treat the process as finished. |
| `FAILED` or `REJECTED` | The process did not complete successfully. | Review the movements. This API has no retry command. |
| `COMPLETED` | The RTO process is finished. | `rto.completed` is sent once when this is first reached. |
| `CANCELLED` | The process was cancelled. | No further RTO processing is expected. |

| HTTP error | What to do |
| - | - |
| 403 | Add the `rto` module, or choose a client that can use the configuration. |
| 404 | The configuration, Shipment, or movement is not visible for this client. |
| 400 | A required RTO field was omitted on Create Shipment. |

Next: [Documents](https://docs.eazecustoms.com/implementation/documents.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.