Repository navigation
Authentication
Zouhair Fouiguira edited this page Feb 28, 2026
·
1 revision
- Sign up at app.formatex.io
- Go to Dashboard → API Keys → Create Key
- Copy the key — it is shown only once
Pass the raw key to the client constructor:
from formatex import FormaTexClient
client = FormaTexClient("fx_your_api_key_here")Or as a context manager (recommended — ensures connection cleanup):
with FormaTexClient("fx_your_api_key_here") as client:
result = client.compile(latex)The SDK sends it as the X-API-Key header on every request.
- Never hardcode keys in source code — use environment variables:
import os
from formatex import FormaTexClient
client = FormaTexClient(os.environ["FORMATEX_API_KEY"])# .env (never commit this file)
FORMATEX_API_KEY=fx_your_api_key_hereLoad .env with python-dotenv:
pip install python-dotenvfrom dotenv import load_dotenv
load_dotenv()
client = FormaTexClient(os.environ["FORMATEX_API_KEY"])- Add
.envto.gitignore - In CI/CD, use secrets (GitHub Actions Secrets, etc.)
- Create a new key in the dashboard
- Deploy with the new key
- Revoke the old key once traffic has fully migrated
Revoking is instant and irreversible.
Use separate keys per environment:
| Environment | Key |
|---|---|
| Production | fx_prod_... |
| Staging | fx_stg_... |
| CI | fx_ci_... |