Exchange API
Quote and create crypto swaps from your own product. Every swap created with your key is counted for your partner account and earns you a share.
- Base URL
https://cloudswap.io/api/partner/v1- Format
- JSON over HTTPS. Amounts are decimal strings.
- Limit
- 120 requests per minute per key
Authentication
Create a key in the partner dashboard and send it in the X-Api-Key header of every request. The key is shown once; if it leaks, issue a new one and the old key stops working at once. Keep the key on your server: do not put it into a web page or a mobile app.
List currencies
GET/currencies
Coins you can send to us (side=from) or receive (side=to). Every coin has an id of the form ticker:network — use it in all other calls.
side | from | to | Which list to return. Default: to. |
|---|---|---|
q | string | Search by ticker or name. |
limit | 1–100 | How many to return. Default: 50. |
curl "https://cloudswap.io/api/partner/v1/currencies?side=from&q=btc" \
-H "X-Api-Key: csk_your_key"{
"total": 1,
"currencies": [
{
"id": "btc:btc",
"symbol": "BTC",
"name": "Bitcoin",
"network": "Bitcoin",
"hasExtraId": false,
"extraIdName": null,
"addressRegex": "^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,62}$",
"canSend": true,
"minSend": "0.0002"
}
]
}Get an estimate
GET/estimate
How much the customer receives. With fixed=true the answer includes a quoteId: a swap created with it within the validity time pays exactly amountOut. With fixed=false the amount is an estimate and is settled at the rate when the deposit is confirmed.
from | coin id | What the customer sends. |
|---|---|---|
to | coin id | What the customer receives. |
amount | string | Amount to send, as a decimal string. |
fixed | true | false | Fixed or floating rate. Default: true. |
curl "https://cloudswap.io/api/partner/v1/estimate?from=btc:btc&to=usdt:trx&amount=0.1" \
-H "X-Api-Key: csk_your_key"{
"from": "btc:btc",
"to": "usdt:trx",
"amountIn": "0.1",
"amountOut": "6742.31",
"rate": "67423.1",
"networkFee": "1.5",
"fixed": true,
"quoteId": "eyJmIjoiYnRjOmJ0YyIsInQiOiJ1c2R0OnRyeCJ9…",
"validUntil": "2026-11-13T19:05:00.000Z"
}Create an exchange
POST/exchanges
Creates a swap and returns the deposit address. Show the customer depositAddress (and depositExtraId when it is not null) and the exact amount. The swap is counted for your partner account.
from, to | coin id | The pair. |
|---|---|---|
amount | string | Amount the customer will send. |
address | string | Where the customer receives the coins. |
extraId | string | Memo or tag for the payout, for coins that need one. |
refundAddress | string | Where to return the deposit if the swap cannot be completed. Optional, recommended. |
fixed | boolean | Fixed or floating rate. Default: true. |
quoteId | string | From /estimate, to lock the shown amount. |
curl -X POST "https://cloudswap.io/api/partner/v1/exchanges" \
-H "X-Api-Key: csk_your_key" \
-H "Content-Type: application/json" \
-d '{
"from": "btc:btc",
"to": "usdt:trx",
"amount": "0.1",
"address": "TQ7xkV3mGq1nB8sYpL2dWcR5uJ9LpA2cXe",
"refundAddress": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
}'{
"id": "a3f9k2m8x7q1",
"status": "waiting",
"from": { "id": "btc:btc", "symbol": "BTC", "name": "Bitcoin", "network": "Bitcoin" },
"to": { "id": "usdt:trx", "symbol": "USDT", "name": "Tether", "network": "TRON" },
"fixed": true,
"amountExpected": "0.1",
"amountReceived": null,
"amountOutEstimated": "6742.31",
"amountOut": null,
"rate": "67423.1",
"depositAddress": "bc1q9d4ywgfnd8h43da5tpcxcn6ajv590cg6d3tg6a",
"depositExtraId": null,
"depositDeadline": "2026-11-13T19:20:00.000Z",
"address": "TQ7xkV3mGq1nB8sYpL2dWcR5uJ9LpA2cXe",
"extraId": null,
"refundAddress": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"depositTxHash": null,
"payoutTxHash": null,
"refundTxHash": null,
"commission": null,
"createdAt": "2026-11-13T19:00:00.000Z",
"updatedAt": "2026-11-13T19:00:00.000Z"
}Get an exchange
GET/exchanges/{id}
The current state of one of your exchanges. Poll it every 15–30 seconds until the status is final. Exchanges of other partners return 404.
curl "https://cloudswap.io/api/partner/v1/exchanges/a3f9k2m8x7q1" \
-H "X-Api-Key: csk_your_key"{
"id": "a3f9k2m8x7q1",
"status": "finished",
"amountReceived": "0.1",
"amountOut": "6742.31",
"depositTxHash": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
"payoutTxHash": "c4f2a1d09b7e63580a1f5c2e8d7b6a4930e1f2c3d4b5a69788796a5b4c3d2e1f",
"commission": "26.97",
"…": "the same fields as on creation"
}List your exchanges
GET/exchanges
All swaps counted for your partner account, newest first: created through the API, the widget or your referral link.
limit | 1–100 | Page size. Default: 20. |
|---|---|---|
offset | number | How many to skip. Default: 0. |
curl "https://cloudswap.io/api/partner/v1/exchanges?limit=20&offset=0" \
-H "X-Api-Key: csk_your_key"{
"total": 134,
"limit": 20,
"offset": 0,
"exchanges": [ { "id": "a3f9k2m8x7q1", "status": "finished", "…": "…" } ]
}Partner balance
GET/balance
Your rate and how much you have earned, been paid and can withdraw. Amounts are in USDT.
curl "https://cloudswap.io/api/partner/v1/balance" \
-H "X-Api-Key: csk_your_key"{
"commissionPct": "0.4",
"earned": "512.40",
"paid": "400.00",
"balance": "112.40",
"currency": "USDT"
}Statuses
waiting | The deposit address is issued; we are waiting for the customer's coins. |
|---|---|
confirming | The deposit is seen on the network and is collecting confirmations. |
verifying | The incoming transaction is being checked. |
exchanging | The coins are being exchanged. |
sending | The payout to the customer has been sent. |
finished | Final. The customer has been paid; your reward is credited. |
refunding | The deposit is being returned to the refund address. |
refunded | Final. The deposit was returned. |
expired | Final unless a late deposit arrives: nothing was sent in time. |
Errors
An error answer has the HTTP status and a body of the form { "code": "…", "message": "…" }. Rely on the code, not on the message text.
| 400 | VALIDATION_ERROR | A field is missing or malformed. See issues[] in the answer. |
|---|---|---|
| 400 | INVALID_PAYOUT_ADDRESS | The address does not match the coin and network. |
| 400 | AMOUNT_TOO_LOW / AMOUNT_TOO_HIGH | The amount is outside the limits; min or max is in the answer. |
| 400 | PAIR_NOT_SUPPORTED | This pair cannot be exchanged. |
| 401 | INVALID_API_KEY | The X-Api-Key header is missing, wrong or the key was replaced. |
| 404 | NOT_FOUND | No such exchange among yours. |
| 429 | RATE_LIMITED | More than 120 requests per minute with one key. |
| 503 | RATE_UNAVAILABLE | The rate source did not answer. Retry in a few seconds. |
| 503 | DEPOSIT_ADDRESS_UNAVAILABLE | A deposit address could not be issued. Retry in a minute. |
Widget
No backend needed: paste a frame into your page and your visitors get a live swap form. Build it with your code in the partner dashboard, or write the address by hand.
<iframe
src="https://cloudswap.io/widget?ref=YOUR_CODE&from=btc:btc&to=eth:eth&amount=0.1"
title="Cloudswap exchange"
width="100%" height="420"
style="max-width:460px;border:0;border-radius:24px"
loading="lazy"></iframe>ref | Your partner code. Without it the widget works, but swaps are not counted for you. |
|---|---|
from, to | Coin ids shown first. The visitor can change them. |
amount | The amount shown first. |