Conversions
Convert your balance from one currency to another. Conversions are opened per tenant: until they are opened for you, every call answers 501 not_available_yet, including the quote. That is not your key.
Pairs
GET /v1/pairs
{"pairs": [{"from_currency": "USDT_TRC20", "to_currency": "BTC",
"rate": "0.0000127", "rate_age_seconds": 12,
"minimum": "...", "minimum_usd": "...", "usd_unavailable": []}]}
A pair is listed when we deal in both currencies, the custodian lists both, and we hold a fresh price. A pair whose price went stale is absent rather than listed. rate is the market, with no fee applied.
| Field | |
|---|---|
minimum | The least you can convert, in from_currency: the larger of the custodian's floor for the pair and minimum_usd valued in that currency now, rounded up to its decimals. The custodian's floor applies to the amount after the fee: amount − customer_fee must reach it, so an amount equal to minimum is refused when that floor is the larger and a fee is charged. null when neither is known; null is not zero |
minimum_usd | The smallest conversion your SWAP fee row states, in US dollars (GET /v1/fees minimum_amount_usd); null when it states none |
usd_unavailable | Empty, unless minimum_usd is set and we cannot value from_currency in dollars right now: then minimum is null and this says why. A quote from that currency is refused until we can |
GET /v1/currencies answers per currency its decimals (places after the point on its chain: USDT_TRC20 6, BTC 8), whether we deal in it, whether the custodian lists it right now, whether we can price it, and whether you have a verified address to take it out to. When the custodian could not be reached, custodian_read is false and every custodian_lists is null rather than false.
Quote
POST /v1/quotes
{"product": "SWAP", "amount": {"amount": "10", "currency": "USDT_TRC20"}, "to_currency": "BTC",
"partner_reference": "order-17", "customer_external_id": "user-42"}
partner_reference and customer_external_id are optional labels of yours, up to 120 characters each, answered on the quote.
Answers id, expires_at, valid_for_seconds, amount, customer_fee, binding_floor, amount_received, exchange_rate, rate_locked and rate_observed_at. Nothing is reserved and no money moves. Pass the id as quote_id on the swap and that is the fee you are charged.
| Field | |
|---|---|
valid_for_seconds | Whole seconds left, by our clock. Count this down rather than reading expires_at against your own clock |
rate_locked | false: the quote fixes customer_fee; exchange_rate and amount_received are an estimate, and the swap credits what the conversion produced (to_amount). true on a quote filled from our own stock (Fiat and USDT): a swap at it delivers exactly amount_received |
customer_fee | In the currency of amount: your percentage, or your fee floor when that is higher. A floor in US dollars (minimum_fee_usd) is valued in that currency when the quote is made |
binding_floor | BASE_FEE: the percentage. MINIMUM_FEE: your fee floor. PROVIDER_RETAIL_FLOOR: the pair costs more than the percentage |
amount_received | The estimate of what arrives: (amount − customer_fee) × exchange_rate, less our estimate of the custodian's own conversion fee, rounded to the decimals of to_currency |
A quote is refused 422 validation_failed, with nothing written:
detail | |
|---|---|
amount, minimum, minimum_usd, reason | Your SWAP fee row states minimum_amount_usd and the amount is under the pair's minimum. reason says whose floor it is: the custodian's, or your own smallest conversion. While your row states none, a quote under the custodian's floor is priced and the swap is refused |
amount, customer_fee, amount_to_convert, minimum, reason | Your SWAP fee row states minimum_amount_usd and amount − customer_fee (amount_to_convert) is under the custodian's floor for the pair (minimum). While your row states none, such a quote is priced and the swap is refused |
amount, customer_fee, binding_floor, reason | The fee is not below the amount: nothing would be converted |
pricing | Your fee row states a floor in US dollars and the currency cannot be valued in dollars right now |
A swap quote lives requests.quote_lifetime_seconds on GET /v1/limits, 120 today; a bank payout quote in another currency about 30 seconds (Bank accounts).
Swap
POST /v1/swaps
Idempotency-Key: <your record id>
{"amount": {"amount": "10", "currency": "USDT_TRC20"},
"to_currency": "BTC",
"quote_id": "...",
"partner_reference": "order-17",
"customer_external_id": "user-42"}
- The source amount, fee included, leaves your balance when the swap is created.
- The refusals of the quote apply: under the pair's
minimum, or under the custodian's floor after the fee (both whether or not your fee row statesminimum_amount_usd), a fee not below the amount, a floor in dollars that cannot be valued. Each is422 validation_failedwith the samedetail; nothing is held and theIdempotency-Keyis not spent. A swap sent with aquote_idis charged the quote's fee and is not held tominimum_usdagain; the custodian's floor still applies, to the amount and to the amount after the fee. partner_referenceandcustomer_external_idare your own labels, up to 120 characters each. They come back on the swap, onGET /v1/swaps, on the register and inswap.*event data;nullwhen not sent. A swap carries its own labels, not its quote's.- A field we do not know is refused:
422 validation_failed, withdetail.fieldsnaming it. A swap takes noaddress: what it produces is credited to your balance. customer_external_idis a label for the customer behind the conversion. It is never resolved to a customer and the conversion still spends your own balance;customer_idis the field that converts a named customer's balance.to_amountisnulluntil the custodian reports what the conversion produced. We never credit the estimate.- Converting into a currency needs a verified withdrawal address on that chain; otherwise
422 no_verified_destination, withdetail.payable_intolisting what you can convert into.
status | |
|---|---|
PENDING | Created, not yet with the custodian |
SUBMITTED | With the custodian |
SETTLED | Done. to_amount is what arrived |
FAILED | Did not happen. The source is back on your balance |
UNKNOWN | Not yet accounted for, with unresolved: true. Do not retry |
Read with GET /v1/swaps/{swap_id} or GET /v1/swaps?status=, or follow swap.* events.
Fiat and USDT
Where we open it for you, a conversion between a fiat currency your bank accounts hold and USDT_TRC20 is filled from our own stock, at once:
POST /v1/swaps
Idempotency-Key: <your record id>
{"customer_id": "...", "amount": {"amount": "100.00", "currency": "USD"},
"to_currency": "USDT_TRC20", "deliver_to": "float"}
take_from/deliver_to:customer(the default) orfloat, your own balance with us. At most one isfloat, and either needscustomer_id: the person converting.- Answered
SETTLED, withto_amount, in the same response. - A quote for it answers
rate_lockedtrue: a swap sent with itsquote_iddelivers the quote'samount_received. 409 float_shortwhen our stock cannot fill it now; nothing was held. Try less, or later.
Paid from the customer's own wallet
Not open yet: every call answers 501 not_available_yet.
The customer sends a coin from their own wallet and USDT_TRC20 arrives at one of the deposit addresses we issued you. Nothing is held on your balance.
GET /v1/swaps/incoming/pairs lists what the customer can pay with now: from_currency, from_network, rate_types, minimum, maximum (in the currency sent) and refund_memo.
POST /v1/swaps/incoming/quote
{"amount": {"amount": "0.01", "currency": "BTC"},
"to_currency": "USDT_TRC20",
"customer_country": "DE"}
Answers to_amount_estimated, customer_fee, amount_received, minimum, maximum, minimum_usd. It keeps nothing and locks no rate.
POST /v1/swaps/incoming
Idempotency-Key: <your record id>
{"amount": {"amount": "0.01", "currency": "BTC"},
"to_currency": "USDT_TRC20",
"customer_country": "DE",
"deposit_address_id": "...",
"refund_address": {"address": "bc1q..."},
"min_amount_received": {"amount": "580", "currency": "USDT_TRC20"},
"partner_reference": "order-17",
"customer_external_id": "user-42"}
- Answers
pay_in:address,memo,amount,network,pay_by. Show the customer exactly these. rate_typefixed(the default) holds the rate untilpay_by;estimatedhas no deadline and takes the market's rate when the payment is exchanged.customer_feeis into_currency: yourSWAPfee row's percentage of what arrives, or its floor in dollars, whichever is higher. A tenant with noSWAPfee row is refused.deposit_address_idis an address fromPOST /v1/deposit-addresses/issueon the network ofto_currency.refund_addressis the customer's own address in the currency sent.customer_countryis the customer's country of residence.422 country_not_servedwhere a swap is not offered.min_amount_received: with the price now leaving less, nothing is created (422 validation_failed,detail.amount_received).- Under the pair's
minimumor over itsmaximum:422 validation_failedwith the figure.503 rate_staleor503 provider_unavailable: nothing was created, retry.
progress | |
|---|---|
waiting_for_payment | Created; the customer has not paid |
confirming, exchanging, sending | Paid, on its way |
on_hold | The payment is being checked; hold_reason says which check |
finished | Sent to the deposit address |
refunded | Returned to refund_address; refund_tx_hash, refund_amount |
failed | Did not happen |
declined | We declined it after a check |
On hold:
hold_reason | Tell your user | |
|---|---|---|
under_review | We are checking the payment | The swap is under review |
verification_required | The customer is asked to verify themselves | The swap waits for verification |
swap.on_holdis sent when a swap goes on hold, withreason.swap.resumedis sent when it goes on.- A swap on hold ends as any other, or
FAILEDwithreasondeclined. - While a swap is on hold or declined, a deposit at its address is the swap's: credit nothing for it until
swap.settled.
Read with GET /v1/swaps/incoming/{swap_id}.
How it ends:
status | |
|---|---|
SUBMITTED | Created; not finished |
SETTLED | The coins were read at the deposit address and confirmed. to_amount is what arrived, customer_fee our fee on it, amount_received what is left, deposit_id the deposit |
FAILED | No coins came, or we declined it. reason: refunded (sent back to refund_address), failed, expired (never paid), or declined |
- The arrival is a deposit like any other:
deposit.detectedanddeposit.confirmedare sent for the whole amount, and it is inGET /v1/deposits. - While a swap is open into an address, the deposit events of that address in
to_currencycarryswap_ids(the open swaps, oldest first). Do not credit such a deposit by itself. swap.settledfollows once that deposit is confirmed and names it (deposit_id). Credit your customeramount_net: the deposit lesscustomer_fee.- A deposit with
swap_idsthat no swap named is an ordinary deposit once every swap listed has ended (swap.failedwith areasonother thandeclined): credit it whole then. - Our fee leaves your balance with us, not the customer's address: your float is debited
customer_feewhen the swap settles, or when the swept coins are credited if it does not cover the fee before. swap.failedcarriesreason, andrefund_tx_hash/refund_amountwhen the payment was sent back.
Your balance
| Call | |
|---|---|
GET /v1/float | Per currency: available (act on this), held (taken by an operation in flight), total |
GET /v1/float/statement?currency= | Every movement on one currency, oldest first, with a running balance. No cursor: when truncated is true, narrow since / until |
GET /v1/register | Every operation, newest first, with its fee and transaction hash. Pages on an opaque cursor |
GET /v1/register/summary | Totals by kind, currency and status |
Every balance is summed from ledger entries; there is no balance column to disagree with them.
Halts
503 temporarily_halted means we have stopped conversions, withdrawals and transfers for everyone. Our hourly solvency check or one of our operators opens the halt; only a person clears it. detail.reason says why (for a halt an operator opened, the fixed text stopped by an operator) and detail.halted_since when. Back off and retry. GET /v1/halt (any key) says whether it is open, since when, and a reason with no amounts.