For AI agents: markdown of this page — /docs-content-en/bots/commands/register.md documentation index — /llms.txt
Register a command
POST /v1/bots/:botId/commands
Registers a new bot slash command. Vibecode accepts a flat format and automatically wraps it in fields for Bitrix24.
Request fields (body)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
command |
string | yes | — | Command text without / (for example, help) |
title |
string/object | no | — | Title. A string or a multilingual object { "en": "Help", "de": "Hilfe" } |
params |
string/object | no | — | Parameter description. A string or an object { "en": "topic", "de": "Thema" } |
common |
string | no | "N" |
"Y" — available in all chats, "N" — only in a private chat with the bot and in chats that include the bot |
hidden |
string | no | "N" |
"Y" — hide from the command list |
extranetSupport |
string | no | "N" |
"Y" — available to extranet users |
The table lists every accepted field. A field with any other name is dropped and the request still succeeds: the response includes a warning object with the code UNSUPPORTED_FIELDS_DROPPED and the list of dropped names. Pass the descriptive text of the command in title and the argument hint in params.
Examples
curl — personal key
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/commands \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"command": "help",
"title": { "en": "Help", "de": "Hilfe" },
"params": { "en": "topic", "de": "Thema" },
"common": "Y"
}'
curl — OAuth application
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/commands \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"command": "help",
"title": { "en": "Help", "de": "Hilfe" },
"params": { "en": "topic", "de": "Thema" },
"common": "Y"
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/commands', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
command: 'help',
title: { en: 'Help', de: 'Hilfe' },
params: { en: 'topic', de: 'Thema' },
common: 'Y',
}),
})
const { success, data } = await res.json()
console.log('Command ID:', data.command.id)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/commands', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
command: 'help',
title: { en: 'Help', de: 'Hilfe' },
params: { en: 'topic', de: 'Thema' },
common: 'Y',
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
data.command.id |
number | ID of the registered command |
data.command.botId |
number | Bot ID |
data.command.command |
string | Command text (with /) |
data.command.common |
boolean | Available in all chats |
data.command.hidden |
boolean | Hidden from the list |
data.command.extranetSupport |
boolean | Available to extranet users |
warning.code |
string | UNSUPPORTED_FIELDS_DROPPED. Returned when the request body contained a field outside the "Request fields" table |
warning.message |
string | Text listing the dropped fields |
warning.droppedFields |
array | Names of the dropped fields |
Response example
The request body contained only accepted fields:
{
"success": true,
"data": {
"command": {
"id": 117,
"botId": 1327,
"command": "/help",
"common": true,
"hidden": false,
"extranetSupport": false
}
}
}
The request body contained a description field — the command was registered and the field was dropped:
{
"success": true,
"data": {
"command": {
"id": 117,
"botId": 1327,
"command": "/help",
"common": true,
"hidden": false,
"extranetSupport": false
}
},
"warning": {
"code": "UNSUPPORTED_FIELDS_DROPPED",
"message": "Bitrix24 imbot.v2.Command.register does not accept these fields; they were dropped: description.",
"droppedFields": ["description"]
}
}
Error response example
422 — Bitrix24 error:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "Command 'help' already registered"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_BOT_ID |
botId is not a number |
| 404 | BOT_NOT_FOUND |
No bot found with this ID |
| 403 | BOT_ACCESS_DENIED |
The bot belongs to a different API key |
| 422 | BITRIX_ERROR |
Bitrix24 error (error text in message) |
| 403 | SCOPE_DENIED |
The API key does not have the imbot scope |
| 401 | TOKEN_MISSING |
The API key has no configured tokens |
Full list of common API errors — Errors.
Known specifics
Idempotency: a repeat call with the same command for the same bot returns the existing command unchanged. To update it, use PATCH.
Multilingual: title and params accept either a string or an object with language keys, for example en, de, ru. A plain string is stored as the English translation, so use an object to set the other languages: { "en": "Help", "de": "Hilfe" }.
Event: when a user invokes the command, the ONIMBOTV2COMMANDADD event fires.