You need a terminal and one of bash or zsh, Node.js 22.18 or later, or Python 3.8 or later. You don’t need a wallet or tokens: nothing in this quickstart signs or sends a transaction, or creates an order.
Prerequisites
Pick one language and follow its tab in each step.Steps
1
Create a test API key
Create a key with the console below. It creates a real API account on the live Olympex API and shows three values: the API key ID, the secret key (a random string) and a generated passphrase. Copy all three now: Olympex can’t show the secret key or the passphrase again.The console also loads the new key into every API console on this site until you reload the page. If your browser blocks the call, create the key from a terminal instead.Export the three values in the terminal you use for the next steps. The signers read them from the environment.
2
Save the reference signer
Save the signer for your language next to your code. Each one takes the method, the path and, for Load the function into the same terminal:
POST and PATCH, the body. It signs the request with your secret key and sends it with the four signed headers. The TypeScript and Python signers canonicalize the JSON body; the shell function expects a body that is already canonical (keys sorted at every level, no whitespace). Sign requests explains each step of the algorithm.- Shell
- TypeScript
- Python
sign-request.sh
3
List the enabled chains
Start with a request that has no body. The shell function prints the full response envelope. The chain IDs are integers, the same type every endpoint takes.
GET /chains returns the IDs of the chains Olympex has enabled. A GET sends no body, so the signer signs the empty string.chainIds lists every chain Olympex has enabled, in ascending numeric order:meta.apiKeyId is the API key ID that signed the request. The TypeScript and Python helpers return data directly, and raise OlympexApiError with the HTTP status, error.code and meta.requestId when the call fails. A gateway response, such as a 401 or 403 from a signing problem, has no meta.requestId, so the helpers raise it without a request ID. Its ID is in the apigw-requestid response header: log that header from your HTTP client, or add -i to a cURL command to see it.Two related calls work the same way. GET /tokens?chainId=137 returns the tokens Olympex lists on Polygon, with each token’s address, symbol and decimals: in the shell, quote the path (olympex_request GET '/tokens?chainId=137') because zsh treats ? as a wildcard. POST /support-chain checks a single chain ID, sent as an integer, against the same list.4
Get a quote
Request the best route for 10 USDT to USDC on Polygon with 1% slippage.What each field means:
mode:single-chainfor a swap on one chain. A transfer between two chains usescross-chainand differentparams.chainId: the chain as an integer (137), as on every endpoint.inTokenAddress,outTokenAddress: the token you sell and the token you buy. Use0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeEfor the chain’s native token.amount: how much you sell, as a human-readable decimal string."10"is 10 USDT; don’t convert it to base units.slippage: the maximum slippage as a percent string."1"is 1%.gasPrice: a gas price hint in gwei, required for single-chain quotes. Send whole gwei as a string, rounded up: some sources reject fractional gwei. On a chain whose gas price is below 1 gwei, that rounds up to"1", above the real price. The hint doesn’t set your transaction’s gas price.
5
Read the response
A successful quote looks like this. Yours has different numbers, and often different routes, because prices move.
To display
outAmount, divide it by 10 to the power of the output token’s decimals: the decimals that GET /tokens returns for the token, or the token contract’s decimals(). Libraries such as viem and ethers do this with formatUnits.A quote is not reserved. Prices move between the quote and the swap, so when you build a swap, request it right after the quote and protect it with
slippage.Verify
You’re set up when both calls return"success": true:
- The chain list includes
137. - The quote returns an
outAmount, anaggregatorIdand ameta.requestId.
Errors and retries lists every error code.
Common pitfalls
What’s next
Execute a swap
Turn a quote into calldata, approve the spender and broadcast from your wallet.
Place a limit order
Sign the token pair, approve the order contract, create an order and follow it to completion.
Sign requests
The signing algorithm, requests without a body, the known-answer vectors and troubleshooting.
API reference overview
Every endpoint, with examples and an in-browser console.
