Creating an Exchange via API
The `/exchange` endpoint lets you create swaps programmatically.
POST /exchange
Create a new exchange order.
Request:
{
"from": "XMR",
"to": "BTC",
"amount": "1.5",
"address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"rate_type": "float",
"webhook_url": "https://yourserver.com/webhook"
}Response:
{
"id": "ord_7f8a9b2c",
"status": "awaiting_deposit",
"deposit_address": "4Abc123...",
"deposit_amount": "1.500000",
"estimated_receive": "0.002775",
"rate": "0.00185",
"rate_type": "float",
"expires_at": null,
"created_at": "2026-05-10T10:00:00Z"
}GET /exchange/:id
Check order status.
{
"id": "ord_7f8a9b2c",
"status": "complete",
"deposit_tx": "abc123...",
"receive_tx": "def456...",
"received_amount": "0.002770",
"completed_at": "2026-05-10T10:18:00Z"
}Status Values
| Status | Description |
|---|---|
| awaiting_deposit | Waiting for user to send funds |
| confirming | Deposit detected, waiting for confirmations |
| exchanging | Processing through XMR privacy layer |
| sending | Outgoing transaction broadcast |
| complete | Exchange finished |
| expired | Fixed-rate order expired |
| refunding | Refund in progress |
Error Handling
Errors return standard HTTP status codes with a JSON body:
{
"error": "invalid_address",
"message": "The provided BTC address is not valid"
}