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

# Quotes and orders

> Pass an asset into a quote, then submit the quote as an order.

[Stablecoin Account API Publisher Disclaimer](/stablecoin-account/v1.6/guide/stablecoin-account-api-publisher-disclaimer)

Prepare `asset_id` and a supported funding currency using [Select an asset](/stocks/guide/integration). Before selling, query [List positions](/stocks/api-reference/list-positions) with `asset_id` and check `available_quantity`.

## 1. Create a quote

Call [Create quote](/stocks/api-reference/create-quote) (`POST /quote`) with these JSON fields:

| Field              | Buy                                                                              | Sell                                                                                                       |
| ------------------ | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `asset_id`         | Selected asset identifier                                                        | Selected asset identifier                                                                                  |
| `side`             | `BUY`                                                                            | `SELL`                                                                                                     |
| `funding_currency` | Supported funding currency                                                       | Supported funding currency                                                                                 |
| `cash_amount`      | Positive funding amount before fees, as a decimal string; up to 6 decimal places | Omit                                                                                                       |
| `quantity`         | Omit                                                                             | Positive asset quantity, as a decimal string; up to 8 decimal places and no more than `available_quantity` |

Send a new lowercase UUID in `x-idempotency-key`. Save the returned `quote_id`; review `quantity`, `price`, `cash_amount`, `fees`, `total_amount`, and `expires_at`. Values that are null are not confirmed execution results.

## 2. Submit the quote

Before the quote expires, call [Create order](/stocks/api-reference/create-order) (`POST /order`). Set `quote_id` to the value returned above. Set `client_reference` if you want to find the order using your own reference later.

Use a new `x-idempotency-key` for the order, different from the quote key. Save the returned `order_id`. One quote can be submitted for one order.

If a request times out, retry that same operation with its original key and unchanged body. If the quote expires, obtain a new quote instead of submitting the expired identifier. The API Reference contains real request and response examples; use your newly returned identifiers when making your own calls.

## 3. Follow the order

Call [Retrieve order](/stocks/api-reference/retrieve-order) (`GET /order/{order_id}`) or receive an [order notification](/stocks/guide/receive-webhooks).

| Status    | Next action                                                                                                                                                    |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PENDING` | Continue tracking this order.                                                                                                                                  |
| `SUCCESS` | Read `executed_quantity`, available execution price, `cash_amount`, `fees`, and `total_amount`, then [reconcile holdings](/stocks/guide/orders-and-positions). |
| `FAILED`  | Read `failure_code` and `failure_message` before deciding whether to start a new quote.                                                                        |

For a buy, `total_amount` is the outlay including fees. For a sell, it is the proceeds after fees. Both use `funding_currency`.
