Authentication
Intro
The Khaime Partner API uses API key authentication via theX-API-Key header. Key management (creating, listing, revoking keys) is a separate, more privileged flow that uses your dashboard login instead.
Context
There are two distinct auth layers, and mixing them up is the most common integration mistake:X-API-Key— used for every actual integration call (payments, products, subscriptions, etc.), documented throughout the API Reference.x-id-key— your merchant dashboard session token, used only by the key-management endpoints below. These are typically called from the Khaime dashboard itself, not from integration code, since they require you to already be logged in as the business owner or staff.
Hows
API Key Types
Creating API Keys
- Log in to app.khaime.com
- Go to Settings → API & Integrations
- Click Create API Key
- Select environment (Sandbox or Live)
- Copy the key and secret — they’re shown only once
Sandbox keys can be created by the business owner or a staff member with
key-creation permission. Live keys can only be created by the business
owner, and require completed KYC verification and a signed API services
agreement — sandbox has neither requirement.
Using Your Key
Include the key in every request:401:
Key Management
Whys
Splitting the two headers exists to keep the blast radius small: anX-API-Key leaked from a server or a plugin config can only move money and read data scoped to that key’s environment — it can’t mint new keys, revoke existing ones, or change where webhooks are delivered. Only a dashboard session (x-id-key), which implies an authenticated human, can do that. Gating live-key creation behind KYC and a signed agreement, while leaving sandbox unrestricted, means you can build and test an entire integration before any compliance step blocks you — the gate only shows up when you’re ready to move real money.
Why nots
An API key is not a substitute for a dashboard login — it can’t be used to call the key-management endpoints above, on purpose. Don’t build a flow that expects a partner’sX-API-Key to rotate its own webhook secret or list sibling keys; that has to go through an authenticated dashboard session. Revoking a key is also immediate and irreversible — there’s no grace period, so coordinate any key rotation with your deployment rather than revoking the old key first.
Security Best Practices
- Never expose API keys in client-side code or version control
- Use environment variables to store keys
- Use sandbox keys for development and testing
- Rotate keys periodically
- Revoke compromised keys immediately
