Key format
A key looks likesk_live_ followed by 48 hex characters:
How the SDK uses the key
Pass the key when you construct the client. The SDK sends it on every request as the HTTP headerx-sdk-key:
Creating a key
Sign in to your OneSwap account — swap.oneswap.cc for mainnet, devnet.oneswap.cc for devnet — and open the SDK keys section. Create a key with an optional label (e.g. “production backend”). The response shows the plaintextsk_live_... value once — copy it into your server’s secret store
immediately.
Listing keys
The same account page lists your keys — label, active state, rate limit, and creation date. The secret is never shown again; only metadata is listed.Rotating a key
There is no in-place rotation. To rotate:- Create a new key from your account.
- Deploy it to your servers.
- Revoke the old key once nothing uses it.
Revoking a key
Revoke (delete) a key from the same account page. This is how you rotate out a leaked or retired key — revocation is immediate.Rate limits
Each key has a base per-minute rate limit (ratePerMin), and operations are tiered relative to it:
On top of the base limit, OneSwap can configure per-operation limits for your key
(different ceilings for creating swaps, quoting, reading tickers, and so on). If your
integration needs more headroom on a specific operation — say, high-frequency quoting —
ask for a per-operation raise rather than a blanket one.
Exceeding a limit returns HTTP
429 (RateLimitError). Back off and retry — see
Error handling.
Security best practices
- Server-side only. Keep the key on your backend. Never ship it to a browser, mobile app, or any end-user surface.
- Never expose it to end-users. Your users interact with a deposit party — they never need, and must never see, your key.
- Store it in a secret manager, not in source control or client bundles.
- Use separate keys per environment or service so you can revoke one without disrupting the others.
- Revoke immediately if a key is exposed, then create a replacement.