For basic SDK setup, see the Quickstart. This page covers production-ready authentication patterns.
Using .env Files for Local Development
For local development, use environment variable management tools to load secrets from a.env file:
1. Create a .env file with your api key:
.env
- Python
- TypeScript
Install python-dotenv:Or using Then load in your application:
uv:Note: If
BREAD_API_KEY is already set as an environment variable (e.g., in production), you don’t need python-dotenv. The SDK will automatically read from the environment variable if you instantiate without passing api_key:Supported Environment Variables
The SDK reads these environment variables:| Variable | Description | Default |
|---|---|---|
BREAD_API_KEY | API authentication key | Required |
BREAD_LOG | Logging level (info or debug) | None |
Best Practices
Use Environment Variables
Use Environment Variables
Store API keys in environment variables, not in source code. This makes it easy to rotate keys and use different keys per environment.
Never Commit Keys
Never Commit Keys
Add
.env and any files containing secrets to .gitignore. Use secret management systems in production.Monitor Key Usage
Monitor Key Usage
Track API key usage to detect unauthorized access or anomalous behavior.
Secret Management in Production
For production deployments, use secure secret management:- Python
- TypeScript