Skip to main content
This guide integrates Composer through the LI.FI REST API, for backend services or custom frontends that build and send transactions themselves. If you use the LI.FI SDK or Widget, Composer works without this guide. To author multi-step flows explicitly, use the Composer API.

Authentication

The LI.FI API works without an API key. A key raises your rate limits; see Rate Limits for the current values.
  • integrator (optional query parameter): identifies your application in analytics and onchain events. Defaults to "lifi-api". Letters, numbers, hyphens, underscores and dots; at most 23 characters.
  • x-lifi-api-key (optional header): created with an integration in the LI.FI partner portal. Keep it server-side.
For details, see Authentication.

How Composer is selected

Composer needs no dedicated endpoint. Set toToken to a supported position-token address and the routing engine adds a Composer route to the candidates it compares with DEX and bridge routes. A quote for a vault token may therefore use a DEX that buys the token directly. See Identifying Composer routes.

Request a Composer quote

Returns the best route with transaction data included.

Slippage

The slippage parameter is a decimal value representing the maximum acceptable price difference. For example, 0.005 means 0.5%. The quote’s estimate.toAmountMin is estimate.toAmount reduced by this tolerance. A same-chain transaction that would deliver less than toAmountMin reverts. If you omit slippage, LI.FI picks a route-dependent value, and it can differ between same-chain and cross-chain routes. Read the applied value from action.slippage in the response. Set slippage explicitly when your UI shows or enforces a tolerance.

Using POST /advanced/routes

Returns several route options, for example to let the user choose.
/advanced/routes does not include transaction data. Call POST /v1/advanced/stepTransaction to get the transactionRequest for each step.

Getting transaction data for a route step

TypeScript
For a detailed comparison, see Difference between Quote and Route.

Quote response structure

The example below is a same-chain quote that Composer won, requested with slippage=0.005, trimmed to the fields this guide uses. For every field, see Get a quote.

Key fields

Contract addresses

estimate.approvalAddress and transactionRequest.to both point to the audited LI.FI Diamond contract. On most EVM chains, including Ethereum, Base and Arbitrum, its address is 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE. Some chains use a different deployment, so always approve and send to the addresses returned in the quote. For audit reports, see Security and Audits.
If the user reviews a quote for more than 30 seconds, re-fetch it before signing to get current pricing and simulation results.

Morpho vault naming

Morpho vault tokens carry their curator’s name. For example, 0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A returns symbol: "sparkUSDC" because Spark curates this Morpho vault.

Set token allowance

Approve estimate.approvalAddress to spend the input token. Skip this step if fromToken is a native token such as ETH. The samples assume server-side signing: walletClient is created with a local account (for example via privateKeyToAccount), so walletClient.account is defined. With a browser-injected wallet, get the address from walletClient.getAddresses() instead.
If an approval transaction was sent, re-fetch the quote with the same parameters before executing. The gas estimates in the original transactionRequest can be stale by the time the approval confirms.

Send the transaction

Submit the transactionRequest from the quote as a standard EVM transaction.

Track status

A same-chain Composer transaction is complete once it confirms. For a cross-chain route, poll GET /v1/status until the status is DONE or FAILED. DONE with substatus PARTIAL means the bridge delivered but the destination deposit did not run: the user holds the bridged token on the destination chain instead of the vault token. See Cross-chain deposits for the polling sample and PARTIAL handling, and Transaction Status Tracking for every status value.

Error handling

For the full error reference, see Error Codes.

Next steps

Cross-chain deposits

Bridge and deposit, and handle PARTIAL outcomes

Error Handling

Read per-tool failure reasons and handle simulation failures