API Reference.
Integrate XSwapo's instant crypto exchange into your product. RESTful, GraphQL & tRPC endpoints with real‑time rates. Zero registration required.
https://api.xswapo.io
REST · GraphQL at graphql.xswapo.io
API Key (Optional)
Public endpoints (coins, rate, limits) require no authentication. To track orders under your partner account, pass an API key header.
Content-Type: application/json X-Api-Key: your-api-key
All REST responses return JSON with a
result
field and an HTTP-mirrored
status code.
{
"result": { ... },
"status": 200
}
{
"error": "Coin BTC not found or inactive",
"status": 400
}
Returns all active coins with their available networks, deposit/withdraw capabilities and limits.
curl https://api.xswapo.io/api/v1/coins
{
"result": [
{
"id": "clx...",
"code": "BTC",
"name": "Bitcoin",
"imageUrl": "https://...",
"minDepositAmount": "0.001",
"maxDepositAmount": "10",
"networks": [
{
"network": {
"code": "BTC",
"name": "Bitcoin",
"chain": "BTC",
"isDepositEnabled": true,
"isWithdrawEnabled": true
},
"contractAddress": null,
"decimals": 8,
"depositEnabled": true,
"withdrawEnabled": true
}
]
}
],
"status": 200
}
| Name | Type | Description | |
|---|---|---|---|
| code | string | required | Coin ticker (e.g. BTC, ETH) |
curl https://api.xswapo.io/api/v1/coin/BTC
| Name | Type | Description | |
|---|---|---|---|
| coin | string | required | Coin code |
curl "https://api.xswapo.io/api/v1/limits?coin=BTC"
{
"result": {
"coin": "BTC",
"minAmount": "0.001",
"maxAmount": "10"
},
"status": 200
}
Calculates the live exchange rate between two coins using Binance spot prices with fee applied.
| Name | Type | Description | |
|---|---|---|---|
| from | string | required | Source coin code |
| to | string | required | Destination coin code |
| amount | string | required | Amount to exchange |
| fromNetwork | string | required | Source network code |
| toNetwork | string | required | Destination network code |
curl "https://api.xswapo.io/api/v1/rate?from=BTC&to=ETH&amount=0.1&fromNetwork=BTC&toNetwork=ETH"
{
"result": {
"result": "4.49885", // amount user receives
"amount": "0.1", // source amount
"rate": "44.9935", // exchange rate
"feeAmount": "0.0001", // fee charged
"minAmount": "0.001",
"maxAmount": "10"
},
"status": 200
}
Creates a new exchange order. Validates coins, networks, limits, calculates the rate, generates a deposit address and returns the full order.
| Field | Type | Description | |
|---|---|---|---|
| from | string | required | Source coin code |
| fromNetwork | string | required | Source network code |
| to | string | required | Destination coin code |
| toNetwork | string | required | Destination network code |
| amount | string | required | Amount to exchange |
| address | string | required | Recipient wallet address |
curl -X POST https://api.xswapo.io/api/v1/order \
-H "Content-Type: application/json" \
-H "X-Api-Key: your-api-key" \
-d '{
"from": "BTC",
"fromNetwork": "BTC",
"to": "ETH",
"toNetwork": "ETH",
"amount": "0.1",
"address": "0xAbCdEf..."
}'
{
"result": {
"id": "clxyz...",
"status": "CREATED",
"fromCoin": { "code": "BTC", "name": "Bitcoin" },
"toCoin": { "code": "ETH", "name": "Ethereum" },
"fromAmount": "0.1",
"toAmount": "4.49885",
"estimatedRate": "44.9935",
"feeAmount": "0.0001",
"clientWithdrawAddress": "0xAbCdEf...",
"depositAddress": { "address": "bc1q..." },
"createdAt": "2026-03-28T12:00:00.000Z"
},
"status": 200
}
| Name | Type | Description | |
|---|---|---|---|
| id | string | required | Exchange request ID |
curl https://api.xswapo.io/api/v1/order/clxyz...
Returns the full order object including transactions, deposit address, coins and networks.
| Name | Type | Description | |
|---|---|---|---|
| page | integer | optional | Page number (default: 1) |
| pageSize | integer | optional | Items per page (default: 20, max: 100) |
| status | string | optional | Filter by order status |
curl "https://api.xswapo.io/api/v1/orders?page=1&pageSize=10&status=COMPLETED"
{
"result": [ ... ],
"pagination": {
"currentPage": 1,
"totalPages": 5,
"totalCount": 94,
"hasNextPage": true
},
"status": 200
}
The same data is available via a GraphQL endpoint. Send queries to:
POST https://graphql.xswapo.io
/graphql in the browser.
query {
coins {
code
name
imageUrl
minDepositAmount
maxDepositAmount
networks {
network { code name chain isDepositEnabled }
decimals
depositEnabled
withdrawEnabled
}
}
}
query { limits(coinCode: "BTC") { coinCode minAmount maxAmount } }
query { rate(input: { from: "BTC" to: "ETH" amount: "0.1" fromNetwork: "BTC" toNetwork: "ETH" }) { result amount rate feeAmount minAmount maxAmount } }
mutation { createExchangeRequest(input: { from: "BTC" fromNetwork: "BTC" to: "ETH" toNetwork: "ETH" amount: "0.1" address: "0xAbCdEf..." }) { id status fromAmount toAmount estimatedRate feeAmount depositAddress { address } createdAt transactions { id type status amount txHash } } }
End-to-end typesafe API for TypeScript clients. Import the AppRouter type and get full autocompletion.
https://api.xswapo.io/trpc
@trpc/client and import AppRouter from the server for full type safety.
import { createTRPCClient, httpBatchLink } from '@trpc/client' import type { AppRouter } from './src/trpc/router' const trpc = createTRPCClient<AppRouter>({ links: [ httpBatchLink({ url: 'https://api.xswapo.io/trpc', headers: { 'x-api-key': 'your-api-key', // optional }, }), ], })
All queries use trpc['procedure'].query(input?) syntax.
const coins = await trpc['coins.list'].query()
const btc = await trpc['coins.byCode'].query({ code: 'BTC' })
| Param | Type | Description | |
|---|---|---|---|
| code | string | required | Coin ticker (BTC, ETH…) |
const limits = await trpc['coins.limits'].query({ coin: 'BTC' }) // → { coin: "BTC", minAmount: "0.001", maxAmount: "10" }
| Param | Type | Description | |
|---|---|---|---|
| coin | string | required | Coin code |
const rate = await trpc['exchange.rate'].query({ from: 'BTC', to: 'ETH', amount: '0.1', fromNetwork: 'BTC', toNetwork: 'ETH', }) // → { result, amount, rate, feeAmount, minAmount, maxAmount }
| Param | Type | Description | |
|---|---|---|---|
| from | string | required | Source coin code |
| to | string | required | Destination coin code |
| amount | string | required | Amount to exchange |
| fromNetwork | string | required | Source network code |
| toNetwork | string | required | Destination network code |
const order = await trpc['order.byId'].query({ id: 'clxyz...' })
| Param | Type | Description | |
|---|---|---|---|
| id | string | required | Exchange request ID |
const orders = await trpc['order.list'].query({ page: 1, pageSize: 20, status: 'COMPLETED', }) // → { result: [...], pagination: { currentPage, totalPages, totalCount, hasNextPage } }
| Param | Type | Description | |
|---|---|---|---|
| page | number | optional | Page number (default: 1) |
| pageSize | number | optional | Items per page (default: 20, max: 100) |
| status | string | optional | Filter by order status |
Creates a new exchange order. Validates coins, networks, limits, calculates the rate, generates a deposit address and returns the full order.
const order = await trpc['order.create'].mutate({ from: 'BTC', fromNetwork: 'BTC', to: 'ETH', toNetwork: 'ETH', amount: '0.1', address: '0xAbCdEf...', })
| Field | Type | Description | |
|---|---|---|---|
| from | string | required | Source coin code |
| fromNetwork | string | required | Source network code |
| to | string | required | Destination coin code |
| toNetwork | string | required | Destination network code |
| amount | string | required | Amount to exchange |
| address | string | required | Recipient wallet address |
{
"id": "clxyz...",
"status": "CREATED",
"fromCoin": { "code": "BTC", "name": "Bitcoin" },
"toCoin": { "code": "ETH", "name": "Ethereum" },
"fromAmount": "0.1",
"toAmount": "4.49885",
"estimatedRate": "44.9935",
"feeAmount": "0.0001",
"clientWithdrawAddress": "0xAbCdEf...",
"depositAddress": { "address": "bc1q..." },
"createdAt": "2026-03-28T12:00:00.000Z"
}