Bots · Developer account
createBot
Create a new bot
This method authenticates with your developer account. The easiest way to call it is the dashboard, which signs the request for you. Direct calls need a dashboard session cookie.
Creates a bot owned by the caller and issues one live token and one test token. Tokens are shown ONCE in the response and never stored (only HMAC-SHA256(token, BOT_TOKEN_PEPPER) is kept); they cannot be retrieved again. If token issuance fails, the bot row is rolled back (deleted). Token format: sxb_<live|test>_<48 base64url chars> (36 random bytes, 288 bits).
Request
curl https://api.sprintelex.com/createBot \
# authenticated with your dashboard session \
-H "Content-Type: application/json" \
-d '{"name":"My Bot","username":"mybot_bot"}'Parameters
| Name | Type | Required | Rules |
|---|---|---|---|
| name | string | Yes | trimmed; 1-64 characters |
| username | string | Yes | trimmed and lowercased; 5-32 chars; only a-z, 0-9, underscore; must end in 'bot'; reserved names blocked (sprintelexbot, officialbot, supportbot, adminbot, systembot, securitybot, helpbot, infobot, teambot, staffbot, billingbot, paymentbot, paymentsbot, moolrebot, moderatorbot, modbot, and anything containing 'sprintelex'); must be unique |
| description | string | No | trimmed; at most 512 characters |
| avatar_url | string | No | must be an https URL when provided |
Response
{ ok: true, result: { bot: { id, name, username, avatar_url, description, created_at }, live_token, test_token, warning: 'Tokens are shown once. Save them now - they cannot be retrieved again.' } }Rate limit: none in code
Errors
| Status | Error | When |
|---|---|---|
| 500 | server misconfigured | BOT_TOKEN_PEPPER env is not set (fails closed) |
| 400 | name must be 1-64 characters | name empty or longer than 64 |
| 400 | username must be 5-32 characters | username length out of range |
| 400 | username may only contain a-z, 0-9 and underscore | illegal characters |
| 400 | bot usernames must end in 'bot' | username does not end in 'bot' |
| 400 | that username is reserved | blocked or contains 'sprintelex' |
| 400 | description must be at most 512 characters | description longer than 512 |
| 400 | avatar_url must be an https URL | avatar_url not https |
| 409 | username is taken | username already exists (also race-guarded via unique violation) |
| 500 | could not create bot | DB insert failed |
| 500 | could not issue tokens | token insert failed; bot row rolled back |