Skip to main content
GET
/
v2
/
swap
/
quote
Get swap quote
curl --request GET \
  --url https://api.deframe.io/v2/swap/quote \
  --header 'x-api-key: <api-key>'
{
  "quote": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "quoteId": "550e8400-e29b-41d4-a716-446655440000",
    "originChain": "ethereum",
    "destinationChain": "polygon",
    "tokenIn": {
      "contract": "0xb794F5eA0ba39494cE839613fffBA74279579268",
      "symbol": "USDC",
      "decimals": 6,
      "amount": "1000000000000000000",
      "chainId": 1,
      "priceUSD": "1.00"
    },
    "tokenOut": {
      "contract": "0xb794F5eA0ba39494cE839613fffBA74279579268",
      "symbol": "USDC",
      "decimals": 6,
      "amount": "1000000000000000000",
      "chainId": 1,
      "priceUSD": "1.00"
    },
    "provider": "teleswap",
    "deadline": 1705753800,
    "deadlineDate": "2024-01-20T12:30:00.000Z",
    "feeBreakdown": {
      "chargeableAmountInRaw": "<string>",
      "amountInAfterPlatformFeesRaw": "<string>",
      "reference": {
        "amountOutRaw": "<string>",
        "pricedAt": "2023-11-07T05:31:56Z",
        "tokenInPriceInUSD": 123,
        "tokenOutPriceInUSD": 123,
        "amountInAfterPlatformFeesRaw": "<string>"
      },
      "lines": [
        {
          "label": "<string>",
          "amountRaw": "<string>",
          "decimals": 123,
          "symbol": "<string>",
          "amountInUSD": 123,
          "signed": true
        }
      ],
      "summary": {
        "platformFeesTotalInRaw": "<string>",
        "platformFeesTotalInUSD": 123,
        "bridgeAndSlippageImpactOutRaw": "<string>",
        "bridgeAndSlippageImpactOutUSD": 123
      }
    },
    "chainIdIn": 1,
    "chainIdOut": 137,
    "rawQuote": "<unknown>",
    "status": "pending",
    "feeSponsorship": false,
    "customer": "<string>"
  },
  "id": "65f1a2b3c4d5e6f789012345",
  "chainId": 1,
  "transactionData": [
    {
      "chainId": 1,
      "to": "0xb794F5eA0ba39494cE839613fffBA74279579268",
      "data": "0x...",
      "value": "0",
      "from": "0xb794F5eA0ba39494cE839613fffBA74279579268"
    }
  ]
}

Authorizations

x-api-key
string
header
required

API key for authentication. Obtain from your Deframe dashboard.

Query Parameters

originChain
string

Origin blockchain network name. Use with destinationChain.

Example:

"ethereum"

chainIdIn
number

Origin chain ID. Alternative to originChain.

Example:

1

destinationChain
string

Destination blockchain network name. Use with originChain.

Example:

"polygon"

chainIdOut
number

Destination chain ID. Alternative to destinationChain.

Example:

137

tokenIn
string
required

Input token contract address

Example:

"0xb794F5eA0ba39494cE839613fffBA74279579268"

tokenOut
string
required

Output token contract address

Example:

"0xb794F5eA0ba39494cE839613fffBA74279579268"

amountIn
string

Input amount (in token smallest unit). Provide either amountIn or amountOut, not both.

Example:

"1000000000000000000"

amountOut
string

Desired output amount (in token smallest unit). Provide either amountIn or amountOut, not both.

Example:

"1000000000000000000"

originAddress
string

Sender address on the origin chain. When provided together with destinationAddress, the endpoint generates and returns transaction bytecode in the same response, skipping the need for a separate POST /v2/swap/bytecode call.

Example:

"0xb794F5eA0ba39494cE839613fffBA74279579268"

destinationAddress
string

Recipient address on destination chain. When provided together with originAddress, the endpoint generates and returns transaction bytecode in the same response.

Example:

"0xb794F5eA0ba39494cE839613fffBA74279579268"

refundAddress
string

Address for refunds if swap fails

Example:

"0xb794F5eA0ba39494cE839613fffBA74279579268"

feeSponsorship
boolean

Request fee sponsorship on eligible Deframe bridge routes

Example:

false

preferredProvider
string

Registered provider name to force when eligible for the route

Example:

"relay"

slippage
string

Slippage tolerance as a fraction of 1. Valid range is 0.0001 to 0.5.

Example:

"0.01"

transferSpeed
enum<string>

Transfer speed for CCTP cross-chain swaps

Available options:
fast,
standard
Example:

"fast"

Response

Quote generated successfully. When both originAddress and destinationAddress are provided, the response also includes transaction bytecode fields (id, chainId, transactionData) identical to those returned by POST /v2/swap/bytecode.

quote
object
required

Swap quote with token details, fee breakdown, and expiration

id
string

ID created for execution tracking. Only present when originAddress and destinationAddress were both provided.

Example:

"65f1a2b3c4d5e6f789012345"

chainId
number

Chain ID where transactions should be executed. Only present when bytecode was generated.

Example:

1

transactionData
object

Transaction data for execution