
Protecting your API key and running the GuidedMind SDK safely in production.
Your API key is a secret credential with full access to your GuidedMind project. Treat it like a database password.
GUIDEDMIND_API_KEY environment variable.env files locally with .gitignore to exclude them from commits# ✅ Read from environment — the SDK does this automatically
from guidedmind import Client
client = Client() # reads GUIDEDMIND_API_KEY
# ✅ Explicit env lookup — acceptable
import os
client = Client(api_key=os.environ["GUIDEDMIND_API_KEY"])
# ❌ Never do this
client = Client(api_key="gm_live_abc123...")from dotenv import load_dotenv
load_dotenv() # loads .env into os.environ
from guidedmind import Client
client = Client()# .env — never commit this file
GUIDEDMIND_API_KEY=gm_live_your_key_here# .gitignore
.env
.env.local
.env.*.localThe SDK enforces several security properties automatically:
gm_live_***.ConfigurationError if base_url uses http:// instead of https://. TLS 1.2+ is required.import boto3
import json
from guidedmind import Client
def get_client() -> Client:
sm = boto3.client("secretsmanager", region_name="us-east-1")
secret = sm.get_secret_value(SecretId="guidedmind/api-key")
key = json.loads(secret["SecretString"])["api_key"]
return Client(api_key=key)import hvac
from guidedmind import Client
def get_client() -> Client:
vault = hvac.Client(url="https://vault.example.com")
secret = vault.secrets.kv.v2.read_secret_version(path="guidedmind")
key = secret["data"]["data"]["api_key"]
return Client(api_key=key)If your infrastructure requires outbound traffic restrictions, allow the following:
| Endpoint | Port | Protocol |
|---|---|---|
api.guidedmind.ai | 443 | HTTPS / TLS 1.2+ |
The SDK does not make connections to any other external hosts.
If you suspect your API key has been compromised, revoke it immediately from the GuidedMind dashboard under Settings → API Keys, then generate a new one. Revocation takes effect within 60 seconds.