Kestrel

Această pagină nu este încă tradusă; este afișată în engleză.

API reference

One base URL, an API-Key header, and seven methods. Get your key from your account page.

Basics

Base URL: /api/v1/ on this site. Send your key in the API-Key header. Parameters go in the query string; POST also accepts a form or JSON body. Every answer is JSON, and errors come back as {"error": "..."} with a matching HTTP status.

The usual sequence: fetch coins once, call new_rate, let your user pick a quote, call new_trade, show the deposit address, then follow the swap with trade or a webhook.

coins GET

Every coin and network. Fetch it once and store it: you need both the ticker and the network in every other call, because the same ticker lives on several networks.

/api/v1/coins

Returns: name, ticker, network, memo (true when the coin needs a memo or tag), image.

coin GET

The coins matching one ticker or one name. A ticker on several networks returns several entries.

ticker
e.g. btc (ticker or name is required)
name
e.g. Bitcoin
/api/v1/coin?ticker=usdt

Returns: Same fields as coins.

new_rate GET or POST

Asks every exchange for a quote and returns them best first, each with its privacy grade. The returned trade_id is what you pass to new_trade.

ticker_from, network_from
the coin to sell (required)
ticker_to, network_to
the coin to buy (required)
amount_from
amount to sell (required for a standard swap)
amount_to
amount to receive (required when payment=True)
payment
True for a fixed-rate payment, where the received amount is exact
min_kycrating
A, B, C or D: only exchanges graded at least this well
markup
your own commission in percent: 0, 0.5, 1, 1.65 or 3
best_only
True to get only the best quote
/api/v1/new_rate?ticker_from=btc&network_from=Mainnet&ticker_to=xmr&network_to=Mainnet&amount_from=0.01

Returns: trade_id, date, the pair, amount_from, amount_to, provider and fixed for the best quote, status new, and quotes.quotes: provider, kycrating, logpolicy, fixed, amount_from, amount_to, waste (spread in percent), eta (minutes).

new_trade GET or POST

Creates the swap at the chosen exchange and returns the address the user must fund. Without an id, the best quote for the given parameters is used.

id
trade_id from new_rate
provider
the exchange name from the quote
fixed
True or False, matching the quote
address
where the user receives the coins (required)
address_memo
memo or tag of that address; 0 for none
refund, refund_memo
where the exchange returns the deposit if it cannot complete
webhook
a URL that receives a POST with the trade each time its status changes
webhook_key
any string; sent back in the Webhook-Key header so you can authenticate the call
/api/v1/new_trade?id=ID&provider=StealthEX&fixed=False&address=ADDRESS

Returns: trade_id, status, address_provider (+ address_provider_memo), amount_from, amount_to, address_user, refund_address, id_provider, password, payment.

trade GET

The current state of a swap. Records are erased 14 days after creation, or as soon as the user deletes them.

id
the trade_id
/api/v1/trade?id=ID

Returns: Same fields as new_trade, plus details.hashout once the payout is sent.

validateaddress GET or POST

Checks that an address fits a coin and network. Optional: new_trade always runs the same check.

ticker, network, address
all required
/api/v1/validateaddress?ticker=btc&network=Mainnet&address=ADDRESS

Returns: result: true or false.

exchanges GET

The wired exchanges and their characteristics.

/api/v1/exchanges

Returns: name, rating, eta, fixed, payment, refund_required, log_policy, url.

giftcards GET

The gift cards on sale. Without a country, a short list of every card (ID, name, country). With a country, the cards usable there with their amounts. Only on deployments where gift cards are switched on.

country
two-letter country code, for example FR (optional)
/api/v1/giftcards?country=FR

Returns: product_id, name, category, country, currency, card_image_url, min_amount, max_amount, denominations (the fixed amounts, as text), step (when any amount between min and max is allowed).

giftcard GET

One card as the supplier has it right now: stock, description and terms (in the issuer's own language).

product_id
the card's ID from giftcards (required)
/api/v1/giftcard?product_id=amazon_fr-france

Returns: The fields of giftcards, plus in_stock, description, terms_and_conditions.

order_giftcard GET or POST

Orders a card. The supplier issues an invoice in crypto, valid for 60 minutes; when the coin is one the supplier does not take, a fixed-rate swap is created that delivers the exact amount to the invoice. Read the order back with trade and the returned trade_id: the card's code is in cards once status is finished. Only the key that placed the order can read it.

product_id
the card's ID (required)
amount
the card's value in its own currency, one of its denominations or within its range (required)
ticker_from, network_from
the coin the customer pays with (required)
refund
the customer's address in that coin, used if the swap or the delivery fails (required)
email
where the supplier sends the receipt (optional)
/api/v1/order_giftcard?product_id=amazon_fr-france&amount=10&ticker_from=xmr&network_from=Mainnet&refund=<address>

Returns: trade_id, date, product_id, name, value, currency, ticker_from, network_from, ticker_to, network_to, amount_from (what the customer sends), amount_to, provider, fixed, status, address_provider (where the customer sends it), address_provider_memo, expires, order_url, cards (code, pin, link, instructions). webhook and card_markup are not supported.

Statuses

new
rates exist, the swap is not created yet
waiting
created, no deposit seen
confirming
deposit seen, waiting for confirmations
sending
deposit confirmed, the exchange is paying out
finished
the payout transaction exists
paid partially
the deposit was smaller than required (payments only)
failed
the exchange reports a failure
expired
no deposit arrived in time
halted
the exchange put the swap on hold
refunded
the exchange reports that it returned the deposit

Commission

With markup 0 (or no markup) the user gets exactly the rates shown on this site and the referral commission paid by the exchange is shared with you. A markup above 0 is yours in full and makes the user's rate worse by that percentage.