Skip to main content
This page provides a complete, copy-paste ready workflow for AI agents to execute cross-chain transfers using just 5 API calls.

The Five Calls


Call 1: Get Supported Chains

Discover which blockchains LI.FI supports.

Request

Response

What to Extract


Call 2: Get Tokens for Chains

Find which tokens are available on specific chains.

Request

Response

What to Extract

You can use token symbols (e.g., USDC) instead of addresses in the quote request - the API resolves them automatically.

Call 3: Get a Quote

Request a quote for the transfer. This returns transaction data ready to execute.

Request

Parameters

Response

What to Extract


Call 4: Execute the Transaction

Before executing, ensure the user has approved the token transfer if using an ERC20 token. Check if fromToken is native (ETH) or ERC20, and verify allowance.

Approval Check (if ERC20)

If fromToken.address is NOT 0x0000000000000000000000000000000000000000:
  1. Call allowance(fromAddress, approvalAddress) on the token contract
  2. If allowance < fromAmount, send an approve(approvalAddress, amount) transaction first

Execute Transaction

Sign and send the transactionRequest object from the quote response:

What to Save

  • txHash - Transaction hash for status polling (required)
  • fromChain - Source chain ID (optional, speeds up status check)
  • toChain - Destination chain ID (optional)
  • tool - From the quote response (optional)

Call 5: Poll Transfer Status

Check the status of the cross-chain transfer until it completes.

Request

Parameters

Only txHash is required. The other parameters are optional but providing fromChain speeds up the request.

Response

Status Values

Substatus Values (when DONE)

Polling Strategy


Complete Flow Diagram


Quick Reference