POST /v1/price
Quote a swap. Server-computed pricing with optional partner markup.
/api/v1/priceAuth optionalServer-computed quote for a pair and amount. The same pricing path powers /v1/create, so a quote followed by a create will not surprise you with a different rate (modulo natural market movement during the round-trip).
Signed callers receive a partner-specific rate; markupBps in the response echoes the applied basis points. Unsigned callers see the base rate (markupBps = 0). Resolution order, highest wins: request body afftax> per-code default > partner default.
Request
type"float"required"float" only. The rate is recomputed server-side at order creation against the live feed.fromCcystringrequiredtoCcystringrequireddirection"from" | "to"requiredamount refers to. "from" quotes the receive amount for a given deposit; "to" quotes the deposit required for a given receive amount.amountstring | numberrequiredafftaxintegerX-API-KEY: prefix.code segment is present and matches an enabled, partner-owned code; otherwise the partner’s default. Values outside the range return code 1 INVALID_REQUEST. Never silently clamped.Response
{
"code": 0,
"msg": "",
"data": {
"from": {
"code": "btc",
"coin": "BTC",
"network": "Bitcoin",
"amount": "0.01000000",
"rate": "62450.12345678",
"precision": 8,
"min": "0.00002000",
"max": "0.08000000",
"usd": "624.50",
"btc": "0"
},
"to": {
"code": "usdt_trc20",
"coin": "USDT",
"network": "Tron",
"amount": "619.987654",
"rate": "62450.12345678",
"precision": 6,
"min": "1.000000",
"max": "5000.000000",
"usd": "619.99"
},
"errors": [],
"markupBps": 50
}
}data.from.code / coin / networkstringdata.from.amountstring (decimal)data.from.ratestring (decimal)data.from.precisionnumberdata.from.min / maxstring (decimal)data.from.usdstring (decimal, 2 dp)data.from.btcstringdata.to.code / coin / networkstringdata.to.amountstring (decimal)data.to.rate / precision / min / max / usdstring / numberdata.errorsarray<string>data.markupBpsnumberErrors
| code | msg | HTTP | Description |
|---|---|---|---|
| 1 | INVALID_REQUEST | 400 | Body fails validation: unsupported asset, disabled pair, unparseable amount, invalid address, FLOAT without refundAddress, malformed Idempotency-Key. The same code + HTTP 409 fires on Idempotency-Key reuse with a different payload. |
| 3 | AUTH_INVALID | 401 | Unknown key, malformed signature, signature mismatch, expired or replayed nonce, decrypt failure. Generic body — never an oracle for "which" of those it was. |
| 5 | RATE_LIMIT | 429 | Per-partner weight budget exhausted within the 60-second sliding window. Response includes Retry-After: <seconds>. |
| 11 | UPSTREAM_ERROR | 503 | A required upstream is temporarily unavailable. Retry with exponential backoff. |
| 99 | INTERNAL | 500 | Unexpected server-side condition. Already logged on our side; safe to retry. |
Code examples
# Request a quote for 0.01 BTC -> USDT (Tron) with a 0.5% partner markup.
APIKEY="rWqZ...your-api-key...Rg"
APISECRET="G1JV...your-api-secret...n4"
NONCE=$(openssl rand -hex 16)
BODY='{"type":"float","fromCcy":"btc","toCcy":"usdt_trc20","direction":"from","amount":"0.01","afftax":50}'
SIGN=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$APISECRET" | sed 's/^.* //')
curl -sS -X POST "https://0trace.io/api/v1/price" \
-H "Content-Type: application/json" \
-H "X-API-KEY: $APIKEY" \
-H "X-API-SIGN: $SIGN" \
-H "X-API-NONCE: $NONCE" \
--data "$BODY"Rate limit
Weight 1 per call. Unsigned calls bypass the per-partner bucket; signed calls are charged 1 weight unit each.
Notes
Quote freshness. No response cache on this endpoint. Every call recomputes the quote against the latest rate-feed snapshot. Anonymous callers (no X-API-KEY) share an IP rate-limit bucket of 60 calls per minute per /24 (IPv6: /48); signed callers run on the per-partner weight budget instead.
Quote vs create amounts. amounton a subsequent create call is a hint. The create path re-quotes server-side, so the order’s final amount is authoritative.