Quote

POST /v1/quote computes optimal routing for a token swap and returns a quote with estimated outputs, costs, and routing details. This is the first step in the swap flow -- use the returned quote_id with the Build endpoint to assemble an executable transaction.

New to the API? Start with Getting Started for authentication setup and a minimal example.

Single Swap Example

Swap 1 WETH for DAI on Ethereum mainnet:

curl -X POST "https://api.infraredtrading.com/v1/quote" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "inputs": [
      {
        "chain_id": 1,
        "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "amount": "1000000000000000000"
      }
    ],
    "outputs": [
      {
        "chain_id": 1,
        "address": "0x6B175474E89094C44Da98b954EedeBC836211103",
        "ratio_bps": 10000
      }
    ],
    "taker": "0x742d35Cc6634C0532925a3b844Bc9e7595f8b3c4"
  }'

Multi-Output Split Example

Swap 1 WETH into 50% DAI and 50% USDC:

The ratio_bps values across all outputs must sum to 10000 (100%).

Request Fields

Required Fields

Field
Type
Description

inputs

array of InputToken

Tokens to swap from. 1-6 entries.

outputs

array of OutputToken

Desired output tokens with ratio allocation. 1-6 entries. Ratios must sum to 10000.

taker

string

EVM address holding input tokens with allowances set. Pattern: 0x + 40 hex characters.

Optional Fields

Field
Type
Default
Description

recipient

string

Same as taker

Address to receive output tokens. Defaults to taker if not specified.

slippage_tolerance_bps

integer

100

Maximum acceptable slippage in basis points. 100 = 1%. Range: 0-5000.

max_hops

integer

4

Maximum number of intermediate swaps allowed in the route. Range: 1-10.

exclude_protocols

array of strings

[]

Protocol identifiers to exclude from routing (e.g., ["uniswap_v2", "sushiswap"]).

exclude_pools

array of strings

[]

Pool addresses to exclude from routing.

simulate

boolean

true

Run full causal simulation. Disabling returns faster but less accurate quotes.

gas_priority

string

"fast"

Gas price tier: "slow", "standard", "fast", or "urgent". Affects EIP-1559 gas parameters.

include_usd_pricing

boolean

false

Include USD cost estimates (gas_cost_usd, fee_cost_usd, max_slippage_usd, total_cost_usd) in the response.

check_allowances

boolean

false

Check on-chain allowances and only return approvals for tokens with insufficient allowance.

include_permit2

boolean

false

Include Permit2 EIP-712 typed data for signature-based approval flow.

InputToken

Field
Type
Required
Description

chain_id

integer

Yes

Blockchain network ID (e.g., 1 for Ethereum mainnet).

address

string

Yes

Token contract address. Use 0x0000000000000000000000000000000000000000 for native ETH.

amount

string

Yes

Amount in atomic units (wei) as a decimal string.

OutputToken

Field
Type
Required
Description

chain_id

integer

Yes

Blockchain network ID. Must match input chain.

address

string

Yes

Token contract address.

ratio_bps

integer

Yes

Desired proportion of this output in basis points (1-10000). All ratios must sum to 10000.

Response Fields

A successful response returns HTTP 200 with the following structure:

Core Fields

Field
Type
Description

quote_id

string (UUID)

Unique identifier for this quote. Pass to POST /v1/build to assemble a transaction.

inputs

array

Echoed input tokens with checksummed addresses.

outputs

array

Echoed output tokens with checksummed addresses.

taker

string

Checksummed taker address.

estimated_outputs

Array of estimated output amounts, one per output token:

Field
Type
Description

token

string

EIP-55 checksummed token address.

chain_id

integer

Network ID.

expected_amount

string

Estimated output before slippage (atomic units).

minimum_amount

string

Guaranteed minimum after applying slippage_tolerance_bps (atomic units).

costs

Gas cost breakdown with EIP-1559 parameters:

Field
Type
Description

gas_cost_wei

string

Estimated gas cost in wei.

gas_cost_usd

number or null

Gas cost in USD. Only present when include_usd_pricing=true.

fee_cost_usd

number or null

Total DEX fees in USD. Only present when include_usd_pricing=true.

max_slippage_usd

number or null

Maximum potential slippage loss in USD. Only present when include_usd_pricing=true.

total_cost_usd

number or null

Sum of gas and fee costs in USD (excludes slippage). Only present when include_usd_pricing=true.

total_gas_units

integer

Estimated gas units for execution.

base_fee_wei

integer

EIP-1559 base fee in wei at quote time.

max_priority_fee_per_gas

integer

EIP-1559 max priority fee (tip) in wei.

max_fee_per_gas

integer

EIP-1559 max total fee per gas in wei.

gas_priority

string

Gas priority tier used for this quote.

path

The execution route with token metadata and step-by-step details:

Field
Type
Description

path.tokens

object

Map of token addresses to metadata (name, symbol, decimals, token_type). token_type is one of: erc20, lp, native, wrapped.

path.steps

array

Ordered list of execution steps.

Each step in path.steps:

Field
Type
Description

type

string

Operation type: swap, decompose, compose, wrap, or unwrap.

protocol

string

Protocol handling this step (e.g., uniswap_v3).

pool

string

Pool/contract address.

tokens_in

array of strings

Input token addresses for this step.

tokens_out

array of strings

Output token addresses for this step.

amounts_in

array of strings

Input amounts in atomic units. "0" if dynamic.

amounts_out

array of strings

Output amounts in atomic units. "0" if dynamic.

gas_estimate

string

Estimated gas units for this step.

share_of_input_bps

integer

Percentage of total input flowing through this step (0-10000).

protocols_used

Array of protocol identifiers involved in the route (e.g., ["uniswap_v3", "curve"]).

approvals

Array of ERC-20 approval requirements. Each entry:

Field
Type
Description

token

string

Token contract address requiring approval.

amount

string

Amount to approve in atomic units.

spender

string

Address to approve as spender (ExecutionProxy contract).

Empty if the taker already has sufficient allowances (when check_allowances=true) or if inputs are native tokens only.

permit2

Only present when include_permit2=true. Contains EIP-712 typed data for Permit2 signature-based approval:

Field
Type
Description

hash

string

Keccak256 hash of the typed data.

eip712

object

Complete EIP-712 typed data structure with types, domain, primaryType, and message. Ready for wallet.signTypedData().

Sign the eip712 object with the taker's wallet and pass the resulting signature to the Build endpoint as permit2_signature.

Last updated