The admin REST API is an aiohttp server running on port 8080, powering the React admin dashboard. Every endpoint requires Telegram WebApp authentication — unauthenticated or unauthorized requests are rejected before any handler logic runs.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AmiraliNotFound/dummy-gemini-bot/llms.txt
Use this file to discover all available pages before exploring further.
Base URL
localhost with the domain set in WEBAPP_URL. HTTPS is required in production — Telegram Mini Apps will refuse to load resources over plain HTTP from non-localhost origins.
Authentication
All requests must include the following header:<telegram_webapp_init_data> is the raw URL-encoded string exposed by the Telegram Mini App JavaScript SDK as window.Telegram.WebApp.initData.
How validation works
The server’scheck_auth() function performs three checks in order:
-
HMAC signature — The init data string is validated using HMAC-SHA256. The secret key is derived as:
The
hashfield embedded in the init data must match the HMAC of the sorted data-check string computed with that secret key. -
Session expiry — The
auth_datefield in the init data must be within 86400 seconds (24 hours) of the current server time. Older tokens are rejected to prevent replay attacks. -
Admin allowlist — The
user.usernamedecoded from the init data must appear (case-insensitively) in theALLOWED_ADMINSenvironment variable. Users not on the list receive403 Forbidden.
Example request
DEV_BYPASS
Response Format
All endpoints return JSON. Successful responses include astatus field (either "ok" or "success") along with any relevant data payload. Error responses follow this shape:
| Code | Meaning |
|---|---|
401 | Missing, empty, or cryptographically invalid Authorization header |
403 | Valid signature but the user is not in ALLOWED_ADMINS |
500 | Unexpected server-side or Telegram Bot API error |
CORS
The server is configured with aiohttp-cors. The allowed origin is read from theWEBAPP_URL environment variable at startup:
- If
WEBAPP_URLis set, only requests from that exact origin are accepted. - If
WEBAPP_URLis not set, the origin defaults to*(all origins).
WEBAPP_URL should be set to the domain of your admin Mini App so that only that origin can call the API.
Available Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/stats | Database stats, bandwidth usage, recent errors |
GET | /api/config | All runtime configuration keys |
POST | /api/config | Update one or more config keys |
GET | /api/chats | Recently active chats with metadata |
POST | /api/chat/settings | Update per-chat settings |
POST | /api/chat/leave | Bot leaves a chat |
POST | /api/chat/alert | Send alert to a chat |
GET | /api/chat/top_users | Top message senders in a chat |
GET | /api/blocked | All blocked users and groups |
POST | /api/block | Block a user or group |
POST | /api/unblock | Unblock a user or group |
GET | /api/specials | All VIP users and instructions |
POST | /api/specials | Add or update a VIP user |
POST | /api/specials/delete | Remove a VIP user |
POST | /api/broadcast | Broadcast message to all chats |
POST | /api/upload_cookies | Upload yt-dlp cookies.txt |
POST | /api/update_ytdlp | Trigger yt-dlp upgrade |
GET | /api/model_limits | Per-model RPM/RPD usage stats |
POST | /api/chat/send_profile_link | Send profile link to DM user |