v1.0 · All systems operational

API Reference.

Integrate XSwapo's instant crypto exchange into your product. RESTful, GraphQL & tRPC endpoints with real‑time rates. Zero registration required.

200+
Coins
<5 min
Avg. Time
REST + GQL + tRPC
Protocols
24 / 7
Uptime
Base URL https://api.xswapo.io REST  ·  GraphQL at graphql.xswapo.io
Authentication

API Key (Optional)

Public endpoints (coins, rate, limits) require no authentication. To track orders under your partner account, pass an API key header.

HTTP Headers
Content-Type: application/json
X-Api-Key:     your-api-key
Contact [email protected] to obtain a partner API key.
Response Format & Status Codes

All REST responses return JSON with a result field and an HTTP-mirrored status code.

200 Success
{
  "result": { ... },
  "status": 200
}
400 Error
{
  "error":  "Coin BTC not found or inactive",
  "status": 400
}
Order Statuses
CREATED
WAITING_DEPOSIT
DEPOSIT_DETECTED
UNDERPAID
OVERPAID
REFUND_PENDING
PARTIALLY_REFUNDED
REFUNDED
PROCESSING
COMPLETED
CANCELLED
FAILED

REST API — Endpoints
GET /api/v1/coins List all available coins

Returns all active coins with their available networks, deposit/withdraw capabilities and limits.

cURL
curl https://api.xswapo.io/api/v1/coins
Response
200 Success
{
  "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
}
GET /api/v1/coin/:code Get coin by code
Path Parameters
NameTypeDescription
code string required Coin ticker (e.g. BTC, ETH)
cURL
curl https://api.xswapo.io/api/v1/coin/BTC
GET /api/v1/limits Exchange limits for a coin
Query Parameters
NameTypeDescription
coin string required Coin code
cURL
curl "https://api.xswapo.io/api/v1/limits?coin=BTC"
200 Response
{
  "result": {
    "coin":      "BTC",
    "minAmount": "0.001",
    "maxAmount": "10"
  },
  "status": 200
}
GET /api/v1/rate Calculate exchange rate

Calculates the live exchange rate between two coins using Binance spot prices with fee applied.

Query Parameters
NameTypeDescription
fromstringrequiredSource coin code
tostringrequiredDestination coin code
amountstringrequiredAmount to exchange
fromNetworkstringrequiredSource network code
toNetworkstringrequiredDestination network code
cURL
curl "https://api.xswapo.io/api/v1/rate?from=BTC&to=ETH&amount=0.1&fromNetwork=BTC&toNetwork=ETH"
200 Response
{
  "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
}
POST /api/v1/order Create exchange order

Creates a new exchange order. Validates coins, networks, limits, calculates the rate, generates a deposit address and returns the full order.

Request Body
FieldTypeDescription
fromstringrequiredSource coin code
fromNetworkstringrequiredSource network code
tostringrequiredDestination coin code
toNetworkstringrequiredDestination network code
amountstringrequiredAmount to exchange
addressstringrequiredRecipient wallet address
cURL
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..."
  }'
200 Response
{
  "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
}
GET /api/v1/order/:id Get order by ID
Path Parameters
NameTypeDescription
id string required Exchange request ID
cURL
curl https://api.xswapo.io/api/v1/order/clxyz...

Returns the full order object including transactions, deposit address, coins and networks.

GET /api/v1/orders List orders (paginated)
Query Parameters
NameTypeDescription
pageintegeroptionalPage number (default: 1)
pageSizeintegeroptionalItems per page (default: 20, max: 100)
statusstringoptionalFilter by order status
cURL
curl "https://api.xswapo.io/api/v1/orders?page=1&pageSize=10&status=COMPLETED"
200 Response
{
  "result": [ ... ],
  "pagination": {
    "currentPage": 1,
    "totalPages":  5,
    "totalCount":  94,
    "hasNextPage": true
  },
  "status": 200
}

GraphQL API

The same data is available via a GraphQL endpoint. Send queries to:

Endpoint POST https://graphql.xswapo.io
🔮 An interactive GraphQL Playground is available at /graphql in the browser.
QUERY coins · coin · limits · rate · exchangeRequest(s)
All coins
query {
  coins {
    code
    name
    imageUrl
    minDepositAmount
    maxDepositAmount
    networks {
      network { code name chain isDepositEnabled }
      decimals
      depositEnabled
      withdrawEnabled
    }
  }
}
Limits
query {
  limits(coinCode: "BTC") {
    coinCode
    minAmount
    maxAmount
  }
}
Rate
query {
  rate(input: {
    from: "BTC"
    to: "ETH"
    amount: "0.1"
    fromNetwork: "BTC"
    toNetwork: "ETH"
  }) {
    result
    amount
    rate
    feeAmount
    minAmount
    maxAmount
  }
}
MUTATION createExchangeRequest
Create order
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
    }
  }
}

tRPC API

End-to-end typesafe API for TypeScript clients. Import the AppRouter type and get full autocompletion.

Endpoint https://api.xswapo.io/trpc
Install @trpc/client and import AppRouter from the server for full type safety.
Client Setup (TypeScript)
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
      },
    }),
  ],
})
QUERY coins.list · coins.byCode · coins.limits · exchange.rate · order.byId · order.list

All queries use trpc['procedure'].query(input?) syntax.

coins.list — All active coins
TypeScript
const coins = await trpc['coins.list'].query()
coins.byCode — Coin by ticker
TypeScript
const btc = await trpc['coins.byCode'].query({ code: 'BTC' })
ParamTypeDescription
codestringrequiredCoin ticker (BTC, ETH…)
coins.limits — Exchange limits
TypeScript
const limits = await trpc['coins.limits'].query({ coin: 'BTC' })
// → { coin: "BTC", minAmount: "0.001", maxAmount: "10" }
ParamTypeDescription
coinstringrequiredCoin code
exchange.rate — Calculate rate
TypeScript
const rate = await trpc['exchange.rate'].query({
  from: 'BTC',
  to: 'ETH',
  amount: '0.1',
  fromNetwork: 'BTC',
  toNetwork: 'ETH',
})
// → { result, amount, rate, feeAmount, minAmount, maxAmount }
ParamTypeDescription
fromstringrequiredSource coin code
tostringrequiredDestination coin code
amountstringrequiredAmount to exchange
fromNetworkstringrequiredSource network code
toNetworkstringrequiredDestination network code
order.byId — Get order by ID
TypeScript
const order = await trpc['order.byId'].query({ id: 'clxyz...' })
ParamTypeDescription
idstringrequiredExchange request ID
order.list — List orders (paginated)
TypeScript
const orders = await trpc['order.list'].query({
  page: 1,
  pageSize: 20,
  status: 'COMPLETED',
})
// → { result: [...], pagination: { currentPage, totalPages, totalCount, hasNextPage } }
ParamTypeDescription
pagenumberoptionalPage number (default: 1)
pageSizenumberoptionalItems per page (default: 20, max: 100)
statusstringoptionalFilter by order status
MUTATE order.create

Creates a new exchange order. Validates coins, networks, limits, calculates the rate, generates a deposit address and returns the full order.

TypeScript
const order = await trpc['order.create'].mutate({
  from: 'BTC',
  fromNetwork: 'BTC',
  to: 'ETH',
  toNetwork: 'ETH',
  amount: '0.1',
  address: '0xAbCdEf...',
})
FieldTypeDescription
fromstringrequiredSource coin code
fromNetworkstringrequiredSource network code
tostringrequiredDestination coin code
toNetworkstringrequiredDestination network code
amountstringrequiredAmount to exchange
addressstringrequiredRecipient wallet address
200 Response
{
  "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"
}