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 dexHash to POST /swap to get transaction calldata from the same liquidity source. Sign quotes with an API key of the partner account. A child account of a partner can’t call this endpoint: it gets 403 FORBIDDEN.

Units

Single-chain and cross-chain bodies

  • Single-chain bodies use chainId, inTokenAddress and outTokenAddress, and require gasPrice. The optional orderBy, gasMultiplier and excludeMetaAggregatorId apply only here. excludeMetaAggregatorId takes source IDs, not dexHash values: a hash there is ignored, like any unknown ID. See Liquidity sources.
  • 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.
  • A cross-chain quote names its provider in dexHash: build the swap with the dexHash the quote returns rather than a stored one.
  • 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.
  • The quote carries no gas fee estimate. gasMultiplier is accepted and echoed in quote.gasMultiplier, but it changes nothing in the response: estimatedGas is the same for every value. To size a limit order’s allowance, estimate the execution fee from estimatedGas as described in Create a limit order.
  • 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.

The route identifier

quote.dexHash identifies the liquidity source that produced the winning route. It is the Keccak-256 hash of the source’s display name, written as 0x and 64 lowercase hex digits. Pass it unchanged as params.dexHash to POST /swap:
  • It names the source, not the quote. The same source always has the same dexHash, so you can store it and compare it.
  • Copy it exactly. Uppercase hex fails with 400 VALIDATION_ERROR ("dexHash must be a lowercase 32-byte hex value"). A hash Olympex doesn’t know, or a single-chain hash sent on a cross-chain swap (or the reverse), fails with 400 VALIDATION_ERROR ("Unknown or disabled dexHash").
  • aggregatorOrder lists the fallbacks. On single-chain quotes, it holds the dexHash of every source that quoted, best first, starting with quote.dexHash. If the swap with the winning source fails, build it with the next one. Each source prices the trade separately, so check the new outAmount and minOutAmount before you use a fallback.
  • market names sources when it can. Each entry has dexName, dexHash, swapAmount (output in base units) and dexImageURL. It is often empty: don’t rely on it to find a source’s name.

Liquidity sources

Single-chain quotes compare several DEX aggregators and DEXes, and which ones quote varies by chain and over time. Read the dexHash values in each quote’s aggregatorOrder instead of assuming a source. To leave sources out, pass their IDs in excludeMetaAggregatorId: the API doesn’t return IDs. Olympex shares the source IDs on request: contact partners@olympex.io.

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.
  • subRoutes[].dexes[].name is the DEX that executes that hop, such as POLYGON_UNISWAP_V3, not the liquidity source.
On cross-chain quotes, middlewareRoute lists the swaps around the bridge: chainFrom on the source chain and chainTo on the destination chain. Each entry has a fromAsset and a toAsset, each with address, decimals and symbol. Either list can be empty, and any of these fields can be null. A native token can appear 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. Olympex charges the fee in the signed request body: no fee is stored on the account. A child account of a partner can't call POST /quotes or POST /swap: it gets 403 FORBIDDEN, and the partner account signs quotes and swaps instead.

Response

Quote generated. data.mode matches the request.

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