SubGram API Documentation
Everything you need to integrate your services with our platform.
Getting started
The SubGram API provides programmatic access to our platform's features. You can manage bots, advertising orders, retrieve statistics and much more.
All API requests should be sent to the base URL:
Authentication
Interacting with the API requires an authentication key. Every request must include the HTTP header Auth with your key.
There are three main types of keys, each for its own purpose:
-
Access Key (Secret Key): 🔐 Your main and secret key for performing management actions: creating and updating orders (
/orders), adding and configuring bots (/bots).
How to get it: in our official bot @subgram_officialbot go toProfile → Access Key (Secret Key). Never share this key with anyone! -
Statistics Token (API Token): 📈 This token is intended only for retrieving data such as balance (
/get-balance) and statistics (/statistic).
How to get it: in the bot @subgram_officialbot go toProfile → Copy api token. -
Bot Key (API Key): 🤖 Generated for each added bot. Used for requests on behalf of a specific bot: getting sponsors (
/get-sponsors) and checking subscriptions (/get-user-subscriptions).
Header example
Auth: YOUR_SECRET_ACCESS_KEY
Response structure
All API responses come in JSON format. Successful responses and errors share a standardized structure for predictable handling.
Example of a successful response (HTTP 200 OK)
{
"status": "ok",
"code": 200,
"message": "Operation completed successfully",
"result": { ... }
}
result or response depending on the endpoint. Always check the documentation for the specific method.
Example of an error response (HTTP 4xx/5xx)
{
"status": "error",
"code": 401,
"message": "Invalid API token"
}