heaptree-logo
Heaptree

Authentication

Create an API key and use it with the Heaptree SDK

Get an API Key

  1. Log in to your dashboard: Dashboard
  2. Go to "API Keys" → "Create New API Key"
  3. 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

Next Steps