API keys are the recommended authentication method for server-side integrations. Unlike JWT tokens, they do not expire automatically, which makes them well-suited for background services, cron jobs, and backend applications that make API calls without an interactive login flow. All API key endpoints require an authenticated request — use either a bearer token or an existing API key.Documentation Index
Fetch the complete documentation index at: https://docs.dubupay.com/llms.txt
Use this file to discover all available pages before exploring further.
Key format
Dubu Pay API keys follow a predictable format so they are easy to identify and can be detected by secret-scanning tools:| Environment | Format |
|---|---|
| Live | dubu_sk_live_<32 random characters> |
| Sandbox | dubu_sk_test_<32 random characters> |
key_prefix) are stored and returned by list endpoints. Use the prefix to identify which key you are viewing without exposing the secret.
Create an API key
POST /api-keys
Creates a new API key scoped to your merchant account. The response includes the full plaintext key field — this is the only time it is returned.
Request body
A human-readable label for this key. Use something descriptive like
"production-backend" or "staging-worker". Maximum 100 characters."sandbox" or "live". Defaults to "sandbox". Sandbox keys carry the prefix dubu_sk_test_; live keys carry dubu_sk_live_.UUID of the API key. Use this in revoke and delete requests.
The label you assigned to this key.
First 20 characters of the key. Safe to display in logs and list views.
"sandbox" or "live".ISO 8601 timestamp of when the key was created.
The full plaintext API key. Returned only in this response. Store it immediately.
List API keys
GET /api-keys
Returns all API keys associated with your merchant account. The key secret is never included in list responses — only the key_prefix is returned for identification.
UUID of the API key.
Human-readable label.
First 20 characters of the key for identification.
"sandbox" or "live".true if the key can be used to authenticate requests. false if the key has been revoked.ISO 8601 timestamp of the most recent authenticated request using this key.
null if the key has never been used.ISO 8601 timestamp of when the key was created.
Revoke an API key
PATCH /api-keys/:id/revoke
Revokes the key, setting is_active to false. Revoked keys are rejected on all subsequent requests but remain visible in the key list. Use revoke when you want to disable a key temporarily or audit it before permanent deletion.
UUID of the API key to revoke.
Delete an API key
DELETE /api-keys/:id
Permanently removes the API key from your account. This action cannot be undone. Use deletion when you are certain you no longer need the key record.
UUID of the API key to delete.
Security best practices
Store keys in environment variables or a secret manager
Store keys in environment variables or a secret manager
Never hard-code an API key in your source code. Use environment variables in local development (e.g.
DUBU_API_KEY=dubu_sk_live_...) and a secrets manager such as AWS Secrets Manager, HashiCorp Vault, or your platform’s built-in secrets store in production.Never expose keys in client-side code
Never expose keys in client-side code
API keys must only be used in server-side code. If a key appears in a browser, a mobile app binary, or a public repository, treat it as compromised and rotate it immediately.
Rotate keys regularly
Rotate keys regularly
Create a replacement key before revoking the existing one to avoid downtime. Aim to rotate live keys at least every 90 days, or immediately after any suspected exposure.
Use separate keys per environment and service
Use separate keys per environment and service
Create one key per environment (sandbox, live) and ideally one per service or deployment. This limits the blast radius of a compromised key and makes it easy to rotate without affecting other services.
Monitor last_used_at
Monitor last_used_at
Check the
last_used_at field when listing keys. Keys that have never been used or that have been idle for an extended period are candidates for deletion.Next steps
Authentication overview
Compare JWT bearer tokens and API keys, and learn how to refresh tokens.
Quickstart
Walk through registering, creating a key, and issuing a virtual bank account.