Public · keyless · rate-limited
Exchange API
Quote and execute instant crypto-to-crypto swaps programmatically. No account, no API key: call the endpoints below. Every swap is tracked by its tracking_id.
https://cryptopayr.com
How a swap works
- Estimate the receive amount for a pair and amount (float or fixed rate).
- Create the order with a payout address (and an optional refund address). You get a deposit address and a
tracking_id. - Send the
fromcoin to the deposit address. - On confirmation we pay the
tocoin to your payout address. Poll the status to follow along.
Embeddable widget
Put the whole swap flow on your own site with a few lines: no backend, no API key. The widget is an isolated iframe that auto-resizes, matches your theme and accent colour, and can pay your referral wallet 50% of our fee on every swap. Loaded from https://cryptopayr.com/js/exchange-widget.js.
<div id="swap"></div>
<script src="https://cryptopayr.com/js/exchange-widget.js"></script>
<script>
new Exchange({
container: "#swap", // selector or element (required)
theme: "auto", // "light" | "dark" | "auto"
accent: "#08a05a", // your brand colour
referralWallet: "0xYourWallet", // earns 50% of our fee
referralTo: "USDT", // referral payout coin
referralNetwork: "TRON", // referral payout network
from: "BTC", to: "ETH", amount: 0.01, // optional defaults
rateType: "float", // "float" | "fixed"
lockCoins: false, // lock the coin selection
onComplete: function (e) { console.log("done", e.tracking); },
onStatus: function (e) { console.log("status", e.status); }
});
</script>
Options
| Option | Description |
|---|---|
container | Required Selector or element to mount into. |
theme | light, dark or auto. |
accent | Brand colour, e.g. #08a05a. |
referralWallet / referralTo / referralNetwork | Your referral wallet plus its payout coin and network. Earns 50% of our fee. |
from / to / fromNetwork / toNetwork | Default coins and networks. |
amount | Default send amount. |
rateType | float or fixed. |
lockCoins | Lock the coin selection to your defaults. |
width / height / radius | Widget size and corner radius. |
Callbacks
onCreated, onStatus, onComplete and onEvent. Each is also dispatched as a cryptopayr-exchange:<event> DOM event on the container. Declarative mounting works too, via data-cryptopayr-exchange and matching data-* attributes.
[cryptopayr_exchange] shortcode or Gutenberg block, themed from a settings screen.List currencies
/api/v1/swap/currenciesNo keySupported coins and networks, with the fee and limit metadata.
curl https://cryptopayr.com/api/v1/swap/currencies
Get a quote
/api/v1/swap/estimateNo keyQuote a receive amount. Params: from, from_network, to, to_network, amount, type (float or fixed). The minimum depends on the pair: min_usd (and min_from, the same amount in the coin you send) is the smallest deposit the destination coin can be paid out on; BTC payouts, for example, need about $9. amount_ok tells you whether amount is in range.
curl "https://cryptopayr.com/api/v1/swap/estimate?from=BTC&from_network=BTC&to=ETH&to_network=ETH&amount=0.01&type=fixed"
Create a swap
/api/v1/swap/createNo keyJSON body: from, from_network, to, to_network, amount, type, payout_address and an optional refund_address. Optional referral: referral_wallet_address, referral_wallet_to, referral_wallet_network; that wallet earns 50% of our service fee. Returns the deposit address and the tracking id.
curl -X POST https://cryptopayr.com/api/v1/swap/create \
-H 'Content-Type: application/json' \
-d '{
"from":"BTC","from_network":"BTC",
"to":"ETH","to_network":"ETH",
"amount":0.01,"type":"float",
"payout_address":"0xYourEthAddress",
"refund_address":"bc1YourBtcRefund",
"referral_wallet_address":"0xYourReferralWallet",
"referral_wallet_to":"USDT",
"referral_wallet_network":"TRON"
}'
Swap status
/api/v1/swap/statusNo keyFollow a swap. Param: id, the tracking id.
curl "https://cryptopayr.com/api/v1/swap/status?id=SWP-XXXX-YYYY"
Email a receipt
/api/v1/swap/receiptNo keyJSON body: id, email. Available 30 minutes after the swap ends.
curl -X POST https://cryptopayr.com/api/v1/swap/receipt \
-H 'Content-Type: application/json' \
-d '{"id":"SWP-XXXX-YYYY","email":"[email protected]"}'
Status values
AWAITING_DEPOSIT → CONFIRMING → EXCHANGING → SENDING → COMPLETED
Error paths: REFUND_PENDING → REFUNDED, or EXPIRED / FAILED.
Referrals
Pass a referral_wallet_address (with a referral_wallet_to coin and referral_wallet_network) on create and that wallet earns 50% of our service fee on the swap, based on the amount actually received. Earnings accrue per wallet and are paid out automatically once the balance clears the minimum; small amounts roll over to the next swap.
Notes
- No authentication. Endpoints are rate-limited per IP; back off on HTTP
429. - If you send a different amount than quoted, the receive amount adjusts to what actually arrives.
- On any error we refund the deposit to your
refund_address(or the sending address if none was given).