Authorization header as a Bearer token.
API key format
API keys are prefixed withcc_live_ followed by a secure random string:
Making authenticated requests
Include your API key in theAuthorization header with the Bearer scheme:
Example with different languages
Generating API keys
You can create and manage API keys from your CashCat dashboard:- Navigate to Settings in your CashCat dashboard
- Go to the API Keys section
- Click Create New Key
- Give your key a descriptive name (e.g., “Production Server”, “Development”)
- Copy the generated key immediately
Key properties
Each API key has the following properties:- Name: A descriptive label to help you identify the key
- Key prefix: The first 15 characters of the key (e.g.,
cc_live_AbCdEfG) displayed in the dashboard - Created at: Timestamp when the key was created
- Last used at: Timestamp of the most recent API request using this key
Revoking API keys
If an API key is compromised or no longer needed:- Go to Settings > API Keys in your dashboard
- Find the key you want to revoke
- Click Revoke
- Confirm the action
Security best practices
Store keys securely
Store API keys in environment variables or secure secret management systems, never in your source code:.env
Use separate keys per environment
Create different API keys for development, staging, and production environments. This allows you to revoke keys without affecting other environments.Rotate keys regularly
Periodically create new API keys and revoke old ones, especially for production environments.Monitor key usage
Check the “Last used at” timestamp in your dashboard to identify unused or potentially compromised keys.Authentication errors
The API returns specific error responses for authentication failures:Missing authorization header
401 Unauthorized
Invalid API key
401 Unauthorized
This error occurs when:
- The API key doesn’t exist
- The API key has been revoked
- The API key format is invalid
How API keys work
When you create an API key:- A secure random key is generated with the
cc_live_prefix - The key is hashed using SHA-256 before storage
- Only the hash is stored in the database for security
- The raw key is shown to you once and cannot be recovered
- The API hashes your provided key
- The hash is compared against stored hashes in the database
- If a match is found, the request is authenticated as your user
- The “last used at” timestamp is updated asynchronously