To use our API, you'll need to create an API key in your account.
Welcome to the NinjaSwap API documentation. Our API allows you to integrate cryptocurrency exchange functionality into your applications, with support for 70+ cryptocurrencies and competitive rates.
All API requests require authentication using an API key included in the request headers.
Choose between float rates (market price) or fixed rates (guaranteed price) for your exchanges.
Our API is optimized for speed with most requests processed in under 200ms.
This endpoint returns a list of all available cryptocurrencies for exchange including their capabilities (send/receive) and metadata.
This endpoint does not require any parameters.
curl -X POST "/api/available-currencies"
-H "Content-Type: application/json"
-H "X-API-Key: 616f7f9c75c0a13d89f9882a1836d83bc2fcfacff0baec5c0d58be441cd3b43b"
{
"code": 0,
"data": [
{
"code": "BTC",
"name": "Bitcoin",
"logo": "/assets/images/coins/btc.svg",
"network": "Bitcoin",
"canSend": true,
"canReceive": true
},
{
"code": "ETH",
"name": "Ethereum",
"logo": "/assets/images/coins/eth.svg",
"network": "Ethereum",
"canSend": true,
"canReceive": true
},
/* More currencies... */
]
}This endpoint returns the current exchange rate between two cryptocurrencies.
| Parameter | Type | Required | Description |
|---|---|---|---|
| fromCurrency | String | Yes | The currency code to exchange from (e.g., "BTC") |
| toCurrency | String | Yes | The currency code to exchange to (e.g., "ETH") |
| amount | Number | Yes | The amount to exchange |
| direction | String | No | "from" or "to" (default: "from") |
| type | String | No | "float" or "fixed" (default: "float") |
curl -X POST "/api/exchange-rate"
-H "Content-Type: application/json"
-H "X-API-Key: 616f7f9c75c0a13d89f9882a1836d83bc2fcfacff0baec5c0d58be441cd3b43b"
-d {
"fromCurrency": "BTC",
"toCurrency": "ETH",
"amount": 0.01,
"direction": "from",
"type": "float"
}
{
"code": 0,
"data": {
"errors": [],
"from": {
"amount": 0.01,
"code": "BTC",
"coin": "BTC",
"network": "",
"precision": 8,
"rate": 52.340873224619,
"min": 0.00010781,
"max": 0.76990932,
"btc": 0.01,
"usd": 965.4067100000001
},
"to": {
"amount": 0.52340873224619,
"code": "ETH",
"coin": "ETH",
"network": "",
"precision": 8,
"rate": 0.01910937659053312,
"min": 0.005648045673452619,
"max": 40.32257775783138,
"usd": 960.3211628330495
}
},
"msg": "OK (XML)"
}This endpoint creates a new cryptocurrency exchange order.
| Parameter | Type | Required | Description |
|---|---|---|---|
| fromCcy | String | Yes | The currency code to exchange from (e.g., "BTC") |
| toCcy | String | Yes | The currency code to exchange to (e.g., "ETH") |
| amount | Number | Yes | The amount to exchange in fromCcy |
| type | String | No | The rate type: "float" (default) or "fixed" |
| direction | String | Yes | Direction of exchange, use "from" to specify amount in fromCcy |
| toAddress | String | Yes | The wallet address to receive the exchanged currency |
| refundAddress | String | Yes | Refund address in case the exchange can't be completed |
curl -X POST "/api/create-order"
-H "Content-Type: application/json"
-H "X-API-Key: 616f7f9c75c0a13d89f9882a1836d83bc2fcfacff0baec5c0d58be441cd3b43b"
-d {
"fromCcy": "BTC",
"toCcy": "ETH",
"amount": 0.1,
"type": "float",
"direction": "from",
"toAddress": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"refundAddress": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
}
{
"code": 0,
"data": {
"id": "NS1234567890",
"token": "abcdef1234567890",
"from": {
"currency": "BTC",
"amount": 0.1,
"address": "3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5",
"tag": null
},
"to": {
"currency": "ETH",
"amount": 1.45,
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"tag": null
},
"type": "fixed",
"status": "waiting",
"created_at": 1681234567,
"expires_at": 1681238167
}
}This endpoint returns the current status of an existing order.
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | String | Yes | The order ID returned from create-order |
| token | String | Yes | The token returned from create-order |
curl -X POST "https://api.ninjaswap.fi/api/order-details"
-H "Content-Type: application/json"
-H "X-API-Key: 616f7f9c75c0a13d89f9882a1836d83bc2fcfacff0baec5c0d58be441cd3b43b"
-d {
"id": "NS1234567890",
"token": "abcdef1234567890"
}
{
"code": 0,
"data": {
"id": "NS1234567890",
"from": {
"currency": "BTC",
"amount": 0.1,
"address": "3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5",
"tag": null,
"txid": "7e46e13e4a3a59ff8a23990a37a3c6a57eb0e52bc7ccbe3e95b2b7e12d7b5e54"
},
"to": {
"currency": "ETH",
"amount": 1.45,
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"tag": null,
"txid": null
},
"type": "fixed",
"status": "confirming",
"confirmations": 2,
"required_confirmations": 3,
"created_at": 1681234567,
"expires_at": 1681238167
}
}This endpoint generates QR codes for an order's payment addresses.
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | String | Yes | The order ID returned from create-order |
| token | String | Yes | The token returned from create-order |
| type | String | No | QR code type: "address" (default) or "uri" |
curl -X POST "https://api.ninjaswap.fi/api/qr-codes"
-H "Content-Type: application/json"
-H "X-API-Key: 616f7f9c75c0a13d89f9882a1836d83bc2fcfacff0baec5c0d58be441cd3b43b"
-d {
"id": "NS1234567890",
"token": "abcdef1234567890",
"type": "address"
}
The response includes a base64-encoded QR code image.
{
"code": 0,
"data": {
"checked": true,
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwA..."
}
}