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

# Advanced RFQ

> Lower-level request-for-quote and accept endpoints under the Trading API.

Under the hood every trade is a two-step **request-for-quote**: request a firm quote, then accept it: acceptance creates the order. Quick Trade and Sweep Trade wrap those two steps into one atomic call.

The RFQ endpoints are generic building blocks for integrations that need quote-then-commit control or capabilities the wrappers do not expose: exact-receive targeting (`BuyExact`) and multi-asset baskets.

<Warning>
  Most integrations should **not** call these directly. Prefer [Trading API Guide](/trading/api-guide) for Quick Trade and Sweep Trade. The RFQ API is lower-level by design: explicit token addresses, aligned per-leg lists, and a quote that must be accepted within its **10-second** validity window.
</Warning>

## `GET /trade/quote`

Returns a firm quote. Parameters are query string fields. Exactly one of `buy_amount` or `sell_amount` must be set: that choice selects the quoting mode:

| Mode        | You fix       | ZBX computes                               | Notes                        |
| ----------- | ------------- | ------------------------------------------ | ---------------------------- |
| `SellExact` | `sell_amount` | Amount you receive (net of all fees)       | Supports multi-asset baskets |
| `BuyExact`  | `buy_amount`  | Amount you must sell (grossed up for fees) | Single sell asset only       |

| Query param                                    | Required         | Description                                                                       |
| ---------------------------------------------- | ---------------- | --------------------------------------------------------------------------------- |
| `buy_currency`                                 | yes              | Symbol to buy                                                                     |
| `buy_chain_id`                                 | crypto           | Chain of the buy leg                                                              |
| `buy_token_address`                            | non-native token | Token contract of the buy leg (from `GET /trade/currencies`)                      |
| `buy_amount`                                   | one of           | Exact amount to receive (`BuyExact`)                                              |
| `sell_currency`                                | yes              | Symbol to sell. Comma-separated list for baskets                                  |
| `sell_chain_id`                                | crypto           | Chain per sell asset: comma-separated, aligned with `sell_currency`               |
| `sell_token_address`                           | non-native token | Token contract per sell asset: aligned comma list (empty entry for native assets) |
| `sell_amount`                                  | one of           | Exact amount(s) to sell (`SellExact`): aligned comma list                         |
| `deposit_account_id`                           | yes\*            | Account already holding the sell assets. Required for automated quoting           |
| `settlement_address` / `settlement_account_id` | no               | Settlement target resolved into the quote (same semantics as Quick Trade)         |
| `is_estimate_only`                             | no               | `true` = indicative estimate (used underneath dry-run style estimates)            |

**Example:** `BuyExact`: receive exactly 10,000 USDC on Ethereum by selling USDT on BNB Chain (fill token addresses from `GET /trade/currencies`):

```bash theme={null}
curl -G "https://mapi.zbx.boomfi.xyz/v1/trade/quote" \
  -H "X-API-KEY: sk_test_xxx" \
  -H "Accept: application/json" \
  --data-urlencode "buy_currency=USDC" \
  --data-urlencode "buy_chain_id=1" \
  --data-urlencode "buy_token_address=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" \
  --data-urlencode "buy_amount=10000" \
  --data-urlencode "sell_currency=USDT" \
  --data-urlencode "sell_chain_id=56" \
  --data-urlencode "sell_token_address=0x55d398326f99059fF775485246999027B3197955" \
  --data-urlencode "deposit_account_id=42"
```

Use live contract addresses from discovery: the sample addresses above are illustrative.

## `POST /trade/quote/{quote_id}/accept`

Accepts a live quote and creates the order: this is the **commit** point. The call must land within the quote's 10-second validity (`400 Quote expired` otherwise: request a fresh quote). Optional query parameters `settlement_address` or `settlement_account_id` can override the settlement target resolved at quote time.

A pre-trade feasibility check runs at accept: `409 Trade not feasible: …` means re-quote and retry shortly.

The response is the created order plus the accepted quote and resolved instructions; track it via `GET /trade/order` like any other order.

```bash theme={null}
curl -X POST "https://mapi.zbx.boomfi.xyz/v1/trade/quote/{quote_id}/accept" \
  -H "X-API-KEY: sk_test_xxx" \
  -H "Accept: application/json"
```

Also available: reject a quote via `POST /trade/quote/{quote_id}/reject` when you abandon a quote deliberately (see OpenAPI).

## Next

* [Integration Playbook](/trading/integration-playbook)
* [Trading API Guide](/trading/api-guide)
