---
title: "Orders"
description: "An order represents a single exchange operation — converting funds from one asset to another. This page covers creating, retrieving, listing, and cancelling orders, as well as the order lifecycle."
canonical_url: "https://docs.stablegate.com/docs/guide/orders"
---
# Orders

> An order represents a single exchange operation — converting funds from one asset to another. This page covers creating, retrieving, listing, and cancelling orders, as well as the order lifecycle.

An order represents a single exchange operation — converting funds from one asset to another. This page covers creating, retrieving, listing, and cancelling orders, as well as the order lifecycle.

## Order Lifecycle

Every order progresses through a series of statuses:

:diagram{alt="Order lifecycle: new, processing, hold and failed on the left; cancelled, done, stopped, rejected and rollbacked are terminal states" name="order-lifecycle"}Double circles are terminal states. The full set of transitions:

<table>
<thead>
  <tr>
    <th>
      From
    </th>
    
    <th>
      To
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        new
      </code>
    </td>
    
    <td>
      <code>
        processing
      </code>
      
      , <code>
        hold
      </code>
      
      , <code>
        cancelled
      </code>
      
      , <code>
        rejected
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        processing
      </code>
    </td>
    
    <td>
      <code>
        done
      </code>
      
      , <code>
        hold
      </code>
      
      , <code>
        failed
      </code>
      
      , <code>
        rejected
      </code>
      
      , <code>
        stopped
      </code>
      
      , <code>
        rollbacked
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        hold
      </code>
    </td>
    
    <td>
      <code>
        processing
      </code>
      
      , <code>
        new
      </code>
      
      , <code>
        rejected
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        failed
      </code>
    </td>
    
    <td>
      <code>
        processing
      </code>
      
       (retried by Stablegate), <code>
        stopped
      </code>
      
      , <code>
        rollbacked
      </code>
    </td>
  </tr>
</tbody>
</table>

**Terminal states** — the order does not move on its own: `done`, `rejected`, `cancelled`, `stopped`, `rollbacked`. The only exception: Stablegate operations can complete a `stopped` order manually, which moves it to `done`.

`failed` is **not** terminal: an order can be retried back into `processing`.
`cancelled` is reachable **only from new**. An order that receives no deposit by `valid_until` is cancelled automatically; the check runs hourly, so the cancellation can land up to an hour after `valid_until`.

### Order Statuses

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        new
      </code>
    </td>
    
    <td>
      Order has been created and is awaiting a deposit from the customer
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        processing
      </code>
    </td>
    
    <td>
      Deposit received; the exchange is being processed
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        done
      </code>
    </td>
    
    <td>
      Exchange completed successfully; funds have been delivered to the destination
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        hold
      </code>
    </td>
    
    <td>
      Order has been paused for manual review
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        failed
      </code>
    </td>
    
    <td>
      Order failed during processing (check <code>
        error_message
      </code>
      
       for details). <strong>
        Not a final state
      </strong>
      
       — Stablegate can retry it back into <code>
        processing
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        rejected
      </code>
    </td>
    
    <td>
      Order was rejected by Stablegate, or its payout was rejected by the payment provider
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cancelled
      </code>
    </td>
    
    <td>
      Order was cancelled
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        stopped
      </code>
    </td>
    
    <td>
      Order was manually stopped by Stablegate operations while it was processing or after it failed; any in-flight operations were halted and the order does not advance on its own. Operations can later complete it manually (<code>
        done
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        rollbacked
      </code>
    </td>
    
    <td>
      Order was rolled back by Stablegate operations after processing failed. Rare; final
    </td>
  </tr>
</tbody>
</table>

---

## Create an Order

Submit a new exchange order for a customer.

**Endpoint:**

```text
POST /v1/customers/{customer_uuid}/orders/
```

### Request Body

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        source.rail
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      Source payment rail (e.g., <code>
        sepa
      </code>
      
      , <code>
        ethereum
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.asset
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      Source asset code (e.g., <code>
        EUR
      </code>
      
      , <code>
        USDT
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.amount
      </code>
    </td>
    
    <td>
      number | string
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      Amount the customer will send
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.rail
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      Destination payment rail
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.asset
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      Destination asset code
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.client_account
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      No
    </td>
    
    <td>
      Destination account identifier: IBAN for fiat, wallet address for crypto
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.client_account_uuid
      </code>
    </td>
    
    <td>
      string (UUID)
    </td>
    
    <td>
      No
    </td>
    
    <td>
      UUID of a registered external account (bank account or wallet)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        account_uuid
      </code>
    </td>
    
    <td>
      string (UUID)
    </td>
    
    <td>
      No
    </td>
    
    <td>
      Internal account UUID (if applicable)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        third_party_document_uuid
      </code>
    </td>
    
    <td>
      string (UUID)
    </td>
    
    <td>
      No
    </td>
    
    <td>
      UUID of an invoice the customer already has (a document of type <code>
        proof_of_third_party_deal
      </code>
      
      , such as the one of a cancelled order) to attach to this order. See <a href="#third-party-payouts-and-the-invoice">
        Third-Party Payouts and the Invoice
      </a>
    </td>
  </tr>
</tbody>
</table>

::note
For `destination`, provide either `client_account` (raw IBAN or wallet address) or `client_account_uuid` (UUID of a previously registered external account). Using `client_account_uuid` is recommended as it references a verified account. In both cases the destination must be an account registered for this customer; an unregistered IBAN or address is refused.
::

::note
Only `source.amount` exists. An order cannot be created from the amount the customer should receive; use [`check-fees`](https://docs.stablegate.com/docs/guide/fees-and-limits/fees#check-fees-api) with `destination.amount` to find the source amount first.
::

### []{id="example-on-ramp-order-eur--usdc"}Example: On-Ramp Order (EUR → USDC)

**Request:**

::code-switcher{body="{"source":{"rail":"sepa","asset":"EUR","amount":1000},"destination":{"rail":"ethereum","asset":"USDC","client_account_uuid":"wa1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"}}" idempotency-key="order_c1d2e3f4_onramp_001" method="POST" path="/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/"}
```bash
curl https://api.stablegate.com/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/ \
  --request POST \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: order_c1d2e3f4_onramp_001' \
  --data '{
  "source": {
    "rail": "sepa",
    "asset": "EUR",
    "amount": 1000
  },
  "destination": {
    "rail": "ethereum",
    "asset": "USDC",
    "client_account_uuid": "wa1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"
  }
}'
```
::

**Response:**

```json
{
  "uuid": "od1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a",
  "reference": "SG-20250115-ABCDEF",
  "state": "new",
  "deposit_address": "",
  "source": {
    "rail": "sepa",
    "asset": "EUR",
    "amount": "1000.00",
    "deposit_bank_info": {
      "iban": "LT603250000000000001",
      "bank_name": "Stablegate UAB",
      "bank_code": "REVOLT21",
      "bank_country": "LT",
      "holder_name": "STGG AG",
      "bank_address": "Konstitucijos pr. 21B, 08130 Vilnius, Lithuania"
    },
    "transaction_hash": null,
    "deposit_status": null
  },
  "destination": {
    "rail": "ethereum",
    "asset": "USDC",
    "amount": "978.50",
    "client_account": "0xDC1dCb46fC96C46c4F294866AFCA81874041bB2",
    "transaction_hash": "0x9b1e4c7f2a5d8b3c6f0e9d2a4b7c1e5f8a3d6b9c2e5f1a4b7c0d3e6f9a2b5c8d",
    "payment_reference": null
  },
  "commission": {
    "asset": "EUR",
    "amount": "15.00"
  },
  "account": {
    "uuid": "ac1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
    "code": "TRD-001",
    "name": "Trading Account",
    "type": "trading"
  },
  "error_message": null,
  "created_at": "2025-01-15T10:45:00.000Z",
  "valid_until": "2025-01-15T11:45:00.000Z"
}
```

**Key response fields for on-ramp:**

- `source.deposit_bank_info` — Stablegate's bank details where the customer must send the EUR transfer; the customer **must** enter `holder_name` as the recipient
- `reference` — The payment reference the customer **must include** in their SEPA transfer
- `valid_until` — The order will expire if no deposit is received by this time

### []{id="example-off-ramp-order-usdt--eur"}Example: Off-Ramp Order (USDT → EUR)

**Request:**

::code-switcher{body="{"source":{"rail":"ethereum","asset":"USDT","amount":500},"destination":{"rail":"sepa","asset":"EUR","client_account_uuid":"ba1c2d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e"}}" idempotency-key="order_c1d2e3f4_offramp_001" method="POST" path="/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/"}
```bash
curl https://api.stablegate.com/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/ \
  --request POST \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: order_c1d2e3f4_offramp_001' \
  --data '{
  "source": {
    "rail": "ethereum",
    "asset": "USDT",
    "amount": 500
  },
  "destination": {
    "rail": "sepa",
    "asset": "EUR",
    "client_account_uuid": "ba1c2d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e"
  }
}'
```
::

**Response:**

```json
{
  "uuid": "od2f3a4b-5c6d-7e8f-9a0b-1c2d3e4f5a6b",
  "reference": "SG-20250115-GHIJKL",
  "state": "new",
  "deposit_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
  "source": {
    "rail": "ethereum",
    "asset": "USDT",
    "amount": "500.000000",
    "deposit_bank_info": null,
    "transaction_hash": null,
    "deposit_status": null
  },
  "destination": {
    "rail": "sepa",
    "asset": "EUR",
    "amount": "473.25",
    "client_account": "DE89370400440532013000",
    "transaction_hash": null,
    "payment_reference": "SGPAY-20250115-000123"
  },
  "commission": {
    "asset": "USDT",
    "amount": "10.00"
  },
  "account": {
    "uuid": "ac1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
    "code": "TRD-001",
    "name": "Trading Account",
    "type": "trading"
  },
  "error_message": null,
  "created_at": "2025-01-15T10:50:00.000Z",
  "valid_until": "2025-01-15T11:50:00.000Z"
}
```

**Key response fields for off-ramp:**

- `deposit_address` — The Ethereum address where the customer must send USDT
- `destination.client_account` — The customer's IBAN where EUR will be delivered

### Response Fields

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        uuid
      </code>
    </td>
    
    <td>
      string (UUID)
    </td>
    
    <td>
      Unique identifier for the order
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        reference
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Payment reference (must be included in fiat transfers)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        state
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Current order status
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        deposit_address
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Crypto address for deposits (off-ramp and crypto-to-crypto)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.rail
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Source payment rail
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.asset
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Source asset code
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.amount
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Amount to be sent by the customer
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.deposit_bank_info
      </code>
    </td>
    
    <td>
      object | null
    </td>
    
    <td>
      Stablegate bank details for fiat deposits (on-ramp only)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.deposit_bank_info.iban
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Stablegate IBAN the customer sends the transfer to
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.deposit_bank_info.bank_name
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Name of the Stablegate bank
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.deposit_bank_info.bank_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      BIC of the Stablegate bank
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.deposit_bank_info.bank_country
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Country of the Stablegate bank
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.deposit_bank_info.holder_name
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Payee name to put on the transfer (the Stablegate legal entity)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.deposit_bank_info.bank_address
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Address of the Stablegate bank
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.transaction_hash
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Blockchain transaction hash of the customer's crypto deposit. Set once the deposit is detected; <code>
        null
      </code>
      
       before that and for bank deposits
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.deposit_status
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Status of the customer's deposit: <code>
        received
      </code>
      
      , <code>
        confirmed
      </code>
      
      , <code>
        credited
      </code>
      
      , <code>
        on_hold
      </code>
      
       or <code>
        rejected
      </code>
      
       (see <a href="#deposit-status">
        Deposit Status
      </a>
      
      ). <code>
        null
      </code>
      
       until a deposit is detected
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.rail
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Destination payment rail
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.asset
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Destination asset code
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.amount
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Amount to be received
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.client_account
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Customer's destination account (IBAN or wallet address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.transaction_hash
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Blockchain transaction hash of the crypto payout. Set once Stablegate sends the payout; <code>
        null
      </code>
      
       before that and for bank payouts
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        destination.payment_reference
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Reference of the bank payout as the payment provider reports it. Set once the payout is sent; <code>
        null
      </code>
      
       for crypto payouts
    </td>
  </tr>
</tbody>
</table>

Both payout fields are filled once the payout leaves Stablegate, so show them to the customer as proof of delivery: `destination.transaction_hash` for crypto, `destination.payment_reference` for a bank transfer. They stay `null` while the order is waiting for the deposit or still processing.
| `commission.asset` | string | Asset the commission is charged in |
| `commission.amount` | string | Fee amount |
| `account.uuid` | string (UUID) | Internal account UUID |
| `account.type` | string | Account type (`trading` or `internal_iban`) |
| `error_message` | string | null | Error details if the order failed |
| `created_at` | string (ISO 8601) | Order creation timestamp |
| `valid_until` | string (ISO 8601) | null | Deadline for the deposit. The window is set by your account configuration, so the values in the examples are illustrative. An order with no deposit by this time is cancelled; `null` once a deposit is attached |
| `exchange_rate` | string | null | Exchange rate currently applied to the order: destination asset units per one source asset unit. `null` when the order has no exchange step |
| `rate_valid_until` | string (ISO 8601) | null | Time until which `exchange_rate` and `destination.amount` are held. `null` once the deposit is received |
| `third_party_document_required` | boolean | `true` when the order pays out to a third-party bank account and its source amount is above the invoice threshold. Until the invoice is attached, the order is not executed automatically. See [Third-Party Payouts and the Invoice](#third-party-payouts-and-the-invoice) |
| `third_party_document_uuid` | string (UUID) | null | The invoice attached to the order (a customer document of type `proof_of_third_party_deal`); `null` while none is attached |

::note
**Rate and amounts before the deposit.** While an order is `new` and has no deposit, Stablegate re-prices it periodically: `exchange_rate` and `destination.amount` are recalculated, and `rate_valid_until` shows until when the current values hold. Read the order again after that time to show the customer up-to-date numbers. When the deposit arrives, the amounts are calculated from the amount actually received, and the order is no longer re-priced.

**Note:** the single-order endpoints return the status in a field named `state`; the list endpoint returns the same value as `status`. Read `state` when polling one order, `status` when scanning a list. The list endpoint's `status` query parameter filters on these same values.
::

### Deposit Status

The order `state` stays `new` from the moment the customer's deposit is seen until it is credited, so `state` alone cannot tell you that the money has arrived. `source.deposit_status` fills that gap:

<table>
<thead>
  <tr>
    <th>
      Value
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        null
      </code>
    </td>
    
    <td>
      No deposit detected yet
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        received
      </code>
    </td>
    
    <td>
      Deposit seen (on-chain or on the bank account); the compliance check is in progress
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        confirmed
      </code>
    </td>
    
    <td>
      Compliance check passed; the funds are being credited to the order
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        credited
      </code>
    </td>
    
    <td>
      Funds credited; the order moves to <code>
        processing
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        on_hold
      </code>
    </td>
    
    <td>
      Deposit is under manual compliance review
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        rejected
      </code>
    </td>
    
    <td>
      Deposit was refused and will not fund the order; contact support for the refund
    </td>
  </tr>
</tbody>
</table>

Webhooks fire only on order `state` changes, so poll [Get Order Details](#get-order-details) while the order is `new` if you want to show the customer that the deposit has been seen.

### How Deposits Are Matched

**Crypto.** `deposit_address` belongs to the customer and the destination account, and is the same for every order with that destination. A transfer that lands on it is attached to the customer's newest open order on that address; the amount is not used for matching. The order is then recalculated from the amount actually received, so an over- or underpayment changes the payout rather than failing the order. Keep one open order per customer and destination at a time. A transfer smaller than 1 USDT or 1 USDC is not processed. A transfer sent over another network or in another token is not detected at all; recovery is a manual request to support.

**Bank.** A SEPA transfer is matched by the `reference` from `deposit_bank_info`, with `holder_name` as the payee. A transfer without the reference stays unmatched until Stablegate support resolves it.

**A deposit with no open order.** If the customer pays after the order was cancelled — including the automatic cancellation at `valid_until` — and no other order on the same address, or on the same reference for a bank transfer, is open, the transfer stays unmatched. Stablegate records it, but it does not fund an order: `source.deposit_status` stays empty for it and no webhook fires. The money is not lost: contact your account manager with the customer UUID, the order UUID, the amount, the asset and the transaction hash or the bank reference, and Stablegate operations resolve the deposit. Create a new order for a new transfer — a deposit that has already landed is not picked up by it.

---

## Activate an Account with a Verification Order

An account with [Standard Verification](https://docs.stablegate.com/docs/verification/compliance/individual) trades only after activation, so `permissions.can_trade` stays `false` until the customer makes a test deposit from their own bank account. A verification order collects that deposit: it carries the bank details of the verification ledger, and Stablegate fixes the amount at one unit of the deposit asset, kept as the order commission.

A regular order does not activate the account. Create the verification order instead:

**Endpoint:**

```text
POST /v1/customers/{customer_uuid}/orders/verification/
```

**Request body:**

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        source.rail
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      Bank rail the customer pays from: <code>
        sepa
      </code>
      
      , <code>
        sepa_instant
      </code>
      
      , <code>
        swift
      </code>
      
      , <code>
        ach
      </code>
      
       or <code>
        wire
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        source.asset
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      Fiat asset of the deposit, for example <code>
        EUR
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        account_uuid
      </code>
    </td>
    
    <td>
      string (UUID)
    </td>
    
    <td>
      No
    </td>
    
    <td>
      Customer account to credit; the customer's default account when omitted
    </td>
  </tr>
</tbody>
</table>

**Request:**

::code-switcher{body="{"source":{"rail":"sepa","asset":"EUR"}}" method="POST" path="/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/verification/"}
```bash
curl https://api.stablegate.com/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/verification/ \
  --request POST \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "source": {
    "rail": "sepa",
    "asset": "EUR"
  }
}'
```
::

**Response:** `200 OK` with the [order details](#get-order-details). `source.deposit_bank_info` holds the account to pay into, `reference` holds the payment reference to give to the customer, and `destination` is `null`.

Show the customer the payee, the IBAN and the reference. Once the deposit arrives, the order completes on its own and `permissions.can_trade` turns `true` — poll [Get Order Details](#get-order-details) for the order and [Get Customer Details](https://docs.stablegate.com/docs/guide/customers#get-customer-details) for the permission.

::warning
Only bank rails and fiat assets are accepted: a crypto rail or a crypto asset is refused with `422`. When verification is not configured for the requested rail, the call answers `400` and passes the message from Stablegate — contact your account manager to have the rail set up.
::

---

## Get Order Details

Retrieve the current state of an order. Use this endpoint to monitor the order status.

**Endpoint:**

```text
GET /v1/customers/{customer_uuid}/orders/{order_uuid}/
```

**Request:**

::code-switcher{method="GET" path="/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/od1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a/"}
```bash
curl https://api.stablegate.com/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/od1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a/ \
  --header 'X-Api-Key: YOUR_API_KEY'
```
::

**Response (order in processing):**

```json
{
  "uuid": "od1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a",
  "reference": "SG-20250115-ABCDEF",
  "state": "processing",
  "deposit_address": "",
  "source": {
    "rail": "sepa",
    "asset": "EUR",
    "amount": "1000.00",
    "deposit_bank_info": {
      "iban": "LT603250000000000001",
      "bank_name": "Stablegate UAB",
      "bank_code": "REVOLT21",
      "bank_country": "LT",
      "holder_name": "STGG AG",
      "bank_address": "Konstitucijos pr. 21B, 08130 Vilnius, Lithuania"
    },
    "transaction_hash": null,
    "deposit_status": "credited"
  },
  "destination": {
    "rail": "ethereum",
    "asset": "USDC",
    "amount": "978.50",
    "client_account": "0xDC1dCb46fC96C46c4F294866AFCA81874041bB2"
  },
  "commission": {
    "asset": "EUR",
    "amount": "15.00"
  },
  "account": {
    "uuid": "ac1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
    "code": "TRD-001",
    "name": "Trading Account",
    "type": "trading"
  },
  "error_message": null,
  "created_at": "2025-01-15T10:45:00.000Z",
  "valid_until": null
}
```

### Tracking Status Updates

There are two ways to track order status changes:

**Webhooks (recommended):** Configure a [webhook](https://docs.stablegate.com/docs/guide/webhooks) to receive real-time `POST` notifications whenever an order status changes. This is more efficient and eliminates the need for polling.

**Polling:** If you cannot receive webhooks, poll the order endpoint periodically:

```javascript
async function waitForCompletion(customerUuid, orderUuid, intervalMs = 5000) {
  const terminalStatuses = ["done", "rejected", "cancelled", "stopped"];

  while (true) {
    const order = await request("GET", `/v1/customers/${customerUuid}/orders/${orderUuid}/`);

    console.log(`Order ${orderUuid}: ${order.state}`);

    if (terminalStatuses.includes(order.state)) {
      return order;
    }

    await new Promise((resolve) => setTimeout(resolve, intervalMs));
  }
}
```

---

## List Orders

Retrieve a list of orders for a customer with optional filtering.

**Endpoint:**

```text
GET /v1/customers/{customer_uuid}/orders/
```

### Query Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        limit
      </code>
    </td>
    
    <td>
      integer
    </td>
    
    <td>
      100
    </td>
    
    <td>
      Maximum number of orders to return
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        offset
      </code>
    </td>
    
    <td>
      integer
    </td>
    
    <td>
      0
    </td>
    
    <td>
      Number of orders to skip (for pagination)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        status
      </code>
    </td>
    
    <td>
      array
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by status: <code>
        new
      </code>
      
      , <code>
        processing
      </code>
      
      , <code>
        done
      </code>
      
      , <code>
        hold
      </code>
      
      , <code>
        failed
      </code>
      
      , <code>
        rejected
      </code>
      
      , <code>
        cancelled
      </code>
      
      , <code>
        stopped
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        incoming_rails_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by source rail (e.g., <code>
        sepa
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_rails_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by destination rail (e.g., <code>
        ethereum
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        incoming_asset_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by source asset (e.g., <code>
        EUR
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_asset_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by destination asset (e.g., <code>
        USDC
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created_at__gte
      </code>
    </td>
    
    <td>
      date
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Orders created on or after this date (YYYY-MM-DD)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created_at__lte
      </code>
    </td>
    
    <td>
      date
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Orders created on or before this date
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        sort
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        desc
      </code>
    </td>
    
    <td>
      Sort direction: <code>
        asc
      </code>
      
       or <code>
        desc
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        order_by
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      Field to sort by: <code>
        id
      </code>
      
      , <code>
        external_id
      </code>
      
      , <code>
        created_at
      </code>
      
      , <code>
        updated_at
      </code>
      
      , <code>
        status
      </code>
      
      , <code>
        incoming_amount
      </code>
      
      , <code>
        outgoing_amount
      </code>
    </td>
  </tr>
</tbody>
</table>

The response carries the number of orders that match the same filters, ignoring pagination, in the `X-Total-Count` header.

**Request:**

::code-switcher{method="GET" path="/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/" query="status=done&status=processing&limit=10&sort=desc&order_by=created_at"}
```bash
curl 'https://api.stablegate.com/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/?status=done&status=processing&limit=10&sort=desc&order_by=created_at' \
  --header 'X-Api-Key: YOUR_API_KEY'
```
::

**Response:**

```json
[
  {
    "uuid": "od1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a",
    "reference": "SG-20250115-ABCDEF",
    "legal_entity_uuid": "le1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
    "account": {
      "uuid": "ac1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
      "code": "TRD-001",
      "name": "Trading Account",
      "type": "trading"
    },
    "status": "done",
    "deposit_address": "",
    "incoming_rails": {
      "code": "sepa",
      "name": "SEPA",
      "type": "bank"
    },
    "incoming_provider": null,
    "incoming_asset_code": "EUR",
    "incoming_amount": "1000.00",
    "outgoing_rails": {
      "code": "ethereum",
      "name": "Ethereum",
      "type": "crypto"
    },
    "outgoing_provider": null,
    "outgoing_asset_code": "USDC",
    "outgoing_amount": "978.50",
    "outgoing_client_account": "0xDC1dCb46fC96C46c4F294866AFCA81874041bB2",
    "commission_amount": "15.00",
    "commission_asset_code": "EUR",
    "error_message": null,
    "created_at": "2025-01-15T10:45:00.000Z"
  }
]
```

::note
The list response uses different field names than the single-order response. Notably, the list uses `status` (not `state`), `incoming_rails`/`outgoing_rails` objects, and separate `incoming_amount`/`outgoing_amount` fields.
::

### List Response Fields

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        uuid
      </code>
    </td>
    
    <td>
      string (UUID)
    </td>
    
    <td>
      Order UUID
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        reference
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Payment reference
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        legal_entity_uuid
      </code>
    </td>
    
    <td>
      string (UUID)
    </td>
    
    <td>
      Legal entity UUID
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        account
      </code>
    </td>
    
    <td>
      object
    </td>
    
    <td>
      Internal account details
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        status
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Current order status (<code>
        new
      </code>
      
      , <code>
        processing
      </code>
      
      , <code>
        done
      </code>
      
      , <code>
        hold
      </code>
      
      , <code>
        failed
      </code>
      
      , <code>
        rejected
      </code>
      
      , <code>
        cancelled
      </code>
      
      , <code>
        stopped
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        deposit_address
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Crypto deposit address (empty for on-ramp)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        incoming_rails
      </code>
    </td>
    
    <td>
      object
    </td>
    
    <td>
      Source rail details (<code>
        code
      </code>
      
      , <code>
        name
      </code>
      
      , <code>
        type
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        incoming_provider
      </code>
    </td>
    
    <td>
      object | null
    </td>
    
    <td>
      Source provider details
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        incoming_asset_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Source asset code
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        incoming_amount
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Source amount, a decimal string
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_rails
      </code>
    </td>
    
    <td>
      object
    </td>
    
    <td>
      Destination rail details (<code>
        code
      </code>
      
      , <code>
        name
      </code>
      
      , <code>
        type
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_provider
      </code>
    </td>
    
    <td>
      object | null
    </td>
    
    <td>
      Destination provider details
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_asset_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Destination asset code
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_amount
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Destination amount, a decimal string
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_client_account
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      Customer's destination account (IBAN or wallet address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        commission_amount
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Fee amount, a decimal string
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        commission_asset_code
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Asset the commission is charged in; the same value as <code>
        commission.asset
      </code>
      
       in the order details
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        error_message
      </code>
    </td>
    
    <td>
      string | null
    </td>
    
    <td>
      Error details if the order failed
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created_at
      </code>
    </td>
    
    <td>
      string (ISO 8601)
    </td>
    
    <td>
      Order creation timestamp
    </td>
  </tr>
</tbody>
</table>

---

## List All Orders

Retrieve the orders of every customer of your partner account, newest first. Use it for operations dashboards and reconciliation without walking customers one by one.

**Endpoint:**

```text
GET /v1/orders/
```

### Query Parameters

The filters are the same as on the per-customer list, plus `client_uuid` to narrow the list to one customer.

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        limit
      </code>
    </td>
    
    <td>
      integer
    </td>
    
    <td>
      100
    </td>
    
    <td>
      Maximum number of orders to return
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        offset
      </code>
    </td>
    
    <td>
      integer
    </td>
    
    <td>
      0
    </td>
    
    <td>
      Number of orders to skip (for pagination)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        client_uuid
      </code>
    </td>
    
    <td>
      string (UUID)
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Only orders of this customer
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        status
      </code>
    </td>
    
    <td>
      array
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by status: <code>
        new
      </code>
      
      , <code>
        processing
      </code>
      
      , <code>
        done
      </code>
      
      , <code>
        hold
      </code>
      
      , <code>
        failed
      </code>
      
      , <code>
        rejected
      </code>
      
      , <code>
        cancelled
      </code>
      
      , <code>
        stopped
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        incoming_rails_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by source rail (e.g., <code>
        sepa
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_rails_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by destination rail (e.g., <code>
        ethereum
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        incoming_asset_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by source asset (e.g., <code>
        EUR
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outgoing_asset_code
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Filter by destination asset (e.g., <code>
        USDC
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created_at__gte
      </code>
    </td>
    
    <td>
      date
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Orders created on or after this date (YYYY-MM-DD)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created_at__lte
      </code>
    </td>
    
    <td>
      date
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Orders created on or before this date
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        sort
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        desc
      </code>
    </td>
    
    <td>
      Sort direction: <code>
        asc
      </code>
      
       or <code>
        desc
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        order_by
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      Field to sort by: <code>
        id
      </code>
      
      , <code>
        external_id
      </code>
      
      , <code>
        created_at
      </code>
      
      , <code>
        updated_at
      </code>
      
      , <code>
        status
      </code>
      
      , <code>
        incoming_amount
      </code>
      
      , <code>
        outgoing_amount
      </code>
    </td>
  </tr>
</tbody>
</table>

The response carries the number of orders that match the same filters, ignoring pagination, in the `X-Total-Count` header.

**Request:**

::code-switcher{method="GET" path="/v1/orders/" query="status=done&client_uuid=c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f&limit=10"}
```bash
curl 'https://api.stablegate.com/v1/orders/?status=done&client_uuid=c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f&limit=10' \
  --header 'X-Api-Key: YOUR_API_KEY'
```
::

The response holds the same order list as the per-customer endpoint; the fields are described in [List Response Fields](#list-response-fields).

---

## Cancel an Order

Cancel an order that has not yet been fully processed.

**Endpoint:**

```text
POST /v1/customers/{customer_uuid}/orders/{order_uuid}/cancel/
```

**Request:**

::code-switcher{method="POST" path="/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/od1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a/cancel/"}
```bash
curl https://api.stablegate.com/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/od1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a/cancel/ \
  --request POST \
  --header 'X-Api-Key: YOUR_API_KEY'
```
::

**Response:** `204 No Content`

::warning
Only orders in `new` can be cancelled. Once an order has moved to `processing`, `hold`, or any terminal state, cancelling it fails.
::

---

## Third-Party Payouts and the Invoice

A payout to a third party's bank account, not the customer's own, needs an invoice or a contract behind it when the order is large. Stablegate decides this once, when the order is created, and returns the result in `third_party_document_required`:

- Only bank payouts to a third-party account are checked. Payouts to the customer's own bank account and to crypto addresses never need an invoice.
- You decide whether an account belongs to the customer or to a third party: the flag is set when the account is registered, see [External Accounts](https://docs.stablegate.com/docs/guide/external-accounts#create-a-bank-account). The order tells the result as `third_party_document_required`.
- The source amount of the order, converted to EUR, is compared with the threshold: 15 000 EUR unless your account configuration sets another value. The threshold itself does not need an invoice: an order of exactly 15 000 EUR has `third_party_document_required: false`.
- When the source amount cannot be converted to EUR, the invoice is required.
- The flag does not change after creation, even when the deposit differs from the order amount and the order is recalculated.

An order that needs an invoice is created as usual, without an error. Until the invoice is attached it is not executed automatically: after the deposit is confirmed, the order stays `new` with `source.deposit_status: confirmed` and waits for Stablegate operations, who can approve and execute it manually. Once the invoice is attached, the order is processed under the usual auto-processing rules; if the deposit has already arrived, processing resumes.

There are two ways to give the invoice:

- **After creation (recommended):** upload the file with [Attach an Invoice](#attach-an-invoice). The order must still be `new`.
- **At creation:** pass `third_party_document_uuid` with the UUID of an invoice the customer already has, for example the `third_party_document_uuid` of a cancelled order that you create again. A document can back one active order only; the document of a cancelled or rejected order is free to use again.

Stablegate operations review the content of the document; the API does not check it.

### Attach an Invoice

Uploads the invoice or contract file and attaches it to the order in one call.

**Endpoint:**

```text
POST /v1/customers/{customer_uuid}/orders/{order_uuid}/third-party-document/
```

The request body is `multipart/form-data`:

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        file
      </code>
    </td>
    
    <td>
      file
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      Invoice or contract file
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      No
    </td>
    
    <td>
      Document name; the file name by default
    </td>
  </tr>
</tbody>
</table>

**Request:**

```bash
curl 'https://api.stablegate.com/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/od3a4b5c-6d7e-8f9a-0b1c-2d3e4f5a6b7c/third-party-document/' \
  --request POST \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --form 'file=@invoice-2025-0142.pdf' \
  --form 'name=Invoice 2025-0142'
```

**Response:** `200 OK` with the [order details](#get-order-details); `third_party_document_uuid` now holds the attached document:

```json
{
  "uuid": "od3a4b5c-6d7e-8f9a-0b1c-2d3e4f5a6b7c",
  "reference": "SG-20250115-MNOPQR",
  "state": "new",
  "deposit_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
  "source": {
    "rail": "ethereum",
    "asset": "USDT",
    "amount": "20000.000000",
    "deposit_bank_info": null,
    "transaction_hash": null,
    "deposit_status": null
  },
  "destination": {
    "rail": "sepa",
    "asset": "EUR",
    "amount": "19320.00",
    "client_account": "FR7630006000011234567890189"
  },
  "commission": {
    "asset": "EUR",
    "amount": "10.00"
  },
  "account": {
    "uuid": "ac1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
    "code": "TRD-001",
    "name": "Trading Account",
    "type": "trading"
  },
  "error_message": null,
  "third_party_document_required": true,
  "third_party_document_uuid": "dc4b5c6d-7e8f-9a0b-1c2d-3e4f5a6b7c8d",
  "created_at": "2025-01-15T11:00:00.000Z",
  "valid_until": "2025-01-15T12:00:00.000Z"
}
```

The call is refused with `400` when the order does not need an invoice, already has one, or is no longer `new`; the file is not stored in these cases. An order that is not found answers `404`.

::warning
**Retries.** A re-sent multipart body differs from the first one, so a retry with the same `Idempotency-Key` is answered with `422` instead of the cached response. After a timeout or a `5xx`, read the order first: when `third_party_document_uuid` is set, the invoice is attached and the call must not be repeated.
::

## Best Practices

- **Always check fees and limits** before creating an order to avoid failures.
- **Use client_account_uuid** instead of raw account identifiers when possible — it references a registered and verified account.
- **Store the order uuid** on your side immediately after creation for tracking and reconciliation.
- **Use webhooks** to receive real-time order status updates instead of polling.
- **If polling**, use a reasonable interval (e.g., every 5–10 seconds) and stop when a terminal status is reached.
- **Handle all terminal states**: `done` (success), `rejected`, `cancelled`, `stopped` — each may require different handling in your application. `failed` is **not** terminal: an order can move from `failed` back to `processing`, so don't treat it as the end of the line.
- **Instruct your customers** to include the `reference` in SEPA transfers, otherwise the deposit may not be matched to the order.
- **Check third_party_document_required** in the create response and [attach the invoice](#attach-an-invoice) right away when it is `true`; without it the order waits for Stablegate operations.


## Sitemap

See the full [sitemap](https://docs.stablegate.com/sitemap.md) for all pages.
