POST /accounts returns two of them, the API key ID and the secret key. The third is the password you sent in that request, which becomes your passphrase. Together they sign requests as your account, so treat all three as production secrets.
What each credential does
API key ID
The API key ID identifies one API key of your account. You send it inx-api-key-id on every signed request, and Olympex uses it to look up the key and its account. A rotation gives the account a new API key ID with a new secret key. The API key ID can’t sign anything: signing needs the secret key. Keep it out of client code and public places anyway.
Secret key
The secret key is the HMAC key you sign with: a random string, shown once. Use the string exactly asPOST /accounts returned it, as UTF-8 bytes. Don’t base64-decode it, even if it looks like base64. After the account is created, the secret key never travels over the network again. Each request carries a signature made with it, not the key itself.
Olympex stores only an encrypted copy of the secret key, and no endpoint returns it again.
Passphrase
The passphrase is thepassword you sent to POST /accounts. You send it in x-passphrase on every signed request, and Olympex checks it along with the signature. Olympex stores only a hash of it, so it can’t show it to you or recover it.
Save them when you create the account
POST /accounts returns the secret key once, and never returns the passphrase, because you chose it. Save the API key ID, the secret key and the passphrase to your secrets manager before you do anything else.
No endpoint returns either one again. If you lose the new secret key of a rotation, retry that rotation with the same Idempotency-Key and body within 15 minutes to get it back. If you lose the secret key of an old, rotating key, revoke that key with the new one. If you lose the passphrase, or the secret key of your active key after those 15 minutes, create a new API account and move your integration to it.
Store credentials on your server
Keep the credentials in environment variables on your server, injected at runtime from a secrets manager such as AWS Secrets Manager, Google Cloud Secret Manager, HashiCorp Vault, Doppler or 1Password. Name themOLYMPEX_API_KEY_ID, OLYMPEX_SECRET_KEY and OLYMPEX_PASSPHRASE: the reference implementations read those names with credentialsFromEnv() and credentials_from_env(), and every example in these docs uses them.
Never put a credential in any of these places:
Choose a strong passphrase
Thepassword you send to POST /accounts is your passphrase for the life of the account. There is no way to change it later, so choose it carefully:
- Printable ASCII only, from space to
~. Browsers can’t send header values with characters outside ISO-8859-1, so other characters can make the passphrase impossible to send. - No leading or trailing spaces. The API trims the
x-passphraseheader. - At least 24 random characters, generated by a password manager. The API accepts 8 characters or more, but that minimum is not a recommendation.
Rotate and revoke keys
You can replace the API key ID and the secret key of an account without creating a new one.POST /accounts/me/keys/rotate creates a new key and keeps the old one valid for a grace period, or revokes it at once when it may be exposed. POST /accounts/me/keys/{apiKeyId}/revoke disables a key, and GET /accounts/me/keys lists the account’s keys and their status. Rotate and revoke keys walks through a rotation without downtime.
The rest of the lifecycle is fixed:
- The passphrase can’t be changed. To replace it, create a new API account.
- An
activekey doesn’t expire. Only the old key of a rotation expires, at the end of its grace period. - Keys have no scopes: every key can call every signed endpoint.
404 NOT_FOUND for their IDs. Before you retire an account, cancel its open orders and strategies with its own credentials.
If a credential is exposed
If a secret key may have been exposed, act as if an attacker holds it and your passphrase. First set each maker wallet’s allowance to the Olympex order contract to0 for every token the open orders sell, and cancel those orders with the exposed key. Then rotate it in compromised mode, which revokes it at once, and deploy the new key. If a credential is exposed has every step, including what to do when the passphrase leaked: rotation doesn’t replace it.
Test keys from the docs
The Create a test API key button, on the Create a test API key page and in the API console, callsPOST /accounts from your browser and generates a random passphrase for you. If your browser blocks the call, create the key from a terminal instead.
A test key is a real API account. It calls the same production API as any other account:
POST /swap returns real mainnet calldata, and the limit orders and DCA strategies it creates are real orders. There is no sandbox or testnet.What this means for your integration
- Save the secret key and the passphrase the moment you create the account. No endpoint returns either of them again.
- Load all three credentials from a secrets manager into server-side environment variables, and redact
x-passphrasefrom logs. - Treat the passphrase like the secret key: it travels on every signed request, so anything that logs request headers can expose it.
- Make a new key a configuration change, so you can answer a leak with a
compromisedrotation and a deploy.
Related
Sign requests
The signing algorithm and reference implementations.
Create a test API key
Get a test API key in one click, or create one from a terminal.
Security model
What Olympex protects, and what you are responsible for.
Going to production
The checklist before you send real traffic.
