Swap crypto to crypto, crypto to fiat, or fiat to crypto. Both wallets must belong to your business. The request needs approved KYB and an Idempotency-Key. Required scope: crypto-swap:create.
Authorization
oauth2ClientCredentials crypto-swap:createAuthorizationBearer <token>
Use your OAuth client credentials to obtain a short-lived Bearer token from POST /oauth/token.
In: header
Scope: crypto-swap:create
Header Parameters
Idempotency-Key*string
A unique key for this swap request.
Length
length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
Create a crypto swap
curl --request POST \ --url 'https://example.com/api/external/crypto/swaps' \ --header 'Idempotency-Key: string' \ --header 'Content-Type: application/json' \ --data '{ "from_wallet": "btc-wallet-id", "to_wallet": "eth-wallet-id", "amount": "0.50000000"}'{ "message": "Crypto swap processed successfully.", "data": { "type": "swap", "from_wallet_id": "btc-wallet-id", "to_wallet_id": "eth-wallet-id", "from_amount": "0.500000000000000000", "fee": "0.000000000000000000", "rate": "15", "to_amount": "7.500000000000000000", "fiat_transaction_id": null, "fiat_transaction": null, "from_transaction_id": "swap-out-id", "from_transaction": { "id": "swap-out-id", "wallet_id": "btc-wallet-id", "type": "swap", "direction": "out", "status": "successful", "currency": "BTC", "amount": "0.500000000000000000" }, "to_transaction_id": "swap-in-id", "to_transaction": { "id": "swap-in-id", "wallet_id": "eth-wallet-id", "type": "swap", "direction": "in", "status": "successful", "currency": "ETH", "amount": "7.500000000000000000" } }}