API Documentation
Base URL: https://disstat-api.tomatenkuchen.com/v1/
Authentification can be done using the Authorization
header or the apikey
query parameter.
The API key can be found on your dashboard and is the same for all of your bots.
Getting bot data
This endpoint returns the basic data DisStat has stored about the bot, like it's username and avatar.
If the bot is private, an API key authorized for the bot must be provided in the Authorization header.
Method: GET
URL: https://disstat-api.tomatenkuchen.com/v1/bot/<Bot ID>
Headers:
Name | Type | Description | Required |
---|---|---|---|
Authorization | string | API key authorized for the bot from the DisStat dashboard. | Only if the bot is private. |
Query parameters:
Name | Type | Description | Default value |
---|---|---|---|
returnStats | boolean | Whether the stats should be returned. | false |
dataPoints | number | Amount of data points to return if returnStats is enabled. | 90 |
start | number | The start date to filter the data by if returnStats is enabled. Defaults to no start date. | None |
end | number | The end date to filter the data by if returnStats is enabled. Defaults to no end date. | None |
Posting bot data
Post current bot and process statistics of your bot to DisStat.
This endpoint should be called at least every three minutes (value used by uptime tracking to determine if a bot is offline),
but you may post up to once a minute.
Method: POST
URL: https://disstat-api.tomatenkuchen.com/v1/bot/<Bot ID>
Headers:
Name | Type | Description | Required |
---|---|---|---|
Authorization | string | API key authorized for the bot from the DisStat dashboard. | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
guilds | number | The amount of guilds (servers) the bot is in | Yes |
users | number | The amount of users the bot can see across all servers | No |
shards | number | The amount of shards the bot is running with | No |
apiPing | number | The time in milliseconds how long a ping from/to Discord takes | No |
ramUsage | number | The amount of memory/RAM the bot's process is using currently, in bytes | No |
ramTotal | number | The amount of memory/RAM the bot could use theoretically, in bytes | No |
cpu | number | The current cpu usage of the bot's process | No |
bandwidth | number | The current bandwidth usage of the bot's process, in bytes | No |
custom | Array of objects, see Posting to custom graphs for the structure |
You can send any data this way, and DisStat will try to store it somehow.
This can be used for simple custom graphs like the total amount of tickets created, or the amount of channels your bot sees - but you can also post an array of objects to create a custom graph. If you're posting a property which we haven't seen before and you have enough unused custom graph slots, it will be automatically created as custom graph. |
No |
Posting to custom graphs
Stores a custom graph value for the bot without relying on the bot autoposting it using the endpoint above.
Libraries can implement wrappers around this, like the postCommand()
function from the official disstat
npm package.
Method: POST
URL: https://disstat-api.tomatenkuchen.com/v1/bot/<Bot ID>/custom
Headers:
Name | Type | Description | Required |
---|---|---|---|
Authorization | string | API key authorized for the bot from the DisStat dashboard. | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
type | string | The name of the custom graph. | Yes |
value1 | number|string | The first value as argument for the type | No |
value2 | number|string | The second value as argument for the type | No |
value3 | number|string | The third value as argument for the type | No |