X-Api-Key request header — it is stateless, easy to rotate, and the right choice for all server-to-server integrations. A JWT Bearer token is also supported for management operations such as key rotation when you prefer short-lived credentials.
API Key (Recommended)
API Keys are the standard way to authenticate CertoPay API calls from your backend. Include the key in theX-Api-Key header on every request.
Retrieve Your Current Key
You can fetch metadata about your active API Key programmatically. Because this is a management operation, it requires a short-lived JWT Bearer token (obtained via the login endpoint below) rather than the API Key itself.200 OK
UUID of the API Key record.
Human-readable label assigned to the key in the dashboard.
The visible prefix of the key (first 16 characters). Use this to identify which key is active without exposing the secret.
Partially masked version of the key for display purposes only.
Whether the key is currently active. Inactive keys return
401 Unauthorized.Maximum number of requests per minute allowed for this key.
ISO 8601 timestamp of the most recent authenticated request made with this key.
ISO 8601 timestamp of when the key was originally created.
Regenerate Your Key
Regenerating issues a new secret and immediately invalidates the old one. Any in-flight requests using the previous key will fail with401. Update all your integrations before regenerating in production.
200 OK
JWT Bearer Token (Alternative)
JWT tokens are short-lived credentials suitable for management operations — retrieving key metadata, regenerating keys, and accessing the seller dashboard API. They are not recommended as a replacement for the API Key in payment flows.Obtain a Token
200 OK
A signed JWT. Include this in the
Authorization header of management requests. Tokens expire after a short period — check the exp claim in the payload.Use the Token
JWTs are not accepted on payment processing endpoints (
/api/payment-gateway/process, /api/orders, /api/customers). Use your X-Api-Key for those calls.Rate Limits
The default rate limit is 100 requests per minute per API Key. When the limit is exceeded, the API returns
HTTP 429 Too Many Requests. Requests are counted on a rolling 60-second window. If you need a higher limit for your use case, contact CertoPay support to have your limit reviewed and increased.429 response includes a Retry-After header indicating the number of seconds to wait before retrying:
Security Best Practices
Following these practices will protect your API Key and your customers’ data.Use Environment Variables
Store your API Key in an environment variable such as
CERTOPAY_API_KEY and read it at runtime. Never hard-code it directly in source files.Separate Test & Production Keys
Use a dedicated key for your staging/test environment and a separate key for production. This prevents accidental charges during development.
Restrict Key Exposure
The key must only live on your server. Never bundle it into a mobile app, browser script, or any artifact that can be decompiled or inspected by end users.
Rotate Keys Periodically
Rotate your production API Key periodically and immediately if you suspect it has been compromised. Use the regenerate endpoint and deploy the new key with zero downtime.
Environment Variable Example
Error Reference
| HTTP Status | Code | Meaning |
|---|---|---|
401 Unauthorized | invalid_api_key | Key is missing, malformed, or has been revoked |
401 Unauthorized | expired_token | JWT Bearer token has expired — re-authenticate |
403 Forbidden | insufficient_permissions | Key exists but lacks permission for this operation |
429 Too Many Requests | rate_limit_exceeded | Request rate exceeded — wait and retry |