Kiai API

Learn how to use Kiai's public API to extend the bot's functionality.

Kiai API

Kiai provides a public API that lets developers extend the bot's functionality.

API Endpoints

Find the full list of endpoints and request/response shapes at https://kiai.app/api/v2/docs.

Every endpoint is scoped to a server (guildId) and requires a specific permission on your application:

MethodPathPermission required
GET/api/v2/meAny valid token
POST/api/v2/virtual_messageLevels
GET/api/v2/:guildId/leaderboardLevels
GET/api/v2/:guildId/member/:userIdLevels
PATCH/api/v2/:guildId/member/:userId/xpLevels
PUT/api/v2/:guildId/member/:userId/xpLevels
GET/api/v2/:guildId/settingsLevels
GET, POST, DELETE/api/v2/:guildId/denylistDenylist
GET, POST, DELETE/api/v2/:guildId/multipliersMultipliers
GET, POST, DELETE/api/v2/:guildId/rewardsRewards
GET, POST, DELETE/api/v2/:guildId/leaderboard-rolesRewards

GET /api/v2/me returns your application's own ID, owning user, rate limit, and the list of permissions it holds in each authorized server. Use it to confirm your token works and to check what it can do.


Getting an Application

To call the API, you need an application and its key (also called a token).

  1. Go to your Kiai Dashboard and open API Applications.
  2. Create a new application with a name and a Discord application ID.
  3. Copy the key shown on the application's page. Kiai only shows the full key here; store it somewhere safe.

If you believe your key has leaked, regenerate it from the same page. Regenerating replaces the old key immediately, and any requests using the old key stop working right away.


Authorizing an Application to a Server

An application must be authorized to each server it accesses, similar to how a Discord bot must be added to a server.

Use the /application command in the server you want to connect. This command requires the Manage Server permission.

  • /application authorize <id> — Authorizes an application to the server and lets you choose which permissions to grant.
  • /application deauthorize <id> — Revokes a previously authorized application's access.
  • /application list — Lists every application currently authorized in the server.

You can also build an authorize link from your application's dashboard page and send it to a server manager, who can open it to grant access without needing the application's ID.


Permissions

Permissions determine what actions an application can perform. You grant them during authorization, and you can change them later by running /application authorize again.

Kiai stores permissions as an integer, with each permission assigned to one bit.

List of Permissions

Permission NameDescriptionBitValue
LevelsView and edit all levels and XP00x0001
MultipliersView and edit multipliers10x0002
ExportExport data from your server20x0004
DenylistView and edit the server's denylist30x0008
RewardsView and edit the server's rewards and leaderboard position roles40x0010

The value for every permission combined is 0x001F.


Authentication

Send your application's key as the Authorization header on every request. Do not add a Bearer prefix.

Authorization: <your-application-key>

Rate Limits

Each application has a rate limit of 60 requests per minute by default. You can raise this to 120 requests per minute from your application's dashboard page.

If you exceed your limit, Kiai responds with 429 Too Many Requests. Every response, not only rate-limited ones, includes these headers so you can track your usage:

  • x-ratelimit-limit
  • x-ratelimit-remaining
  • x-ratelimit-reset
  • x-ratelimit-reset-after

If 120 requests per minute is not enough for your use case, contact support.