API Keys

Generate and manage API keys for secure access to Compresr services.

Create an API Key

1. Open Dashboard

Sign in to Compresr, open your Console, and navigate to the API Keys section.

2. Configure Key

Name your key and optionally define budget limits or an expiration date.

3. Save & Secure

Copy your API key immediately and store it securely. Keys are shown only once during creation.

API Key Budget

Your Compresr account has a global monthly budget including all spending streams. You can optionally set custom budgets for each API key, which are enforced automatically.

Security Best Practices

Important: API keys grant access to your account

Anyone with your API key can make requests on your behalf and incur charges. Treat your keys like passwords.

Never Commit Keys to Git

Add .env files to your .gitignore. Use secret scanning tools to prevent accidental exposure.

Use Environment Variables

Store keys in environment variables like COMPRESR_API_KEY. Never hardcode keys in source code.

Rotate Keys Regularly

Rotate your API keys every 90 days. Immediately revoke and replace any key you suspect may be compromised.

Set Budget Limits

Always set a monthly budget limit on your keys to prevent unexpected charges if a key is leaked or misused.

Example: Secure Key Usage

# .env file (add to .gitignore!)
COMPRESR_API_KEY=cmpr_xxxxxxxxxxxx

# Python
import os
api_key = os.environ.get("COMPRESR_API_KEY")

# Node.js  
const apiKey = process.env.COMPRESR_API_KEY;