Skip to main content
Next to your published quotes, the order server can also ask you for a price on each quote request. You get the request over a WebSocket, answer before its deadline, and your answer competes with every other quote for that request.

How it works

  1. A user asks LI.FI for a quote.
  2. The order server sends rfq:request to the solvers it selects for the route.
  3. You answer with rfq:quote or rfq:no-quote before the request’s responseDeadline passes.
  4. For each solver, the order server takes its valid RFQ quote, or its published quote when it sent none. It ranks these across solvers, and the best one goes back to the user.
  5. If the user goes ahead, the order is opened with your amounts. You get it through the order stream and fill it like any other order.
The order server ranks one quote per solver for each request:
  • If you send a valid rfq:quote, it ranks that quote, even when your published quote is better.
  • If you send rfq:no-quote, an invalid answer or nothing, it ranks your published quote.

Getting access

Only approved solvers receive RFQs. To get approved, contact the LI.FI team. By default you get RFQs on every chain. To limit them, set your chain list with PUT /api/v1/solver/rfq/chains. You get a request only when both its source and destination chain are on the list. Send the complete list each time, or an empty list to get every chain again.

Connecting

  • Use the same API key as for the Solver API. A missing or invalid key gets a 401 on connect.
  • You can open up to 4 sockets. Each request goes to all of them and the first accepted answer counts.
  • The heartbeat works like on the order stream. The server sends {"event": "ping"} every 5 seconds, so reply with {"event": "pong"} or a WebSocket pong within 10 seconds or the socket is closed.
  • Messages you send are capped at 16 KiB.
  • A revoked or expired key closes its sockets within about 30 seconds.
Close codes:

Messages

Every RFQ message is a JSON object with an event name and a data payload. The payload always includes "version": 1.

rfq:request

The same route and amount can come again, for example while a user keeps a quote open. Treat each requestId as a new RFQ.
string
required
UUID of the request. Every answer carries it.
number
required
Unix milliseconds. Your answer has to reach us before this. We check it on our side, so leave some margin for the network. You usually get a few hundred milliseconds.
string
required
exact-input or exact-output.
string
required
Source chain as CAIP-2, for example eip155:42161.
string
required
Destination chain as CAIP-2. The same as fromChain on a same-chain swap.
string
required
Asset on fromChain, in the native format of that chain, for example T... on Tron and base58 on Solana.
string
required
Asset on toChain, in the native format of that chain.
string
required
The user’s address, in the format of fromChain.
string
required
The address that receives the output, in the format of toChain.
string
Integer string in base units, without decimals. Sent on exact-input requests only.
string
Integer string in base units, without decimals. Sent on exact-output requests only.
number
Unix seconds. Your quote has to be valid at least until this.
string[]
Your registered accounts the user accepts. Your quote has to name one of them.
object[]
Cross-chain only. The oracle pairs the user accepts.

rfq:quote

string
required
The requestId of the request you answer.
string
required
Final input amount as a positive integer string in base units, up to 78 digits. On an exact-input request it must equal the requested amount.
string
required
Final output amount as a positive integer string in base units, up to 78 digits, with your gas costs and fees included. On an exact-output request it must equal the requested amount.
number
required
Unix seconds. When your quote expires. At least minValidUntil, and after responseDeadline.
string
Your registered account that gets exclusivity on the order, in the format of fromChain. Required when the request lists accounts. Otherwise you can name any of your registered accounts, or none.
object
Cross-chain only, so leave it out on a same-chain swap. Leave it out to use the default pair of the route, which then has to be in acceptedOraclePairs when the request lists them. A pair you name must belong to the route.
Each request takes one answer from you, either rfq:quote or rfq:no-quote. Sending the same answer again is ignored. A different second answer gets ALREADY_ANSWERED.

rfq:no-quote

Sending it is optional, but it lets the request close sooner.

rfq:rejected

You get no reply when your answer is accepted. When it is not, you get:
An answer without a usable requestId closes the socket with 1008, since there is nothing to reject.