Quote a buy

View as MarkdownOpen in Claude
Prices a purchase of `assetId` and opens the order as a quote. **Nothing is bought here** — the order stays `open` until you accept it with `/trade/approve`. Give **exactly one** leg and the other is priced for you: - `fiatAmount` — "spend this much", and the crypto you receive is derived. - `cryptoAmount` — "buy this much", and the fiat you pay is derived. Sending both, or neither, is a `400`. The quote is indicative and short-lived. It lapses at `result.quote.expiresAt` — roughly a minute — and approving it after that is a `409`. **The price that binds is the one confirmed at approval**, not the one returned here, so show the user the approval price before treating the order as done. Rounding always runs in the user's disfavour on the fiat leg and downwards on the crypto leg, so a rounded quote can never be filled short. Every amount and price in the response is shown to **at most 6 decimal places**, cut rather than rounded, so a figure you display is never larger than the one that settles.

Authentication

AuthorizationBearer

A 15-minute token from /auth. Required on every endpoint except /auth.

Headers

X-Request-IdstringOptional

Correlation id. Generated if omitted, echoed on every response, and written to the audit log. /send is the exception — there it is required, and it doubles as the idempotency key.

X-USER-IDstringOptionalformat: "^[0-9a-fA-F]{24}$"

Optional. When present it overrides any userId in the body.

Request

This endpoint expects an object.
userIdstringRequiredformat: "^[0-9a-fA-F]{24}$"

24-character hex id, returned by /create.

assetIdenumRequired
Primary asset selector. An all-digit string (`"21"`) is accepted and normalised to an integer. - `1` — BITCOIN BTC (native, 8 decimals) - `2` — ETHEREUM ETH (native, 18 decimals) - `21` — ETHEREUM USDT (ERC20, 6 decimals) - `22` — ETHEREUM USDC (ERC20, 6 decimals) - `3` — BSC BNB (native, 18 decimals) - `31` — BSC USDT (BEP20, 18 decimals) - `32` — BSC USDC (BEP20, 18 decimals) - `4` — TRON TRX (native, 6 decimals) - `41` — TRON USDT (TRC20, 6 decimals) - `42` — TRON USDC (TRC20, 6 decimals) — not on every endpoint - `5` — POLYGON POL (native, 18 decimals) - `51` — POLYGON USDT (ERC20, 6 decimals) — not on every endpoint - `52` — POLYGON USDC (ERC20, 6 decimals) - `6` — SOLANA SOL (native, 9 decimals) - `61` — SOLANA USDT (SPL, 6 decimals) — not on every endpoint - `62` — SOLANA USDC (SPL, 6 decimals)
fiatenumOptional

Fiat currency the trade is priced in. Defaults to USD when omitted.

fiatAmountstringOptionalformat: "^\d+(\.\d+)?$"

How much fiat to spend. Mutually exclusive with cryptoAmount.

cryptoAmountstringOptionalformat: "^\d+(\.\d+)?$"

How much of the asset to buy. Mutually exclusive with fiatAmount.

Response

OK — the quote is open.

resultobject

One trade, whichever side it is.

cryptoAmount, fiatAmount and price are the best known figures: what executed if it has, else what you approved, else what was quoted. quote always holds the original quoted leg, so you can show both. Every amount and price is cut — not rounded — to at most 6 decimal places, with trailing zeros trimmed, so 100.00 is returned as 100.

requestIdstring

Echo of the inbound X-Request-Id, or a generated one.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
502
Bad Gateway Error
503
Service Unavailable Error
504
Gateway Timeout Error