
In a nutshell
Blockradar’s Swap API lets you exchange assets on the same chain (swap) or move assets between different chains (bridge) using a single unified endpoint.
Blockradar’s Swap API lets you exchange assets on the same chain (swap) or move assets between different chains (bridge) using a single unified endpoint.
Prerequisites
Before using the Swap API, ensure you have:1
API Key
Get your API key from the Blockradar Dashboard. Navigate to Settings → API Keys to generate one.
2
Wallet Created
Create a wallet via the Create Wallet API or dashboard. You’ll need the
walletId for swap operations.3
Asset IDs
Get the
assetId for your source and destination assets from Assets in the dashboard or via the Get Assets API.4
Sufficient Balance
Ensure your wallet has enough balance of the source asset to cover the swap amount plus network fees.
How It Works
Blockradar automatically determines whether your transaction is a swap or a bridge based on your asset selection:Swap
Exchange different assets on the same blockchain.Example: USDC → USDT on Base
Bridge
Move assets between different blockchains.Example: USDC on BSC → USDC on Optimism
Supported Assets & Chains
The Swap API supports major stablecoins across Blockradar-supported chains:| Stablecoin | Description |
|---|---|
| USDT | Tether USD |
| USDC | USD Coin |
| DAI | Dai Stablecoin |
| BUSD | Binance USD |
| cNGN | Naira Stablecoin |
| EURC | Euro Coin |
| IDRX | Indonesian Stablecoin |
See Integrations for the complete list of supported networks and stablecoins.
Master Wallet vs Child Address
The Swap API is available at two levels:Master Wallet
Execute swaps directly from your master wallet. Ideal for treasury operations.
Child Address
Execute swaps from individual child addresses. Perfect for user-specific operations.
Endpoints
| Operation | Master Wallet | Child Address |
|---|---|---|
| Get Quote | POST /v1/wallets/{walletId}/swaps/quote | POST /v1/wallets/{walletId}/addresses/{addressId}/swaps/quote |
| Execute | POST /v1/wallets/{walletId}/swaps/execute | POST /v1/wallets/{walletId}/addresses/{addressId}/swaps/execute |
Step 1: Get a Quote
Always fetch a quote before executing a swap to show users the expected outcome.Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fromAssetId | string | Yes | The asset ID to swap from |
toAssetId | string | Yes | The asset ID to swap to |
amount | string | Yes | The amount to swap |
order | string | No | Quote preference: FASTEST, CHEAPEST, RECOMMENDED, NO_SLIPPAGE |
recipientAddress | string | No | External wallet address (for sending to non-Blockradar wallets) |
Quote Example
Quote Response
Understanding Quote Fields
| Field | Description |
|---|---|
amount | Estimated amount you’ll receive after the swap |
minAmount | Minimum guaranteed amount (accounting for slippage) |
rate | Effective exchange rate (toAmount / fromAmount) |
impact | Price impact percentage |
slippage | Maximum allowed price movement percentage |
networkFee | Gas fee in native token units |
networkFeeInUSD | Gas fee converted to USD |
estimatedArrivalTime | Expected completion time in seconds |
Step 2: Execute the Swap
Once the user confirms the quote, execute the swap.Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fromAssetId | string | Yes | The asset ID to swap from |
toAssetId | string | Yes | The asset ID to swap to |
amount | string | Yes | The amount to swap |
order | string | No | Quote preference: FASTEST, CHEAPEST, RECOMMENDED, NO_SLIPPAGE |
recipientAddress | string | No | External wallet address (for sending to non-Blockradar wallets) |
reference | string | No | Your internal tracking ID |
metadata | object | No | Custom data passed through webhooks |
Execute Example
Execute Response
Order Types
Choose the right order type based on your use case:| Order Type | Description | Best For |
|---|---|---|
FASTEST | Prioritizes speed over cost | Time-sensitive transactions |
CHEAPEST | Minimizes fees | Cost-sensitive operations |
RECOMMENDED | Balanced approach (default) | Most use cases |
NO_SLIPPAGE | Exact amount or fail | Precise amount requirements |
Webhook Events
Monitor swap completion through webhooks:| Event | Description |
|---|---|
swap.success | Swap completed successfully |
swap.failed | Swap failed |
Webhook Payload
Complete Flow Example
Here’s a full implementation showing the quote → confirm → execute flow:Error Responses
Insufficient Balance
Insufficient Balance
Invalid Asset ID
Invalid Asset ID
Swap Route Not Available
Swap Route Not Available
Amount Too Low
Amount Too Low
Slippage Exceeded
Slippage Exceeded
Best Practices
User Experience
- Always show quotes: Display amount, fees, and estimated time before execution
- Handle slippage: Inform users about potential price variations
- Show progress: Use webhooks to update users on swap status
Security
- Validate amounts: Ensure swap amounts are within acceptable ranges
- Use references: Track swaps with unique reference IDs
- Monitor webhooks: Always verify swap completion via webhooks
Performance
- Cache asset IDs: Store asset IDs locally to avoid repeated lookups
- Use appropriate order types: Choose
FASTESTfor time-sensitive,CHEAPESTfor cost-sensitive - Implement retries: Handle transient failures with exponential backoff
API Reference
| Endpoint | Description |
|---|---|
| Master Wallet Get Quote | Get swap quote from master wallet |
| Master Wallet Execute | Execute swap from master wallet |
| Child Address Get Quote | Get swap quote from child address |
| Child Address Execute | Execute swap from child address |
Support
- Email: [email protected]
- Documentation: API Reference
- Blog: How to Swap or Bridge Assets with Blockradar
The Swap API provides a unified interface for both same-chain swaps and cross-chain bridges. Start with small test amounts on testnets before moving to production.

