API Reference.
Integrate XSwapo's instant crypto exchange into your product. RESTful, GraphQL & tRPC endpoints with real‑time rates. API key required for all requests.
https://api.xswapo.io
API Key (Required)
All endpoints require a valid API key. Pass it via the X-Api-Key header.
Requests without a valid key will receive a 401 error.
Content-Type: application/json X-Api-Key: xswp_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 -H "X-Api-Key: xswp_your-api-key" \ https://api.xswapo.io/coins
{
"result": [
{
"code": "BTC",
"name": "Bitcoin",
"minDepositAmount": "0.001",
"maxDepositAmount": "10",
"networks": [
{
"code": "BTC_MAINNET",
"name": "Bitcoin Mainnet",
"depositEnabled": true,
"withdrawEnabled": true
}
]
}
],
"status": 200
}
| Name | Type | Description | |
|---|---|---|---|
| code | string | required | Coin ticker (e.g. BTC, ETH) |
curl -H "X-Api-Key: xswp_your-api-key" \ https://api.xswapo.io/coin/BTC
| Name | Type | Description | |
|---|---|---|---|
| coin | string | required | Coin code |
curl -H "X-Api-Key: xswp_your-api-key" \ "https://api.xswapo.io/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 -H "X-Api-Key: xswp_your-api-key" \ "https://api.xswapo.io/rate?from=BTC&to=ETH&amount=0.1&fromNetwork=BTC_MAINNET&toNetwork=ETH_MAINNET"
{
"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/order \
-H "Content-Type: application/json" \
-H "X-Api-Key: xswp_your-api-key" \
-d '{
"from": "BTC",
"fromNetwork": "BTC_MAINNET",
"to": "ETH",
"toNetwork": "ETH_MAINNET",
"amount": "0.1",
"address": "0xAbCdEf..."
}'
{
"result": {
"id": "bravel-somikt",
"status": "CREATED",
"createdAt": "2026-03-28T12:00:00.000Z",
"from": {
"coin": "BTC",
"network": "BTC_MAINNET",
"amount": "0.1"
},
"to": {
"coin": "ETH",
"network": "ETH_MAINNET",
"amount": "4.49885"
},
"rate": "44.9935",
"fee": "0.0001",
"depositAddress": "bc1q...",
"withdrawAddress": "0xAbCdEf...",
"transactions": []
},
"status": 200
}
| Name | Type | Description | |
|---|---|---|---|
| id | string | required | Order ID (e.g. bravel-somikt) |
curl -H "X-Api-Key: xswp_your-api-key" \ https://api.xswapo.io/order/bravel-somikt
Returns the full order object including transactions and deposit address.
| 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 -H "X-Api-Key: xswp_your-api-key" \ "https://api.xswapo.io/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://gql.xswapo.io
query {
coins {
code
name
minDepositAmount
maxDepositAmount
networks {
code
name
depositEnabled
withdrawEnabled
}
}
}
query { limits(coinCode: "BTC") { coinCode minAmount maxAmount } }
query { rate(input: { from: "BTC" to: "ETH" amount: "0.1" fromNetwork: "BTC_MAINNET" toNetwork: "ETH_MAINNET" }) { result amount rate feeAmount minAmount maxAmount } }
mutation { createExchangeRequest(input: { from: "BTC" fromNetwork: "BTC_MAINNET" to: "ETH" toNetwork: "ETH_MAINNET" amount: "0.1" address: "0xAbCdEf..." }) { id status createdAt from { coin network amount } to { coin network amount } rate fee depositAddress withdrawAddress transactions { type status amount txHash } } }
End-to-end typesafe API for TypeScript clients. Import the AppRouter type and get full autocompletion.
https://trpc.xswapo.io
@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://trpc.xswapo.io', headers: { 'x-api-key': 'xswp_your-api-key', }, }), ], })
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: 'bravel-somikt' })
| Param | Type | Description | |
|---|---|---|---|
| id | string | required | Order 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_MAINNET', to: 'ETH', toNetwork: 'ETH_MAINNET', 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": "bravel-somikt",
"status": "CREATED",
"createdAt": "2026-03-28T12:00:00.000Z",
"from": {
"coin": "BTC",
"network": "BTC_MAINNET",
"amount": "0.1"
},
"to": {
"coin": "ETH",
"network": "ETH_MAINNET",
"amount": "4.49885"
},
"rate": "44.9935",
"fee": "0.0001",
"depositAddress": "bc1q...",
"withdrawAddress": "0xAbCdEf...",
"transactions": []
}