Kirino provides a REST API you can use to retrieve a server's XP datas.
The API URL is https://kirino.xyz/api/v1/leaderboards
. You must give some informations to the API in order to get a leaderboard, using GET parameters:
id
parameter is the only one required and should be a valid server's ID.limit
parameter allow you to modify the number of leaderboard entries that will be returned. By default, the 20 first entries are returned. Using this parameter, you can change this number by anything between 1 and 100. This is limited for performance reasons.page
parameter is the page you want to access. You can imagine that the leaderboard is splitted in pages of the limit
parameter size. By default, the 1st page is returned, but you can access another page using this parameter (e.g., if you set limit
to 2 and page
to 2, you get the 3rd and 4th entries). The page must be > 0.An exemple would be to make a GET request to https://kirino.xyz/api/v1/leaderboards?id=742720465260380220&limit=1
.
Remember that only the id
parameter is required. If you don't set the others one, they will fall to their default values.
The API response contains JSON data. If the request is successful (the HTTP status code will be in the 2XX range), the JSON content will be formatted like this:
{
"guild_metadata": {
"id": "742720465260380220",
"name": "Kirino support",
"icon": "https://cdn.discordapp.com/icons/742720465260380220/5aaff0ff7d64fae1407fca1658897a36.png?size=128",
"players": 33
},
"players": [
{
"id": "327113301198766082",
"tag": "Elf",
"avatar": "https://cdn.discordapp.com/avatars/327113301198766082/d30b854d2d59a9e159603902f34fda07.webp?size=128",
"xp": 390,
"total_xp": 4110,
"level": 9,
"color": "#FF0000",
"rank": 1
}
]
}
The players
array will contain as many entries as you set it with the limit
parameter.
If an error occured (the status code isn't in the 2XX range), the JSON content will be like this:
{
"errors": [
"I didn't find the specified server. Please ensure that the ID you provided is a valid server ID and that Kirino has access to it."
]
}
Errors can happen for various reasons : too many requests too fast, no server ID provided, server not found, invalid limit, invalid page...
If you have any questions regarding the API, you can join the support Discord server to ask any questions.