> ## Documentation Index
> Fetch the complete documentation index at: https://docs.li.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Request for Quote (RFQ)

> Answer live quote requests over a WebSocket next to your published quotes.

Next to your [published quotes](https://docs.li.fi/lifi-intents/for-solvers/quoting.md), 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](https://docs.li.fi/lifi-intents/for-solvers/orderflow.md) 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](https://li.fi/contact-us/).

By default you get RFQs on every chain. To limit them, set your chain list with [`PUT /api/v1/solver/rfq/chains`](https://order.li.fi/docs#tag/solver-api-v1/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.

```json theme={"system"}
{ "chains": ["eip155:42161", "eip155:8453"] }
```

## Connecting

```txt theme={"system"}
wss://order.li.fi/rfq        production
wss://order-dev.li.fi/rfq    development
x-api-key: <solver API key>
```

* Use the same API key as for the [Solver API](https://docs.li.fi/lifi-intents/authentication.md#solvers-api-key-required). 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:

| Code | Meaning |
| - | - |
| `1001` | The server is restarting. Reconnect right away. |
| `1008` | The key is revoked, expired or not active yet, the IP is not allowed, there are too many sockets, or a message was invalid. The close reason says which, so fix it before you reconnect. |
| `1009` | A message you sent was over 16 KiB. |

## Messages

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

| Event | Direction |
| - | - |
| `rfq:request` | Order server to solver |
| `rfq:quote` | Solver to order server |
| `rfq:no-quote` | Solver to order server |
| `rfq:rejected` | Order server to solver, only when an answer is not accepted |

### 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.

```json Exact input theme={"system"}
{
  "event": "rfq:request",
  "data": {
    "version": 1,
    "requestId": "d71c7a10-2368-4be0-b203-6c5e763d63da",
    "responseDeadline": 1791800400250,
    "swapType": "exact-input",
    "fromChain": "eip155:42161",
    "fromAsset": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
    "toChain": "eip155:8453",
    "toAsset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "user": "0x742d35cc6634c0532925a3b844bc9e7595f0beb8",
    "receiver": "0x742d35cc6634c0532925a3b844bc9e7595f0beb8",
    "inputAmount": "2500000000",
    "minValidUntil": 1791800430,
    "acceptedOraclePairs": [
      {
        "inputOracle": "0xa70fe63dd97e8e0cb37241ed231fcbca87e99b72",
        "outputOracle": "0xa70fe63dd97e8e0cb37241ed231fcbca87e99b72"
      }
    ]
  }
}
```

```json Exact output theme={"system"}
{
  "event": "rfq:request",
  "data": {
    "version": 1,
    "requestId": "8e1f4c52-9a1b-4d35-8f0e-2b6f0a7c9d11",
    "responseDeadline": 1791800400250,
    "swapType": "exact-output",
    "fromChain": "eip155:42161",
    "fromAsset": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
    "toChain": "eip155:8453",
    "toAsset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "user": "0x742d35cc6634c0532925a3b844bc9e7595f0beb8",
    "receiver": "0x742d35cc6634c0532925a3b844bc9e7595f0beb8",
    "outputAmount": "2500000000",
    "exclusiveFor": ["0x5555555555555555555555555555555555555555"]
  }
}
```

**requestId** `string` *required*

UUID of the request. Every answer carries it.

**responseDeadline** `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.

**swapType** `string` *required*

`exact-input` or `exact-output`.

**fromChain** `string` *required*

Source chain as CAIP-2, for example `eip155:42161`.

**toChain** `string` *required*

Destination chain as CAIP-2. The same as `fromChain` on a same-chain swap.

**fromAsset** `string` *required*

Asset on `fromChain`, in the native format of that chain, for example `T...` on Tron and base58 on Solana.

**toAsset** `string` *required*

Asset on `toChain`, in the native format of that chain.

**user** `string` *required*

The user's address, in the format of `fromChain`.

**receiver** `string` *required*

The address that receives the output, in the format of `toChain`.

**inputAmount** `string`

Integer string in base units, without decimals. Sent on `exact-input` requests only.

**outputAmount** `string`

Integer string in base units, without decimals. Sent on `exact-output` requests only.

**minValidUntil** `number`

Unix seconds. Your quote has to be valid at least until this.

**exclusiveFor** `string[]`

Your registered accounts the user accepts. Your quote has to name one of them.

**acceptedOraclePairs** `object[]`

Cross-chain only. The oracle pairs the user accepts.

**properties**

**inputOracle** `string` *required*

Oracle on `fromChain`.

**outputOracle** `string` *required*

Oracle on `toChain`.

### rfq:quote

```json Exact input theme={"system"}
{
  "event": "rfq:quote",
  "data": {
    "version": 1,
    "requestId": "d71c7a10-2368-4be0-b203-6c5e763d63da",
    "inputAmount": "2500000000",
    "outputAmount": "2498120000",
    "validUntil": 1791800460
  }
}
```

```json Exact output theme={"system"}
{
  "event": "rfq:quote",
  "data": {
    "version": 1,
    "requestId": "8e1f4c52-9a1b-4d35-8f0e-2b6f0a7c9d11",
    "inputAmount": "2501880000",
    "outputAmount": "2500000000",
    "validUntil": 1791800460,
    "exclusiveFor": "0x5555555555555555555555555555555555555555",
    "oraclePair": {
      "inputOracle": "0xa70fe63dd97e8e0cb37241ed231fcbca87e99b72",
      "outputOracle": "0xa70fe63dd97e8e0cb37241ed231fcbca87e99b72"
    }
  }
}
```

**requestId** `string` *required*

The `requestId` of the request you answer.

**inputAmount** `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.

**outputAmount** `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.

**validUntil** `number` *required*

Unix seconds. When your quote expires. At least `minValidUntil`, and after `responseDeadline`.

**exclusiveFor** `string`

Your registered account that gets [exclusivity](https://docs.li.fi/lifi-intents/for-solvers/auctions.md#exclusive-limit-order) 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.

**oraclePair** `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.

**properties**

**inputOracle** `string` *required*

Oracle on `fromChain`.

**outputOracle** `string` *required*

Oracle on `toChain`.

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

```json theme={"system"}
{
  "event": "rfq:no-quote",
  "data": {
    "version": 1,
    "requestId": "d71c7a10-2368-4be0-b203-6c5e763d63da"
  }
}
```

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:

```json theme={"system"}
{
  "event": "rfq:rejected",
  "data": {
    "version": 1,
    "requestId": "8e1f4c52-9a1b-4d35-8f0e-2b6f0a7c9d11",
    "reason": "INVALID_RESPONSE",
    "issues": [
      {
        "path": "outputAmount",
        "message": "must equal the requested output amount 2500000000"
      }
    ]
  }
}
```

| Reason | When | Can answer again |
| - | - | - |
| `INVALID_RESPONSE` | The answer was not accepted. `issues` lists up to 10 problems, or asks you to send it again. | Yes, before the deadline, up to 5 invalid answers per request and socket |
| `RESPONSE_DEADLINE_EXCEEDED` | The answer arrived after `responseDeadline`. | No |
| `ALREADY_ANSWERED` | A different answer was already accepted, for example from another socket. | No |
| `REQUEST_CLOSED` | The request already ended. | No |
| `UNKNOWN_REQUEST` | Unknown or expired `requestId`. | No |

An answer without a usable `requestId` closes the socket with `1008`, since there is nothing to reject.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.