Help Center/API Documentation

API Documentation

API: Creating an Exchange Programmatically

How to create and manage XMR exchanges through the Ghost Exchange API.

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

StatusDescription
awaiting_depositWaiting for user to send funds
confirmingDeposit detected, waiting for confirmations
exchangingProcessing through XMR privacy layer
sendingOutgoing transaction broadcast
completeExchange finished
expiredFixed-rate order expired
refundingRefund 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"
}

Ghost Support

Available

Need help?

Start a live chat with our support team. Your conversation persists across pages.