Skip to content
MGRAMKnowledge Base

Bot statistics and management API

Bot data, orders, income, and settings via the Bot API key.

Updated October 16, 20262 min read3 views

With a Bot API key your server can get the bot's statistics and change its settings — without opening @mgram_robot. Handy if you have many bots or your own control panel.

The key

  • The Bot API key is in the bot card: “Settings” → “API key”.
  • Every request is sent with the header Authorization: Bearer YOUR_BOT_API_KEY.
  • POST /key/regenerate issues a new key. The full key is shown only once; the old one stops working immediately.

What you can get

MethodWhat it returns
GET /botBot information
GET /audienceThe audience without user IDs: total, Premium, verified, with avatar, bio, and gifts, blocked, geo
GET /ordersBroadcast orders the bot took part in
GET /orders/{id} and /orders/{id}/reportBroadcast details and report
GET /reply-ads/ordersReply Ads orders in the bot
GET /stats/mailings and /stats/mailings/todayBroadcasts by day and today
GET /stats/reply-adsReply Ads statistics
GET /stats/income and /stats/income/todayIncome by day and today
GET /earningsEarnings: today, pending, total
GET /balanceThe owner's balance

What you can change

MethodWhat it does
POST /bot/settingsSlots, speed, catalog, own orders, broadcast participation, catalog price, Reply Ads
GET /bot/time_slotsAvailable slots and the current selection
POST /bot/stop_mailingTurns off participation in new broadcasts; assigned orders continue
POST /bot/tokenReplaces the Telegram bot token — only with a token of the same bot

Only settings available to the owner in the MGRAM interface can be changed, and only with allowed values.

Errors

All errors come in one format. Main codes:

CodeWhat it means
400Bad request — check the parameters
401Key not accepted
403No access to the operation
404Not found
409Request conflict
429Too many requests — retry later
5xxTemporary service error — retry later

Keep the Bot API key only on your server. Don't put it into the code of a Mini App, website, or client app.

Parameters and response examples for every method are at api.mgram.biz.