Skip to main content

API status codes

API status code is the code returned by the server like 200, 404, 429, 500, 502.

API error codes

API returns the following set of error codes:
  • DefaultError = 1000,
  • FailedToBuildTransactionError = 1001,
  • NoQuoteError = 1002,
  • NotFoundError = 1003,
  • NotProcessableError = 1004,
  • RateLimitError = 1005,
  • ServerError = 1006,
  • SlippageError = 1007,
  • ThirdPartyError = 1008,
  • TimeoutError = 1009,
  • UnauthorizedError = 1010,
  • ValidationError = 1011,
  • RpcFailure = 1012,
  • MalformedSchema = 1013,

Route-wide slippage errors

Requests with slippageScope=route can fail with one of these reasons. The reason is the stable prefix of the error message (for example ROUTE_SLIPPAGE_FLOOR_UNREACHABLE: <detail>), or of reason in filteredOut for routes that were left out: See Route-wide Slippage for when each one occurs and how to handle it.

Tool errors

In addition to status and error codes, the API can return errors from the underlying tools (bridges and exchanges) that explain why each one couldn’t provide a quote. Reasons range from the tool not supporting the token pair to insufficient liquidity.

Response structure

When no route is available, the API responds with HTTP 404 and error code 1002 (NoQuoteError). The errors field of the response body is an object with two arrays:
  • errors.filteredOut[]: routes that were found but removed by LI.FI’s checks. Each entry has an overallPath and a free-text reason.
  • errors.failed[]: routes where one or more tools returned no quote. Each entry has an overallPath and a subpaths object that maps each hop of the route to the ToolError entries for that hop.
Every endpoint that returns a 1002 uses this structure, for example GET /v1/quote, GET /v1/quote/toAmount and POST /v1/quote/contractCalls. POST /v1/advanced/routes returns the same object as unavailableRoutes. Paths name each token as chainId:symbol. A swap is written 10:USDC~10:USDT, a bridge 1:USDC-across-10:USDC, and a multi-step path joins its hops with -, for example 1:USDC-across-10:USDC-10:USDC~10:USDT. Some 1002 responses have no errors field, or empty arrays, for example when no route could be attempted at all. The types are exported by @lifi/types:
Read code and tool programmatically. message and reason are free text and can change.

Possible codes:

NO_POSSIBLE_ROUTE: No route was found for this action. INSUFFICIENT_LIQUIDITY: The tool’s liquidity is insufficient. TOOL_TIMEOUT: The third-party tool timed out. UNKNOWN_ERROR: An unknown error occurred. RPC_ERROR: There was a problem getting on-chain data. Please try again later. AMOUNT_TOO_LOW: The initial amount is too low to transfer using this tool. AMOUNT_TOO_HIGH: The initial amount is too high to transfer using this tool. FEES_HIGHER_THAN_AMOUNT: The fees are higher than the initial amount — this would result in a negative resulting token. DIFFERENT_RECIPIENT_NOT_SUPPORTED: This tool does not support different recipient addresses. TOOL_SPECIFIC_ERROR: The third-party tool returned an error. CANNOT_GUARANTEE_MIN_AMOUNT: The tool cannot guarantee that the minimum amount will be met. RATE_LIMIT_EXCEEDED: The tool has exceeded its rate limit. TOOL_NOT_ALLOWED: The tool in this quote is not allowed by LI.FI contracts. Please report this to the LI.FI team. PRICE_IMPACT_TOO_HIGH: The tool cannot provide a route due to high price impact. INSUFFICIENT_BALANCE: The wallet does not have sufficient balance to complete this transaction. UNSUPPORTED_LIQUIDITY_SOURCE: One or more of the requested liquidity sources is not supported by this tool.

Example response: