Skip to main content
This page documents the data types, formats, and validation rules for LI.FI API parameters and responses. Use this as a reference for building robust integrations.

Core Types

Chain

Represents a blockchain network.
interface Chain {
  id: number;              // Chain ID (e.g., 1 for Ethereum)
  key: string;             // Short identifier (e.g., "eth")
  name: string;            // Display name (e.g., "Ethereum")
  chainType: ChainType;    // "EVM" | "SVM" | "UTXO" | "MVM"
  coin: string;            // Native token symbol (e.g., "ETH")
  mainnet: boolean;        // true if mainnet
  logoURI: string;         // Chain logo URL
  metamask?: MetaMaskConfig;
}

type ChainType = "EVM" | "SVM" | "UTXO" | "MVM";
FieldTypeRequiredDescription
idintegerYesUnique chain identifier
keystringYesShort key (lowercase)
namestringYesHuman-readable name
chainTypeenumYesBlockchain type
coinstringYesNative token symbol
mainnetbooleanYesIs production network

Common Chain IDs

ChainIDType
Ethereum1EVM
Arbitrum42161EVM
Optimism10EVM
Polygon137EVM
Base8453EVM
Avalanche43114EVM
BSC56EVM
Solana1151111081099710SVM

Token

Represents a cryptocurrency token.
interface Token {
  address: string;         // Contract address
  symbol: string;          // Token symbol (e.g., "USDC")
  name: string;            // Full name (e.g., "USD Coin")
  decimals: number;        // Decimal places (e.g., 6)
  chainId: number;         // Chain this token is on
  priceUSD?: string;       // Current USD price
  logoURI?: string;        // Token logo URL
}
FieldTypeRequiredFormatDescription
addressstringYesHex (0x…) or nativeContract address
symbolstringYes2-10 charsTrading symbol
decimalsintegerYes0-18Decimal places
chainIdintegerYesParent chain ID
priceUSDstringNoDecimal stringUSD price

Native Token Address

0x0000000000000000000000000000000000000000
This address represents the native token (ETH, MATIC, etc.) on any EVM chain.

Common Token Decimals

TokenDecimals1 Token in Wei
USDC61000000
USDT61000000
DAI181000000000000000000
WETH181000000000000000000
WBTC8100000000

Quote

Response from /quote endpoint.
interface Quote {
  id: string;                    // Unique quote identifier
  type: "lifi";                  // Always "lifi"
  tool: string;                  // Bridge/DEX used
  toolDetails: ToolDetails;      // Tool metadata
  action: Action;                // Transfer details
  estimate: Estimate;            // Cost and output estimates
  transactionRequest: TxRequest; // Ready-to-sign transaction
}

Action

Describes what the quote will do.
interface Action {
  fromChainId: number;       // Source chain
  toChainId: number;         // Destination chain
  fromToken: Token;          // Source token
  toToken: Token;            // Destination token
  fromAmount: string;        // Input amount (smallest unit)
  slippage: number;          // Slippage tolerance (decimal)
  fromAddress: string;       // Sender address
  toAddress: string;         // Recipient address
}
FieldTypeFormatConstraints
fromChainIdintegerMust be supported chain
toChainIdintegerMust be supported chain
fromAmountstringInteger string> 0, in smallest unit
slippagenumberDecimal0 < slippage < 1
fromAddressstring0x… (42 chars)Valid address

Estimate

Cost and output estimates.
interface Estimate {
  fromAmount: string;           // Input amount
  toAmount: string;             // Expected output amount
  toAmountMin: string;          // Minimum guaranteed (slippage)
  approvalAddress: string;      // Spender for token approval
  executionDuration: number;    // Estimated seconds
  feeCosts: FeeCost[];          // Protocol fees
  gasCosts: GasCost[];          // Gas costs
}
FieldTypeDescription
toAmountstringExpected output (optimistic)
toAmountMinstringGuaranteed minimum (after slippage)
approvalAddressstringUse for ERC20 approve()
executionDurationintegerEstimated time in seconds

TransactionRequest

Ready-to-sign transaction data.
interface TransactionRequest {
  to: string;           // Contract address
  data: string;         // Encoded call data
  value: string;        // Native token amount (hex)
  gasLimit: string;     // Gas limit (hex)
  gasPrice?: string;    // Suggested gas price (hex)
  chainId: number;      // Chain ID for signing
}
FieldTypeFormatDescription
tostring0x… (42 chars)Destination contract
datastring0x… (hex)Encoded function call
valuestring0x… (hex)Wei amount (hex string)
gasLimitstring0x… (hex)Gas units (hex)
chainIdintegerEIP-155 chain ID

Converting Hex Values

// Hex to decimal
const gasLimit = parseInt(tx.gasLimit, 16);
const value = BigInt(tx.value);

// Decimal to hex
const hexValue = '0x' + amount.toString(16);

Status

Transfer status response.
interface Status {
  transactionId: string;      // Unique transfer ID
  sending: TransferInfo;      // Source chain info
  receiving?: TransferInfo;   // Destination chain info
  status: StatusType;         // Current status
  substatus?: SubstatusType;  // Detailed status (when DONE)
  tool: string;               // Bridge used
  error?: string;             // Error message (if failed)
}

type StatusType = "NOT_FOUND" | "PENDING" | "DONE" | "FAILED";
type SubstatusType = "COMPLETED" | "PARTIAL" | "REFUNDED";

Status State Machine

NOT_FOUND → PENDING → DONE (COMPLETED | PARTIAL | REFUNDED)
                   ↘ FAILED
StatusSubstatusMeaning
NOT_FOUND-Transaction not indexed yet
PENDING-Transfer in progress
DONECOMPLETEDSuccess - got requested token
DONEPARTIALSuccess - got different token
DONEREFUNDEDFailed - tokens returned
FAILED-Permanent failure

Enums

Order

Route ordering preference.
type Order = "FASTEST" | "CHEAPEST";
ValueDescription
FASTESTLowest execution time
CHEAPESTLowest total fees

ChainType

Blockchain architecture type.
type ChainType = "EVM" | "SVM" | "UTXO" | "MVM";
ValueDescriptionExamples
EVMEthereum Virtual MachineEthereum, Arbitrum, Polygon
SVMSolana Virtual MachineSolana
UTXOBitcoin-styleBitcoin
MVMMove Virtual MachineSui

Request Parameter Formats

Address Format

Pattern: ^0x[a-fA-F0-9]{40}$
Example: 0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0

Amount Format

Amounts are always in the smallest unit (wei for ETH, 6 decimals for USDC):
Format: String containing non-negative integer
Example: "10000000" (10 USDC)

Slippage Format

Decimal between 0 and 1:
Format: Number (decimal)
Example: 0.005 (0.5%)
Range: 0.001 to 0.5

Transaction Hash Format

Pattern: ^0x[a-fA-F0-9]{64}$
Example: 0xabc123...def456 (66 characters total)

Validation Rules

Quote Request

const quoteValidation = {
  fromChain: {
    type: 'integer',
    required: true,
    min: 1
  },
  toChain: {
    type: 'integer', 
    required: true,
    min: 1
  },
  fromToken: {
    type: 'string',
    required: true,
    pattern: /^(0x[a-fA-F0-9]{40}|[A-Z0-9]+)$/  // Address or symbol
  },
  toToken: {
    type: 'string',
    required: true,
    pattern: /^(0x[a-fA-F0-9]{40}|[A-Z0-9]+)$/
  },
  fromAmount: {
    type: 'string',
    required: true,
    pattern: /^[0-9]+$/,  // Positive integer string
    min: '1'
  },
  fromAddress: {
    type: 'string',
    required: true,
    pattern: /^0x[a-fA-F0-9]{40}$/
  },
  slippage: {
    type: 'number',
    required: false,
    default: 0.005,
    min: 0.001,
    max: 0.5
  }
};

OpenAPI Reference

Full OpenAPI specification is available at:
  • Spec URL: https://li.quest/v1/docs-json
  • Swagger UI: https://apidocs.li.fi/
Download and parse the spec for complete schema definitions:
curl "https://li.quest/v1/docs-json" > lifi-openapi.json