Skip to main content
The Olympex REST API is described by an OpenAPI 3.0.3 document. The parameter, body and response sections of every endpoint page are generated from it, and you can use it to generate a typed client, validate payloads in tests, or browse every schema in one place.

Download the spec

Commit the downloaded spec to your repository and regenerate your client on purpose. A spec update then never changes your types without a review.

Service-hosted spec and Swagger UI

The API also serves its own OpenAPI document and a Swagger UI. Both are public GET routes:
Build against the curated spec at 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 discriminator on mode for the single-chain and cross-chain schemas;
  • readOnly marks on request fields you can’t set or change;
  • the gateway’s own responses (401, 403, 500, 503) with the GatewayError schema;
  • the unit of every amount, fee and gas field;
  • an operationId on every endpoint, for readable generated method names;
  • security scheme descriptions that match the exact signing encodings.
Swagger UI can’t compute signatures: every signed request needs a new nonce and a fresh timestamp. To send signed requests from a browser, use the API console, or its Copy as cURL command if your browser blocks the request. If the curated spec and the live API ever disagree, email partners@olympex.io with the 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.
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 uses signRequest 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
Every call is then typed from the spec, and signed:
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:
In other languages, add the same steps to the generated client’s request interceptor:
  1. For POST and PATCH, canonicalize the body. For GET and DELETE, use the empty string and send no body.
  2. Take the method in uppercase, and the path and the canonical query of the final URL. The path starts with /api/v1.
  3. Build and sign the message as described in Sign requests.
  4. Set the four headers, and Content-Type: application/json.
  5. Send the canonical string as the body of a POST or PATCH.
If the client can’t replace the body, use its models for types and send the request through the reference signer: 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 under components.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 four apiKey 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.