Download the spec
Service-hosted spec and Swagger UI
The API also serves its own OpenAPI document and a Swagger UI. Both are publicGET routes:
docs.olympex.io instead. It includes:
- an absolute server URL, so generators and tools know where to send requests;
- response examples for every endpoint;
- a
discriminatoronmodefor the single-chain and cross-chain schemas; readOnlymarks on request fields you can’t set or change;- the gateway’s own responses (
401,403,500,503) with theGatewayErrorschema; - the unit of every amount, fee and gas field;
- an
operationIdon every endpoint, for readable generated method names; - security scheme descriptions that match the exact signing encodings.
meta.requestId of the request.
Generate a client
Olympex doesn’t publish an SDK package. Generate a client from the spec in your language, then add signing to it as shown in Sign requests from a generated client.- TypeScript
- Other languages
openapi-typescript generates types from the spec, and openapi-fetch is a small
fetch client that uses them. The examples on this page are ES modules that Node.js 22.18 or later runs directly: npm init -y writes "type": "commonjs", so set the project’s type to module first.Sign requests from a generated client
Generated clients send requests without signatures. They read the four security schemes as static API key values, and a static signature fails: the server rejects a nonce it has seen in the last 5 minutes and a timestamp more than 300 seconds from its clock. Leave those settings empty and sign each request in the client’s request hook instead. The TypeScript example below adds an openapi-fetch middleware that usessignRequest from the reference signer (sign-request.ts). It signs every attempt, retries included, and skips the public endpoint, POST /accounts. It passes the request’s method and full URL to the signer, so the path and the query the client builds are signed too. For POST and PATCH it replaces the body with the canonical bytes it hashed. GET and DELETE have no body, so it signs the empty string and sends no body: a GET request can’t carry one, not even an empty string.
olympex-client.ts
GET and DELETE calls pass their parameters through params. The middleware signs the empty string as the body, together with the path and the query:
- For
POSTandPATCH, canonicalize the body. ForGETandDELETE, use the empty string and send no body. - Take the method in uppercase, and the path and the canonical query of the final URL. The path starts with
/api/v1. - Build and sign the message as described in Sign requests.
- Set the four headers, and
Content-Type: application/json. - Send the canonical string as the body of a
POSTorPATCH.
olympex_request(method, path, body) in Python, olympexRequest(method, path, body) in TypeScript.
Single-chain and cross-chain variants
POST /quotes and POST /swap accept two body shapes, chosen by mode. In the spec, QuoteRequest and SwapRequest are oneOf schemas with a discriminator on mode. In the responses, data is a oneOf of two variants whose mode has a single allowed value, so checking data.mode narrows the type in TypeScript and most typed languages.
The cross-chain request schemas also set
additionalProperties: false, so an unknown top-level key returns 400.
Data model
Every schema lives undercomponents.schemas.
Requests
Request schemas also list fields you can’t set or change, marked
readOnly. Don’t send them. Fields that Olympex sets as it executes an order, such as a limit order’s status and txHash, aren’t part of the request schemas: sending one returns 400 VALIDATION_ERROR.
Envelope and errors
Responses
Conventions gives the unit of every amount field.
Security schemes
The spec declares fourapiKey schemes, one per header. Signed endpoints list all four in a single security requirement, so a request needs every header at once. Public endpoints declare security: [].
Sign requests has the full algorithm, two known-answer vectors and reference code in TypeScript, Python and bash.
What’s next
Sign requests
The signer the middleware above wraps.
Conventions
Units, chain IDs, errors and forward compatibility.
Get a quote
The first endpoint most integrations call.
API console
Try any endpoint from your browser.
