Authentication
Create an API key and use it with the Heaptree SDK
Get an API Key
- Log in to your dashboard: Dashboard
- Go to "API Keys" → "Create New API Key"
- Copy the key and set it as an environment variable:
export HEAPTREE_API_KEY="your-api-key"Optionally, add it to a .env file and load it with your preferred method.
Use the Key in Code
import os
from heaptree import Heaptree
client = Heaptree(api_key=os.getenv("HEAPTREE_API_KEY"))That's it — all SDK calls will authenticate using your key.
Tips
- Never hardcode API keys in code or commit them to version control
- Rotate keys periodically
- Delete unused keys in the dashboard