Authentication and API keys
How to get a SwapKit API key, send it with your requests, keep it safe, and what the key controls.
Every request to https://api.swapkit.dev is authenticated with an API key sent in the x-api-key header.
curl "https://api.swapkit.dev/providers" \
-H "x-api-key: YOUR_API_KEY"Getting a key
Sign in to the SwapKit dashboard.
Click Create app. Each app has its own key.
Open the app and copy its API Key.
Use separate apps for separate environments or products, so each has its own limits, fee settings and usage stats.
What a key controls
Your key is more than a credential. SwapKit uses it to apply:
Your affiliate fees. Quotes requested with your key automatically include the affiliate addresses and fee tiers configured for it. See Monetization.
Your limits. A new key allows 10 requests per minute on each service and trades of up to $1,000. Both are raised on request. See Rate limits and trade size for how they're counted and the response headers that report them.
Optional features enabled per key, such as SLIP-0024 payload signing.
Keep your key server-side
Treat an API key like a password. Call the API from your backend and never ship the key in browser or mobile app code, where anyone can extract it and spend your limits.
To run swaps directly in the browser, use the SwapKit Widget instead. It authenticates with widget keys, which are bound to your domain and safe to expose.
Authentication errors
401
apiKeyInvalid, unauthorized
The x-api-key header is missing, or the key is invalid, disabled or expired.
Last updated

