GET /swap/quote
🔹 Get Swap Quote
🌐 Endpoint
GET https://client.deframe.io/v1/swap/quote
📝 Overview
Retrieve a quote for token swaps across different chains (intra-chain and cross-chain). This endpoint supports both same-chain and cross-chain token swaps by automatically detecting the swap type and routing to the appropriate provider.
🔑 Authentication
This API requires authentication using an API key. Include your API key in the request headers:
x-api-key: YOUR_API_KEY📋 Query Parameters
originChainId
string
✅
Source chain ID (e.g., "1", "137", "56")
tokenIn
string
✅
Contract address of the input token
amountIn
string
✅
Amount of input tokens to swap
destinationChainId
string
✅
Target chain ID (e.g., "1", "137", "56")
tokenOut
string
✅
Contract address of the output token
walletAddress
string
❌
User's wallet address for provider-specific logic
decimalsIn
string
❌
Number of decimals for the input token (auto-converted to number)
📦 Response
Returns a JSON object containing:
quote: Object containing swap quote details:fromChain: Source chain informationtoChain: Destination chain informationexpectedAmountOut: Expected amount of output tokensprovider: Name of the swap provider usedAdditional provider-specific fields may be included
Example Response:
🔄 Swap Types
The endpoint automatically detects the swap type based on the chain IDs:
Intra-chain Swap: When
originChainIdequalsdestinationChainIdCross-chain Swap: When
originChainIddiffers fromdestinationChainId
🛠️ Error Handling
The API returns appropriate error messages for:
Missing required parameters
Invalid chain IDs or token addresses
No available swap provider for the requested route
Provider-specific errors during quote generation
Example Error Response:
📝 Usage Examples
Intra-chain Swap (Ethereum USDT to USDC):
Cross-chain Swap (Ethereum to Polygon):
Last updated