# List the chains Olympex has enabled.
# Needs openssl, curl and OLYMPEX_API_KEY_ID, OLYMPEX_SECRET_KEY, OLYMPEX_PASSPHRASE.
METHOD=GET
ENDPOINT=/chains
QUERY=''
BODY='' # GET has no body: the signature covers the empty string
TS="${OLYMPEX_TIMESTAMP:-$(date +%s)}"
NONCE="${OLYMPEX_NONCE:-$(openssl rand -hex 12)}"
BODY_HASH="$(printf '%s' "$BODY" | openssl dgst -sha256 -binary | openssl base64 -A | tr '+/' '-_' | tr -d '=')"
VALUE_INFO="$(printf '%s\n%s\n%s' "$TS" "$NONCE" "$BODY_HASH")"
MESSAGE="$(printf 'OLPX-HMAC-SHA256-V2\n%s\n%s\n%s\n%s\n%s\n%s' "$TS" "$NONCE" "$METHOD" "/api/v1$ENDPOINT" "$QUERY" "$BODY_HASH")"
curl -sS -X "$METHOD" "https://api-rest.olympex.io/api/v1$ENDPOINT${QUERY:+?$QUERY}" \
-H "content-type: application/json" \
-H "x-api-key-id: $OLYMPEX_API_KEY_ID" \
-H "x-value-info: $(printf '%s' "$VALUE_INFO" | openssl base64 -A)" \
-H "x-passphrase: $OLYMPEX_PASSPHRASE" \
-H "x-signature: $(printf '%s' "$MESSAGE" | openssl dgst -sha256 -hmac "$OLYMPEX_SECRET_KEY" -binary | od -An -v -tx1 | tr -d ' \n')"
import { olympexRequest } from "./sign-request.ts"; // /authentication/sign-requests
const { chainIds } = await olympexRequest<{ chainIds: number[] }>("GET", "/chains");
const enabledChains = new Set(chainIds);
console.log(enabledChains.has(137) ? "Offer Polygon" : "Hide Polygon");
from sign_request import olympex_request # /authentication/sign-requests
chain_ids = olympex_request("GET", "/chains")["chainIds"]
enabled_chains = set(chain_ids)
print("Offer Polygon" if 137 in enabled_chains else "Hide Polygon")
{
"success": true,
"data": {
"chainIds": [
1,
10,
56,
137,
8453,
42161,
43114,
59144
]
},
"meta": {
"requestId": "E7eeEiPDIAMEP7Q=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "Invalid body hash",
"details": []
},
"meta": {
"requestId": "ENXGDhsXIAMEMEw=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
{
"message": "Forbidden"
}
{
"success": false,
"error": {
"code": "ENABLED_CHAINS_ERROR",
"message": "Unexpected enabled chains handler error",
"details": [
{
"message": "Unknown error"
}
]
},
"meta": {
"requestId": "EdjY9iZkoAMEVsg=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
List chains
List the IDs of the chains Olympex has enabled: the source of truth for which chains to offer.
# List the chains Olympex has enabled.
# Needs openssl, curl and OLYMPEX_API_KEY_ID, OLYMPEX_SECRET_KEY, OLYMPEX_PASSPHRASE.
METHOD=GET
ENDPOINT=/chains
QUERY=''
BODY='' # GET has no body: the signature covers the empty string
TS="${OLYMPEX_TIMESTAMP:-$(date +%s)}"
NONCE="${OLYMPEX_NONCE:-$(openssl rand -hex 12)}"
BODY_HASH="$(printf '%s' "$BODY" | openssl dgst -sha256 -binary | openssl base64 -A | tr '+/' '-_' | tr -d '=')"
VALUE_INFO="$(printf '%s\n%s\n%s' "$TS" "$NONCE" "$BODY_HASH")"
MESSAGE="$(printf 'OLPX-HMAC-SHA256-V2\n%s\n%s\n%s\n%s\n%s\n%s' "$TS" "$NONCE" "$METHOD" "/api/v1$ENDPOINT" "$QUERY" "$BODY_HASH")"
curl -sS -X "$METHOD" "https://api-rest.olympex.io/api/v1$ENDPOINT${QUERY:+?$QUERY}" \
-H "content-type: application/json" \
-H "x-api-key-id: $OLYMPEX_API_KEY_ID" \
-H "x-value-info: $(printf '%s' "$VALUE_INFO" | openssl base64 -A)" \
-H "x-passphrase: $OLYMPEX_PASSPHRASE" \
-H "x-signature: $(printf '%s' "$MESSAGE" | openssl dgst -sha256 -hmac "$OLYMPEX_SECRET_KEY" -binary | od -An -v -tx1 | tr -d ' \n')"
import { olympexRequest } from "./sign-request.ts"; // /authentication/sign-requests
const { chainIds } = await olympexRequest<{ chainIds: number[] }>("GET", "/chains");
const enabledChains = new Set(chainIds);
console.log(enabledChains.has(137) ? "Offer Polygon" : "Hide Polygon");
from sign_request import olympex_request # /authentication/sign-requests
chain_ids = olympex_request("GET", "/chains")["chainIds"]
enabled_chains = set(chain_ids)
print("Offer Polygon" if 137 in enabled_chains else "Hide Polygon")
{
"success": true,
"data": {
"chainIds": [
1,
10,
56,
137,
8453,
42161,
43114,
59144
]
},
"meta": {
"requestId": "E7eeEiPDIAMEP7Q=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "Invalid body hash",
"details": []
},
"meta": {
"requestId": "ENXGDhsXIAMEMEw=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
{
"message": "Forbidden"
}
{
"success": false,
"error": {
"code": "ENABLED_CHAINS_ERROR",
"message": "Unexpected enabled chains handler error",
"details": [
{
"message": "Unknown error"
}
]
},
"meta": {
"requestId": "EdjY9iZkoAMEVsg=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
GET /chains returns the IDs of the chains Olympex has enabled, as integers in ascending order. It is the source of truth for which chains to offer: call it instead of hard-coding which chains are enabled. It returns IDs only: take names and capabilities from Supported chains. Then get each chain’s tokens with GET /tokens. POST /support-chain checks a single chain against the same list.
Chain IDs are integers
data.chainIds holds integers (137), the type every endpoint takes: pass them unchanged to GET /tokens, POST /quotes, POST /swap, POST /support-chain, POST /tx-status, GET /transactions/{hash}, limit orders and DCA.
Conventions lists every chain ID field.
Cache the list
CallGET /chains when your service starts and refresh it on the same schedule as your token lists, instead of before every request. When a chain leaves the list, stop offering it.
Supported chains shows the chains enabled today and what each one supports.
An enabled chain doesn’t mean every pair has a route: request a quote to confirm a pair. Limit orders and DCA execute only on the chains listed in The order contract.
Sign the empty string
GET /chains has no body, so you sign the empty string: its bodyHash is 47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU. The method and the path, /api/v1/chains, are signed with it.
# List the chains Olympex has enabled.
# Needs openssl, curl and OLYMPEX_API_KEY_ID, OLYMPEX_SECRET_KEY, OLYMPEX_PASSPHRASE.
METHOD=GET
ENDPOINT=/chains
QUERY=''
BODY='' # GET has no body: the signature covers the empty string
TS="${OLYMPEX_TIMESTAMP:-$(date +%s)}"
NONCE="${OLYMPEX_NONCE:-$(openssl rand -hex 12)}"
BODY_HASH="$(printf '%s' "$BODY" | openssl dgst -sha256 -binary | openssl base64 -A | tr '+/' '-_' | tr -d '=')"
VALUE_INFO="$(printf '%s\n%s\n%s' "$TS" "$NONCE" "$BODY_HASH")"
MESSAGE="$(printf 'OLPX-HMAC-SHA256-V2\n%s\n%s\n%s\n%s\n%s\n%s' "$TS" "$NONCE" "$METHOD" "/api/v1$ENDPOINT" "$QUERY" "$BODY_HASH")"
curl -sS -X "$METHOD" "https://api-rest.olympex.io/api/v1$ENDPOINT${QUERY:+?$QUERY}" \
-H "content-type: application/json" \
-H "x-api-key-id: $OLYMPEX_API_KEY_ID" \
-H "x-value-info: $(printf '%s' "$VALUE_INFO" | openssl base64 -A)" \
-H "x-passphrase: $OLYMPEX_PASSPHRASE" \
-H "x-signature: $(printf '%s' "$MESSAGE" | openssl dgst -sha256 -hmac "$OLYMPEX_SECRET_KEY" -binary | od -An -v -tx1 | tr -d ' \n')"
import { olympexRequest } from "./sign-request.ts"; // /authentication/sign-requests
const { chainIds } = await olympexRequest<{ chainIds: number[] }>("GET", "/chains");
const enabledChains = new Set(chainIds);
console.log(enabledChains.has(137) ? "Offer Polygon" : "Hide Polygon");
from sign_request import olympex_request # /authentication/sign-requests
chain_ids = olympex_request("GET", "/chains")["chainIds"]
enabled_chains = set(chain_ids)
print("Offer Polygon" if 137 in enabled_chains else "Hide Polygon")
{
"success": true,
"data": {
"chainIds": [
1,
10,
56,
137,
8453,
42161,
43114,
59144
]
},
"meta": {
"requestId": "E7eeEiPDIAMEP7Q=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "Invalid body hash",
"details": []
},
"meta": {
"requestId": "ENXGDhsXIAMEMEw=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
{
"message": "Forbidden"
}
{
"success": false,
"error": {
"code": "ENABLED_CHAINS_ERROR",
"message": "Unexpected enabled chains handler error",
"details": [
{
"message": "Unknown error"
}
]
},
"meta": {
"requestId": "EdjY9iZkoAMEVsg=",
"version": "v1",
"accountType": "integrator",
"apiKeyId": "00000000-0000-4000-8000-000000000000"
}
}
Authorizations
Your API key ID (UUID). See Sign requests.
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.
Your account passphrase. Treat it like the secret key.
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.
Was this page helpful?
