POST /api/auth
Authenticate using either an access token or Telegram initData and receive a JWT token.Request Body
CLI API token in format
CLI_API_TOKEN:<namespace>. Mutually exclusive with initData.Telegram Mini App initData string. Mutually exclusive with
accessToken.Response
JWT token valid for 15 minutes
Example: Access Token
Example: Telegram
Errors
400- Invalid body401- Invalid access token or initData401-{"error": "not_bound"}- Telegram user not bound to a namespace503- Telegram authentication disabled (TELEGRAM_BOT_TOKEN not configured)
POST /api/bind
Bind a Telegram account to a namespace using both Telegram initData and an access token.Request Body
Telegram Mini App initData string
CLI API token in format
CLI_API_TOKEN:<namespace>Response
Same as/api/auth response.
Example
Errors
400- Invalid body401- Invalid access token or initData409-{"error": "already_bound"}- Telegram user already bound to a different namespace503- Telegram authentication disabled
Token Format
The access token follows the format:- CLI_API_TOKEN - Base shared secret (configured via environment variable)
- namespace - Isolation identifier for multi-user/multi-project setups
Example
IfCLI_API_TOKEN=secret123, valid access tokens include:
secret123:defaultsecret123:myprojectsecret123:production