This documentation will guide you through the process of updating your Discord bot's stats using our API.
To ensure your bot's stats are kept up to date, you'll need to send periodic updates about your bot’s guild count to the API. This should be done using a scheduled task in your bot's code, so it runs on a loop at regular intervals (e.g., every few minutes or hours, depending on your needs).
Once you’ve set up the loop, the data will be automatically saved in the server's db, which you can later use for analytics and tracking growth.
POST http://stats-pearl.vercel.app/api/UpdateStats
To authenticate the request, include your API key in the Authorization header:
Authorization: api_######
Replace api_######
with your actual API key.
The request body should be a JSON object containing the following data:
{
"guilds": number
}
Where guilds
is the number of guilds (servers) your bot is currently in.
Here's an example of how to make a request using curl:
curl --request POST \
--url 'http://127.0.0.1:8000/Updatestats' \
--header 'Authorization: api_######' \
--header 'Content-Type: application/json' \
--data '{
"guilds": 10000
}'
Upon a successful update, you should receive a response indicating that the stats were updated.
A successful response will look like:
{
"message": "Stats updated successfully"
}
If an error occurs, the API will return an appropriate HTTP status code along with an error message.
Here are the common errors:
Authorization
header.