Create an API key
- Go to Integrations > API Keys.
- Select Add an API key.
-
Enter a Name to identify the key, for example
Web API key. -
Choose the Permissions for the key. This sets the key’s roles:
- Full access allows the key to process payments, manage connections, edit Flow rules, and more.
- Processing only allows the key to process payments, including managing payment methods and buyers.
- System management only allows the key to manage connections and edit Flow rules.
- Transaction reporting only allows the key to read payments data, including creating and accessing reports.
- Key management only allows the key to manage API keys, including creating, editing, and activating or deactivating keys.
- Choose the Algorithm. ECDSA is recommended. Only use RSA in environments that do not support ECDSA.
- Under Merchants, either grant the key access to all merchant accounts or select specific merchant accounts.
- Select Create API key.
When a key has access to more than one merchant account, set the
X-Gr4vy-Merchant-Account-Id header on every request, or merchantAccountId
in Embed. Without it, the request uses the
default merchant account and returns a 403 error if the key has no access
to that account. A key scoped to a single merchant account always uses that
account and ignores the header.Manage API keys
The API Keys table lists each key with its name, roles, algorithm, merchant access, when it was last used, creator, and creation date. The Status column shows whether each key is active or inactive.- Select Edit API key to change a key’s name, roles, or the merchant accounts it can access.
- Select Deactivate to turn off a key without deleting it. A deactivated key can no longer authenticate. Select Activate to turn it back on.
- Select Remove API key to delete a key. Removing a key is non-reversible, and any system using it can no longer authenticate.
Rotate an API key
To replace a key without downtime, run the old and new keys side by side while you switch over.- Create an API key with the same permissions and merchant access as the key you’re replacing, and store the new private key securely.
- Update your systems to sign requests with the new private key. If your integration sets the key ID (
kid) in the JWT header, copy the new key ID from the API Keys table and update that value too. - Check that the Last used value of the old key stops changing. It can lag behind the most recent request by a few minutes.
- Select Deactivate on the old key. If anything still depends on it, those requests fail and you can select Activate to restore it while you fix them.
- Once nothing depends on the old key, select Remove API key to delete it.
API key roles differ from user roles. User roles control access for people signing in to the dashboard, while API key permissions control access for server-side API calls.