GET/v1/rate
A live quote for one amount. Open: no key needed. A rate is not a lock; create locks it.
Request
GET /v1/rate with a pair and exactly one amount.
| Name | Required | Rule |
|---|---|---|
from | yes | Currency id to send |
to | yes | Currency id to receive |
amount | one of | Positive decimal string in from units |
toAmount | one of | Desired net decimal amount in to units |
curl "$API/v1/rate?from=sol&to=tao&amount=0.5"Response
toAmount and rate price your whole amount, net of fee: toAmount is the number you get.
When the request uses toAmount, fromAmount is rounded up to the smallest send amount whose live quote delivers at least the target.
| Field | Meaning |
|---|---|
from, to | The ids you asked for |
fromAmount | Your amount (amount, or the amount calculated for toAmount) |
toAmount | What you receive, net of fee |
rate | toAmount per 1 fromAmount |
minFromAmount, maxFromAmount | Bounds you can send right now, both ends inclusive |
levels | Rungs available right now: each has a rate and the largest maxFromAmount it fills |
{
"from": "sol",
"to": "tao",
"fromAmount": "0.5",
"toAmount": "3.912",
"rate": "7.824",
"minFromAmount": "0.1",
"maxFromAmount": "40",
"levels": [
{ "rate": "7.824", "maxFromAmount": "12.4" },
{ "rate": "7.801", "maxFromAmount": "40" }
]
}Errors
| HTTP | Code | Extra fields | When |
|---|---|---|---|
| 400 | invalid_pair | — | from and to do not pair |
| 400 | invalid_amount | — | amount or toAmount is not a positive decimal string, or both/neither are set |
| 422 | amount_too_low | minFromAmount, maxFromAmount | amount is under the minimum |
| 422 | amount_too_high | minFromAmount, maxFromAmount | amount is over the maximum |
| 422 | no_liquidity | minFromAmount, maxFromAmount | No liquidity for this pair right now |
| 429 | rate_limited | retryAfter | Over the limit; see Rate limits |
Notes
levelsis informational. Each rung is a rate available right now and the largest single order it can fill. You always get the best rung that fits your amount. Never combine rungs.maxFromAmountand the rungs are live liquidity figures and change between calls; two rungs may share a cap.minFromAmountis omitted from anamount_too_lowbody when the minimum is unknown.
