How should I store my API key and Account ID in my code?
Keep both values out of your source code.
export CLATTER_API_KEY="clsk_..." # Console › API keys
export CLATTER_ACCOUNT_ID="CL-XXXXXXXX" # Console Home
Then read them at runtime:
import os
headers = {
"Authorization": f"Bearer {os.environ['CLATTER_API_KEY']}",
"X-Clatter-Account": os.environ["CLATTER_ACCOUNT_ID"],
}
In production#
- Use your platform's secret manager or encrypted CI secrets.
- Don't print the key in logs or error messages.
- Add
.envfiles to.gitignore. - Give each environment (staging, production) its own key.
Learn more#
Related articles
Still need help?
Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.
Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyzFor deleting your whole account or the data of one service.