Overview
All/api endpoints (except public webhooks and /api/ping) require authentication via the x-api-key header.
API Key Header
Include your API key in every request:Your API key from the database. Managed through the admin UI, not environment variables.
How Authentication Works
- Request includes
x-api-keyheader - Server calls
verifyApiKey(apiKey)fromlib/db/api-keys.js - Database lookup with timing-safe comparison
- Returns
401 Unauthorizedif key is missing or invalid
API Key Management
API keys are stored in the SQLite database (table:api_keys) and managed through the admin UI.
Not environment variables. Unlike most framework secrets, API keys are database-backed for multi-key support and rotation.
Creating API Keys
Use the admin UI at/settings or insert directly into the database:
Revoking API Keys
Delete from theapi_keys table:
Public Routes
These routes do not require API keys:/api/ping- Health check/api/telegram/webhook- Authenticated via Telegram secret/api/github/webhook- Authenticated via GitHub webhook secret
Timing-Safe Comparison
API key verification uses constant-time comparison to prevent timing attacks:Error Responses
Missing API Key
401
Invalid API Key
401