Requests
Methods
A method that a path doesn’t support returns
404 NOT_FOUND, with a message that names the method and path, for example DELETE on a DCA strategy ("No route for DELETE /api/v1/dca-order/strategies/…"): cancel a strategy with PATCH instead. The service’s own GET /openapi.json and GET /docs are public.
Bodies and signing
Content-Type: application/jsonon every request, includingGET,DELETEand the public endpoints. Without it, or with another type such as curl’s defaultapplication/x-www-form-urlencoded, the gateway base64-encodes a body before Olympex reads it, and the request fails with403(Invalid body hash) on a signed endpoint or400(Invalid JSON body) on a public one.- UTF-8. Encode the body as UTF-8 JSON.
- Send the bytes you signed. On
POSTandPATCH, serialize the body once as canonical JSON (keys sorted at every level, no whitespace), hash that string, and send the same string. Sign requests has the algorithm and reference code. - Sign the empty string when there is no body.
GETandDELETEsend no body, and the signature covers the empty string: itsbodyHashis47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU. - The signature covers the whole request: the method, the path (including
/api/v1), the canonical query and the body hash, with the timestamp and the nonce. Headers signed for one request are rejected on any other. Sign right before you send, and never log or share the headers. - Sign every attempt. Each signature carries a nonce, which the server rejects if it has seen it in the last 5 minutes, and a timestamp it accepts within ±300 seconds of its own clock. The nonce makes each set of headers usable once. A retry needs a new signature, and your server clock must stay synchronized.
Response envelope
Every endpoint wraps its result in the same envelope, whatever its method. The exceptions are gateway responses and the service’s ownGET /openapi.json and GET /docs, which return the raw spec and an HTML page. Every success is HTTP 200, including creates (POST) and cancels (DELETE).
success, never on the value of data: POST /support-chain returns "success": true with "data": false for an unsupported chain, and a list with no matches returns "data": [].
Amounts
Amounts you send are human-readable decimals:"10" is 10 USDT, and Olympex resolves the token’s decimals itself. Most amounts you receive from quotes and swaps are integer strings in the token’s base units: the human-readable amount multiplied by 10 to the power of the token’s decimals. Limit order and DCA amounts stay human-readable in both directions.
Values you send
To turn a gas price in wei from your RPC into the quote and swap hint, round up to whole gwei, for example
((gasPriceWei + 999_999_999n) / 1_000_000_000n).toString() with a bigint. Below 1 gwei this gives "1": the hint is then higher than the chain’s gas price, and your wallet or signer still sets the gas price of the transaction you send. A limit order’s gasPrice is a decimal string, so it can carry a fraction, for example "0.05".
Quote, swap and limit-order amounts, prices and slippage are decimal strings: quotes and swaps reject a JSON number in these fields with 400 VALIDATION_ERROR. DCA’s totalAmount, slippage, minPrice and maxPrice must be JSON numbers: a string returns 400. The reference signers canonicalize numbers the way JavaScript does, so fractional values such as a minPrice of 0.00025 sign correctly. If you write your own signer in another language, format numbers exactly as JavaScript’s JSON.stringify does (1.0 becomes 1, 1e21 becomes 1e+21, 0.0000001 becomes 1e-7), and keep integers within ±(253 − 1). See Portability rules.
Values you receive
To display a base-unit amount, divide by 10 to the power of the token’s decimals with integer or decimal arithmetic. Take
decimals from GET /tokens, or read decimals() from the token contract. Cross-chain quotes also report decimals for each asset listed in middlewareRoute.
Addresses
-
Addresses are accepted in lowercase or EIP-55 checksum form, as
0xand 40 hex digits. A mixed-case address whose checksum is wrong returns400 VALIDATION_ERRORwith the detail"Must be a valid EVM address", which catches most typos. -
The chain’s native token uses this pseudo-address wherever a token address is expected, in either casing:
GET /tokenslists it in lowercase,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, so compare it case-insensitively. -
Limit orders and DCA strategies can’t sell the native token:
inTokenAddressandtokenAddressFrommust be ERC-20 tokens. Use the wrapped token, for example WETH, WBNB or WPOL. - Olympex resolves token decimals server-side. You never send them.
-
Responses don’t normalize addresses.
GET /tokensreturns addresses in varying case. On single-chain quotes,routes[].subRoutes[].fromandtoare token addresses as the source reports them: case varies, and the native token can appear as0xeeee…or the zero address.middlewareRoutecan use checksummed addresses in the same quote, and can show a native token as the pseudo-address or the zero address, depending on the provider. Compare addresses case-insensitively. -
Limit orders and DCA strategies store the maker’s
accountToexactly as you send it, and the?accountTo=list filters match case-sensitively. Always send the EIP-55 checksummed form. -
feeRecipientcan’t be the zero address.
Chain IDs
Chain IDs are standard EVM chain IDs, sent and returned as JSON integers on every endpoint:137, not "137". A string in a request body returns 400 VALIDATION_ERROR, and so does a non-numeric ?chainId= on GET /tokens or GET /transactions/{hash}. The ?chainId= filter of GET /limit-order isn’t validated: a value that isn’t a number returns an empty array.
400 String sent to /support-chain
GET /chains returns every enabled chain ID. Supported chains lists them by name.
IDs
- Olympex assigns every ID. Limit order and DCA strategy IDs are UUIDs, for example
afc47108-d059-473c-b2e1-5f2ca7951466. DCA order IDs are strings that Olympex creates as a strategy runs. Treat every ID as an opaque string, and pass it in the path:/limit-order/{id}. - IDs are scoped to your API key. A limit order or DCA strategy belongs to the API key that created it, and a DCA order belongs to its strategy’s key. Lists return only your key’s resources. An ID that doesn’t exist or belongs to another API key returns
404 NOT_FOUND. - Keep the key with the ID. If you use more than one API key, store which key created each order or strategy.
meta.apiKeyIdin the create response names it.
Booleans and enums
- Booleans are JSON
trueandfalse. The string"true"is rejected. - Enum values are case-sensitive.
modeis"single-chain"or"cross-chain";orderByandgasMultipliervalues are uppercase, for example"MAX_OUT_AMOUNT"and"MEDIUM". - Limit order, DCA strategy and DCA order statuses are lowercase, for example
"pending"and"cancelled". Each endpoint page lists the values.
400 String boolean and lowercase enum
Optional and empty fields
- An optional response field can be missing or
null. Treat both as “not provided”. integratorFeeBreakdownis present on every quote. It reports the Olympex protocol fee, which applies even when you don’t sendfees, and your fee:integratorMarginBpsequalsfees.feeBps, and is0when you don’t sendfees.dataFeeTransactionappears only when the single-chain quote request setsincludeGasInfo: true./tx-statusreturnsfromTxHash,toTxHash, amounts, token addresses andbridgeHashonly when the provider reports them.errorMsgis alwaysnullin a200, because a provider error comes back as500 TX_STATUS_ERROR. DisplaydetailStatusinstead.GET /transactions/{hash}returnsblockNumberandgasUsedasnull, andconfirmationsas0, until the transaction is mined.- A limit order’s
txHashis an empty string until the order executes,reasonFailis an empty array unless execution failed, anddeletedAtis an empty string until you cancel the order. - A DCA strategy omits
minPriceandmaxPricewhen you didn’t set them. A DCA order carriesamountReceived,executionPriceandtransactionHashonce it executes, anderrorMessagewhen it fails. - Lists that have no entries are empty arrays, for example
"market": []or"data": [].
Casing
Timestamps
The signing timestamp is in seconds and
expired is in milliseconds. Don’t reuse one for the other.
Lists
- No pagination. Each list endpoint returns every match in one response. Use the filters to keep responses small.
-
Unsorted unless stated. Sort limit orders by
createdAtyourself when the order matters. -
Filters combine with AND.
accountTomatches case-sensitively. -
Unknown query parameters. The order and strategy lists ignore unknown query parameters, so a misspelt filter such as
?acountTo=returns the full list. Send each parameter once: a repeated parameter matches nothing.GET /chainsignores query parameters too, whileGET /tokensrejects any parameter other thanchainId. -
Cancelled limit orders stay in the list. Filter by
?status=to see one status only, for examplepending. - Only your API key’s resources. See IDs.
Errors
Errors come from two layers. If the body has asuccess key, it is an Olympex error envelope. If it has only message, it is a gateway response.
Error envelope
error.code is the stable, machine-readable value to branch on, together with the HTTP status. error.message is a human-readable summary: don’t parse it. error.details takes one of three forms:
422 No route
Error codes
Not found
A request for an ID that doesn’t exist, or that belongs to another API key, returns404 with the code NOT_FOUND. Olympex doesn’t tell the two cases apart, and a malformed limit order ID returns the same 404, not a 400. The message names the resource: Limit order not found, DCA strategy not found or DCA order not found. Don’t retry it: check the ID and the API key you signed with.
404 Unknown limit order
404 NOT_FOUND. Its message names the method and path, for example "No route for GET /api/v1/quote", and its meta has no accountType or apiKeyId.
404 Unknown route
Gateway responses
The API gateway answers some requests itself, before or instead of Olympex. These bodies have nosuccess, error or meta. The spec names this body GatewayError.
Retries
GET,PATCHandDELETEare safe to repeat.PATCHandDELETE /limit-order/{id}return409 CONFLICTonce the order isn’tpending, so a repeatedDELETEwhose first attempt went through returns409: read the order to confirm it iscancelled. Don’t retry a409unchanged.422 NO_ROUTEfromPOST /quotescan be temporary: retry with backoff, then change the amount or pair. OnPOST /swap, a422 NO_ROUTEor500 SWAP_ERRORmeans that source can’t build the route now: build again with the nextaggregatorIdin the quote’saggregatorOrder.POST /limit-order,POST /dca-order/strategiesandPOST /accountscreate a new resource on every success. After a timeout, don’t retry them blindly: list your orders or strategies and match on your own fields first.
Request IDs
- Every Olympex envelope carries
meta.requestId. Log it with the HTTP status anderror.codefor every failed call. - Gateway responses have no
meta.requestId, but the response carries anapigw-requestidheader with an ID. On Olympex responses that header has the same value asmeta.requestId. Browsers can’t read the header on cross-origin calls, so read it from a server or a terminal. - The reference helpers in Sign requests report no request ID for a gateway response, such as a
401or403with onlymessage. Log theapigw-requestidresponse header yourself for those. With curl, add-ior-D -to print the response headers. - Include the request ID when you contact support. It is the fastest way to find your request.
Timeouts
The gateway stops waiting for a response after about 30 seconds and returns500 or 503 with only a message. Set your HTTP client timeout slightly above that: the reference clients in Sign requests use 35 seconds. Retry with backoff, and sign each attempt again.
Forward compatibility
- Ignore unknown response fields. Within
v1, responses can gain new fields, and token, order and strategy objects can carry fields you don’t use. Don’t fail validation on a field you don’t recognize. - Handle unknown error codes by HTTP status. New
error.codevalues can be added. - Pass
aggregatorIdthrough. Send/swapthe exact value the quote returned instead of hardcoding one. - Treat unknown transfer statuses as in progress.
/tx-statusreports each provider’s own status values. Get cross-chain transfer status lists the success and failure values. - Treat unknown order statuses as not final. A limit order, DCA strategy or DCA order
statusyou don’t recognize means the resource can still change: keep polling it.
What’s next
Errors and retries
Which errors to retry, and how to back off.
Sign requests
Canonical JSON, the signature and reference code.
List chains
The enabled chains.
OpenAPI specification
Every schema, and how to generate a typed client.
