REST API
This page explains how solvers can interact with the Liquorice RFQ REST API.
1. Authentication
Include the following header with each request:
Authorization: Basic <base64(solver:token)>
2. View connected makers
Use the following endpoint to retrieve a list of currently connected makers:
URL: https://api.liquorice.tech/v1/solver/connected-makers
Method: GET
Response:
[
"maker-a",
"maker-b"
]3. Obtain list of supported tokens
Use the following endpoint to retrieve a list of currently supported tokens:
URL: https://api.liquorice.tech/v1/solver/supported-tokens?chainId=<string>
Method: GET
Response:
4. Query price levels
To understand indicative prices and available liquidity, we expose price levels for the different market makers.
This step will allow you to do price discovery before requesting signed quotes.
URL: https://api.liquorice.tech/v1/solver/price-levels?chainId=<string>
Method: GET
Response:
Assuming that trader wants to swap 2 WETH for USDC, the maker would be buying 0.5 WETH for 2999.5 USDC, 1 WETH for 3000.5 USDC, and another 0.5 WETH for 3002.0 USDC
5. RFQ
To obtain a quote from Liquorice, send an RFQ to the following endpoint:
URL: https://api.liquorice.tech/v1/solver/rfq
Method: POST
Body:
The RFQ must include either
baseTokenAmountorquoteTokenAmount, but not both. WhenbaseTokenAmountis specified, thetrader(order initiator) is requesting the amount ofquoteTokenthey would receive in exchange for a specific amount ofbaseToken. WhenquoteTokenAmountis specified, thetrader(order initiator) is requesting the amount ofbaseTokenthey need to provide to receive a specific amount ofquoteToken.excludedMakers- to exclude specific makers from RFQ processing, obtain the complete maker list from the relevant API endpointintentMetadata- For the moment, only CoW Protocol is supported. Omit this setting when requesting quotes for other intent origins.
Response
Market makers can provide multiple quote levels with different amounts, but the quoted amounts will not exceed those specified in the RFQ.
Example For an RFQ where:
baseToken = ETH
quoteToken = USDT
baseTokenAmount = 1 ETH
The resulting quote may contain these levels:
Level 0: Exchange 1 ETH for 3,000 USDT
Level 1: Exchange 0.5 ETH for 1,502 USDT
Level 2: Exchange 0.1 ETH for 310 USDT
IMPORTANT NOTE: While solvers typically execute a single quote level, it is technically possible to execute multiple quote levels if they come from different market makers. When using multiple quote levels, ensure that they come from different makers, as quotes from the same maker will result in only one successful execution.
Error handling
When the application cannot return any quote levels, the response is still HTTP 200, but an error object is set.
It has three fields: category (service or client), reason (a stable, machine-readable identifier — branch on this), and message (human-readable detail for logs).
service means the request is valid but the application or its maker network can't fulfill it right now — retrying later may help. client means the request violates a business rule and must be fixed before retrying.
Possible reason values:
makers_unavailable(service) — no makers are connected, or the RFQ could not be dispatched to any eligible maker.quote_deadline(service) — the RFQ was dispatched, but no maker returned a usable quote before the deadline.invalid_request(client) — payload failed domain validation (expiry, amounts,baseToken == quoteToken, etc.); seemessage.unsupported_token(client) —baseTokenorquoteTokenis not supported on thischainId.effective_trader_not_whitelisted(client) — the effective trader is not whitelisted on this chain.no_eligible_price_levels(client) — no connected maker has price levels covering this pair/amount; consult price levels first.all_makers_excluded(client) — every connected maker is inexcludedMakers.
5.1. Partial fills
The quote level's partialFill.offset field specifies the byte offset of filledTakerAmount parameter within tx.data.
The partial fill amount must be greater than or equal to partialFill.minBaseTokenAmount.
If the partialFill field is not present, the quote level must be filled completely.
Last updated