Key format
Dubu Pay API keys follow a predictable format so they are easy to identify and can be detected by secret-scanning tools:
After creation, only the first 20 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
string
required
A human-readable label for this key. Use something descriptive like
"production-backend" or "staging-worker". Maximum 100 characters.string
"sandbox" or "live". Defaults to "sandbox". Sandbox keys carry the prefix dubu_sk_test_; live keys carry dubu_sk_live_.string
required
UUID of the API key. Use this in revoke and delete requests.
string
required
The label you assigned to this key.
string
required
First 20 characters of the key. Safe to display in logs and list views.
string
required
"sandbox" or "live".string
required
ISO 8601 timestamp of when the key was created.
string
required
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.
string
required
UUID of the API key.
string
required
Human-readable label.
string
required
First 20 characters of the key for identification.
string
required
"sandbox" or "live".boolean
required
true if the key can be used to authenticate requests. false if the key has been revoked.string
ISO 8601 timestamp of the most recent authenticated request using this key.
null if the key has never been used.string
required
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.
string
required
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.
string
required
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.