Skip to content

Admin API

To manage bots, the platform provides a simple and convenient HTTP API for admins.

Authorization

To access the admin functionality, a secret key is required, which is stored on the server in a ADMIN_SECRET_KEY environment variable. All requests described below should be executed with the Authorization header:

Authorization: <YOUR_ADMIN_SECRET_KEY>

Create a bot

The following route with a body in JSON format is used to create a new bot:

POST /v1/admin-api/bot
{
    "name": "Bot name",
    "description": "Just some info about bot.",
    "avatar": "https://google.com/image.png"
}
Body parameter Description
name Required
A name for the new bot.
description Required
A brief description of what your bot will do.
avatar Optional
Link to an image (avatar) for your bot.

As a result you will get response like this:

{
    "bot": {
        "id": "01hc76p6ma76qfrs0bfr5x2pry",
        "name": "Test bot",
        "description": "Just testing bot.",
        "avatar": "https://google.com/image.png"
    },
    "key": "01hc76p6ma76qfrs0bfr5x2pry:hNBKVJQLAcD2S7xJMnVSkzKkfi"
}
  • bot.id a unique identifier that is required to perform other operations on this bot.
  • key is access key, which is required to control the new bot.

Delete a bot

To remove a bot uses the following request:

DELETE /v1/admin-api/bot/:id

Get a bot's access key

To get the bot access key, use:

GET /v1/admin-api/bot/:id/key

As a result you will get response like this:

{
    "key": "01hc76p6ma76qfrs0bfr5x2pry:hNBKVJQLAcD2S7xJMnVSkzKkfi"
}

Refresh a bot's access key

To recreate the access key and update its value, use:

PUT /v1/admin-api/bot/:id/key

As a result you will get response like this:

{
    "key": "01hc76p6ma76qfrs0bfr5x2pry:s0PWbovTQpmuCLKKaxuruOleaX"
}

Reload server config

To apply the changes made to config file without rebooting the server, use the following request:

PUT /v1/admin-api/config