Skip to main content
POST
POST /quotes returns the best route Olympex finds across its liquidity sources for a swap on one chain (mode: "single-chain") or a transfer between two chains (mode: "cross-chain"). Pass the returned aggregatorId to POST /swap to get transaction calldata from the same liquidity source.

Units

Single-chain and cross-chain bodies

  • Single-chain bodies use chainId, inTokenAddress and outTokenAddress, and require gasPrice. The optional includeGasInfo, orderBy, gasMultiplier and excludeMetaAggregatorId apply only here.
  • Cross-chain bodies use fromChainId, toChainId, inTokenAddress and outTokenAddress, the same token fields as single-chain bodies. Unknown top-level keys are rejected with 400.
  • Signed requests from API accounts receive cross-chain routes from okx or rango.
  • Every quote carries integratorFeeBreakdown. protocolFeeBps is the Olympex protocol fee in basis points (15 is 0.15%) and can be fractional, and it applies even when you send no fees. Add fees to charge your own integrator fee: integratorMarginBps then equals fees.feeBps. Liquidity sources can also charge their own fees inside the route: those are already reflected in outAmount and aren’t part of integratorFeeBreakdown. The 200 With integrator fee example adds "fees": {"feeBps": 25, "feeRecipient": "0x1E67cb01969D79B2B895179e4A07D24a839dBb52"} to the single-chain body. See Gas and fees.
  • "includeGasInfo": true adds dataFeeTransaction. For a limit order, quote the same pair and amount this way: transactionFeeInToken estimates the execution gas cost in the token sold, which the maker’s allowance must cover on top of amount. The estimate leaves out the Olympex contracts’ gas, so add a buffer to valueToApprove before you approve it. See Order signatures and allowances.
  • A pair and amount that no source can route returns 422 NO_ROUTE, on single-chain and cross-chain quotes. It can be temporary: retry later with backoff, or change the amount or the pair.
A quote is not reserved. Prices move between the quote and the swap, so request the swap right after the quote and protect it with slippage.

Routes

On single-chain quotes, routes shows the path as the source reports it. Use it for display only:
  • routes[].percentage is the value the source reports. The values don’t always sum to 100, because later hops can appear as separate routes at 100.
  • subRoutes[].from and to are token addresses as the source reports them. Case and the native-token address (0xeeee… or the zero address) vary by source, so compare addresses case-insensitively.
On cross-chain quotes, middlewareRoute can also show a native token as 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE or as the zero address, depending on the provider. Treat both as native.

Authorizations

x-api-key-id
string
header
required

Your API key ID (UUID). See Sign requests.

x-value-info
string
header
required

Base64 of timestamp + "\n" + nonce + "\n" + bodyHash, where timestamp is Unix seconds, nonce is 24 new hexadecimal characters and bodyHash is the unpadded base64url SHA-256 of the canonical body.

x-passphrase
string
header
required

Your account passphrase. Treat it like the secret key.

x-signature
string
header
required

Lowercase hex HMAC-SHA256 (signature v2), keyed with your secret key string (UTF-8, not decoded), of seven lines joined with \n, with no trailing newline: OLPX-HMAC-SHA256-V2, timestamp, nonce, the uppercase method, path, canonicalQuery and bodyHash. path is the request path including /api/v1, without the query string, for example /api/v1/limit-order/<id>. canonicalQuery is the query parameters decoded (+ is a space), sorted by key and then by value, re-encoded per RFC 3986 and joined with &, or the empty string when there is no query. Headers signed for one request are rejected on any other. See Sign requests.

Body

application/json
mode
enum<string>
required
Available options:
single-chain
params
object
required
fees
object

Your integrator fee. It appears in integratorFeeBreakdown.integratorMarginBps and integratorMarginAmount.

Response

Quote generated. data.mode matches the request.

success
enum<boolean>
required
Available options:
true
data
Single-chain · object
required
meta
object
required