GET/v1/rates
What one received amount costs in every currency, in one call. Open: no key needed. A rate is not a lock; create locks it.
Request
GET /v1/rates with the currency you receive and how much of it.
| Name | Required | Rule |
|---|---|---|
to | yes | Currency id to receive |
toAmount | yes | Desired net decimal amount in to units |
from | no | Comma-separated currency ids to price, at most the number that pay into to. Omit it to price every currency that pays into to |
curl "$API/v1/rates?to=tao&toAmount=0.1"Response
One entry per currency. Each entry has a quote or an error, never both. A quote is the GET /v1/rate response for from, to and toAmount. An error is the body GET /v1/rate returns for that pair.
| Field | Meaning |
|---|---|
from | The currency priced |
quote | What you send in from to receive toAmount, or null |
error | Why from cannot pay toAmount right now, or null |
[
{
"from": "sol",
"quote": {
"from": "sol",
"to": "tao",
"fromAmount": "0.0128",
"toAmount": "0.1",
"rate": "7.824",
"minFromAmount": "0.01",
"maxFromAmount": "40",
"levels": [{ "rate": "7.824", "maxFromAmount": "40" }]
},
"error": null
},
{
"from": "btc",
"quote": null,
"error": {
"code": "amount_too_low",
"message": "the minimum is 0.0001 BTC",
"minFromAmount": "0.0001",
"maxFromAmount": "0.5"
}
}
]Errors
These fail the whole call. A miss for one currency is an entry error instead.
| HTTP | Code | Extra fields | When |
|---|---|---|---|
| 400 | invalid_pair | — | to is missing, or nothing pays into it |
| 400 | invalid_amount | — | toAmount is not a positive decimal string |
| 400 | validation | field | from lists more currencies than pay into to |
| 429 | rate_limited | retryAfter | Over the limit; see Rate limits |
Notes
- Use it to show a price beside every currency a payer can pick, as the Checkout widget does. Call GET /v1/rate for one pair as the payer types.
- A currency in
fromthat does not pair withtogets aninvalid_pairentry error. - The receive currency itself is not listed: paying in it costs
toAmount.
