Authentication¶
Every API call requires a Canard API key. Get yours from the dashboard.
Credential Lookup Order¶
The SDK checks for credentials in this order:
- Direct parameter —
Client(api_key="...") - Environment variable —
CANARD_API_KEY - Credentials file —
~/.canard/credentials
If no key is found, the Client raises ConfigurationError.
Managing Credentials¶
Save¶
from canard import save_api_key
save_api_key("your_api_key")
# Saved to ~/.canard/credentials (chmod 600)
Load¶
File Location¶
Security¶
- The credentials file is created with
0600permissions (owner read/write only) - Never commit API keys to git
- Use environment variables in CI/CD pipelines
- Rotate keys from the dashboard if compromised