REST API v1 · Разработчикам · Справочник API

Справочник API: Модерация

Все 9 эндпоинтов раздела «Модерация» в REST API BotGG v1: права, параметры, поля, ошибки и готовые примеры на curl, JavaScript и Python.

Документация для разработчиков
На этой странице

Эндпоинты

Пути указаны относительно https://console.botgg.app/api/v1. Передавайте API-ключ в заголовке Authorization: Bearer botgg_…; ID — строки.

Эндпоинты: Модерация
ЭндпоинтПравоОписание
GET/guilds/{guildId}/moderation/casesmoderation:readList moderation cases
GET/guilds/{guildId}/moderation/cases/{number}moderation:readGet a moderation case
POST/guilds/{guildId}/moderation/users/{userId}/warnmoderation:writeWarn a member
POST/guilds/{guildId}/moderation/users/{userId}/timeoutmoderation:writeTime out a member
POST/guilds/{guildId}/moderation/users/{userId}/untimeoutmoderation:writeRemove a member’s timeout
POST/guilds/{guildId}/moderation/users/{userId}/kickmoderation:writeKick a member
POST/guilds/{guildId}/moderation/users/{userId}/banmoderation:writeBan a user
POST/guilds/{guildId}/moderation/users/{userId}/unbanmoderation:writeUnban a user
GET/guilds/{guildId}/moderation/actions/{actionId}moderation:writeGet the result of a moderation action

Кроме собственных ошибок (см. ниже), любой эндпоинт может вернуть эти общие:

List moderation cases

GET/guilds/{guildId}/moderation/cases

Право: moderation:readЧувствительное

Newest first (deleted cases are left out). Pass before=<nextCursor> for the next page.

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
actionquerystringНетОдно из warn, timeout, untimeout, kick, ban, tempban, softban, unban, note, purge
sourcequerystringНетОдно из command, automod, escalation, antiraid, antinuke, console, api
userIdquerystringНетOnly cases against this user
Discord ID (строка)
moderatorIdquerystringНетDiscord ID (строка)
activequerystringНет1 = only running warnings / timeouts / tempbans
Одно из 1, 0, true, false
limitqueryintegerНет1–100 · По умолчанию 25
beforequeryintegerНет1–999 999 999

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
itemsarray of objectДа
items[].numberintegerДа
items[].actionstringДаОдно из warn, timeout, untimeout, kick, ban, tempban, softban, unban, note, purge
items[].userIdstringДаThe target
items[].userTagstring | nullДа
items[].moderatorIdstringДа
items[].reasonstring | nullДа
items[].durationSecondsinteger | nullДа
items[].evidencearray of stringДа
items[].sourcestringДаОдно из command, automod, escalation, antiraid, antinuke, console, api
items[].activebooleanДа
items[].expiresAtstring | nullДаISO 8601 date-time
items[].resolvedAtstring | nullДаISO 8601 date-time
items[].dmStatusstring | nullДаОдно из sent, failed, off
items[].apiKeyobject | nullДаSet when the action was made with an API key
items[].apiKey.idinteger | nullДа
items[].apiKey.namestring | nullДа
items[].createdAtstring | nullДаISO 8601 date-time
nextCursorstring | nullДа
Ответ · 200
{
  "items": [
    {
      "number": 7,
      "action": "warn",
      "userId": "876543210987654321",
      "userTag": "example",
      "moderatorId": "234567890123456789",
      "reason": "Tournament prize",
      "durationSeconds": 3600,
      "evidence": [
        "example"
      ],
      "source": "command",
      "active": true,
      "expiresAt": "2026-10-07T12:00:00.000Z",
      "resolvedAt": "2026-10-07T12:00:00.000Z",
      "dmStatus": "sent",
      "apiKey": {
        "id": 98765,
        "name": "Example"
      },
      "createdAt": "2026-10-07T12:00:00.000Z"
    }
  ],
  "nextCursor": "98700"
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases?limit=25" \
  -H "Authorization: Bearer $BOTGG_API_KEY"
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases?limit=25', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os
import requests

res = requests.get(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
    },
    params={
        "limit": 25,
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Ошибки
HTTPКоды
409FEATURE_DISABLED
503SERVICE_UNAVAILABLE

Get a moderation case

GET/guilds/{guildId}/moderation/cases/{number}

Право: moderation:readЧувствительное

With its timeline (created, reason / evidence edits, DM, expired, revoked, escalated).

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
numberпутьstringДа

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
numberintegerДа
actionstringДаОдно из warn, timeout, untimeout, kick, ban, tempban, softban, unban, note, purge
userIdstringДаThe target
userTagstring | nullДа
moderatorIdstringДа
reasonstring | nullДа
durationSecondsinteger | nullДа
evidencearray of stringДа
sourcestringДаОдно из command, automod, escalation, antiraid, antinuke, console, api
activebooleanДа
expiresAtstring | nullДаISO 8601 date-time
resolvedAtstring | nullДаISO 8601 date-time
dmStatusstring | nullДаОдно из sent, failed, off
apiKeyobject | nullДаSet when the action was made with an API key
apiKey.idinteger | nullДа
apiKey.namestring | nullДа
createdAtstring | nullДаISO 8601 date-time
eventsarray of objectДа
events[].typestringДа
events[].actorIdstring | nullДа
events[].dataanyДа
events[].createdAtstring | nullДаISO 8601 date-time
Ответ · 200
{
  "number": 7,
  "action": "warn",
  "userId": "876543210987654321",
  "userTag": "example",
  "moderatorId": "234567890123456789",
  "reason": "Tournament prize",
  "durationSeconds": 3600,
  "evidence": [
    "example"
  ],
  "source": "command",
  "active": true,
  "expiresAt": "2026-10-07T12:00:00.000Z",
  "resolvedAt": "2026-10-07T12:00:00.000Z",
  "dmStatus": "sent",
  "apiKey": {
    "id": 98765,
    "name": "Example"
  },
  "createdAt": "2026-10-07T12:00:00.000Z",
  "events": [
    {
      "type": "example",
      "actorId": "234567890123456789",
      "data": null,
      "createdAt": "2026-10-07T12:00:00.000Z"
    }
  ]
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases/234567890123456789" \
  -H "Authorization: Bearer $BOTGG_API_KEY"
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases/234567890123456789', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os
import requests

res = requests.get(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/cases/234567890123456789",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Ошибки
HTTPКоды
404CASE_NOT_FOUND
409FEATURE_DISABLED
503SERVICE_UNAVAILABLE

Warn a member

POST/guilds/{guildId}/moderation/users/{userId}/warn

Право: moderation:writeЧувствительноеIdempotency-Key

Same as /warn: a warning case (counts toward escalation), DM per the Moderation settings. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
userIdпутьstringДаDiscord ID участника · Discord ID (строка)
Idempotency-KeyзаголовокstringНетНеобязательно. Передайте уникальное значение (UUID) и повторяйте его при ретраях — операция выполнится один раз. Как это работает

Тело запроса

Тело запроса
ПолеТипОбязательноеОписание
reasonstringДаRequired. Shown in the case, the mod log and the member’s DM
1–500 символов
evidencearray of stringНетUp to 5 links
до 5 элементов

Ответ

Поля ответа · 202
ПолеТипОбязательноеОписание
actionIdstringДа
actionstringДаОдно из warn, timeout, untimeout, kick, ban, unban
userIdstringДа
statusstringДаОдно из pending, running, done, failed
caseNumberinteger | nullДа
errorstring | nullДаRefusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS)
requestedAtstring | nullДаISO 8601 date-time
Ответ · 202
{
  "actionId": "234567890123456789",
  "action": "warn",
  "userId": "876543210987654321",
  "status": "pending",
  "caseNumber": 10,
  "error": "example",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Примеры

curl
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/warn" \
  -H "Authorization: Bearer $BOTGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"reason":"Tournament prize","evidence":["example"]}'
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/warn', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
  },
  body: JSON.stringify({
    reason: 'Tournament prize',
    evidence: [
      'example',
    ],
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os, uuid
import requests

res = requests.post(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/warn",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),  # reuse it when you retry this request
    },
    json={
        "reason": "Tournament prize",
        "evidence": [
            "example",
        ],
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Time out a member

POST/guilds/{guildId}/moderation/users/{userId}/timeout

Право: moderation:writeЧувствительноеIdempotency-Key

Same as /timeout: Discord timeout for durationSeconds, a case, DM per the settings. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
userIdпутьstringДаDiscord ID участника · Discord ID (строка)
Idempotency-KeyзаголовокstringНетНеобязательно. Передайте уникальное значение (UUID) и повторяйте его при ретраях — операция выполнится один раз. Как это работает

Тело запроса

Тело запроса
ПолеТипОбязательноеОписание
reasonstringДаRequired. Shown in the case, the mod log and the member’s DM
1–500 символов
durationSecondsintegerДа1 minute to 28 days
60–2 419 200
evidencearray of stringНетUp to 5 links
до 5 элементов

Ответ

Поля ответа · 202
ПолеТипОбязательноеОписание
actionIdstringДа
actionstringДаОдно из warn, timeout, untimeout, kick, ban, unban
userIdstringДа
statusstringДаОдно из pending, running, done, failed
caseNumberinteger | nullДа
errorstring | nullДаRefusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS)
requestedAtstring | nullДаISO 8601 date-time
Ответ · 202
{
  "actionId": "234567890123456789",
  "action": "warn",
  "userId": "876543210987654321",
  "status": "pending",
  "caseNumber": 10,
  "error": "example",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Примеры

curl
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/timeout" \
  -H "Authorization: Bearer $BOTGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"reason":"Tournament prize","durationSeconds":3600,"evidence":["example"]}'
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/timeout', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
  },
  body: JSON.stringify({
    reason: 'Tournament prize',
    durationSeconds: 3600,
    evidence: [
      'example',
    ],
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os, uuid
import requests

res = requests.post(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/timeout",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),  # reuse it when you retry this request
    },
    json={
        "reason": "Tournament prize",
        "durationSeconds": 3600,
        "evidence": [
            "example",
        ],
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Remove a member’s timeout

POST/guilds/{guildId}/moderation/users/{userId}/untimeout

Право: moderation:writeЧувствительноеIdempotency-Key

Same as /untimeout. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
userIdпутьstringДаDiscord ID участника · Discord ID (строка)
Idempotency-KeyзаголовокstringНетНеобязательно. Передайте уникальное значение (UUID) и повторяйте его при ретраях — операция выполнится один раз. Как это работает

Тело запроса

Тело запроса
ПолеТипОбязательноеОписание
reasonstringДаRequired. Shown in the case, the mod log and the member’s DM
1–500 символов

Ответ

Поля ответа · 202
ПолеТипОбязательноеОписание
actionIdstringДа
actionstringДаОдно из warn, timeout, untimeout, kick, ban, unban
userIdstringДа
statusstringДаОдно из pending, running, done, failed
caseNumberinteger | nullДа
errorstring | nullДаRefusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS)
requestedAtstring | nullДаISO 8601 date-time
Ответ · 202
{
  "actionId": "234567890123456789",
  "action": "warn",
  "userId": "876543210987654321",
  "status": "pending",
  "caseNumber": 10,
  "error": "example",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Примеры

curl
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/untimeout" \
  -H "Authorization: Bearer $BOTGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"reason":"Tournament prize"}'
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/untimeout', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
  },
  body: JSON.stringify({
    reason: 'Tournament prize',
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os, uuid
import requests

res = requests.post(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/untimeout",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),  # reuse it when you retry this request
    },
    json={
        "reason": "Tournament prize",
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Kick a member

POST/guilds/{guildId}/moderation/users/{userId}/kick

Право: moderation:writeЧувствительноеIdempotency-Key

Same as /kick: DM (before the kick) per the settings, then the kick and a case. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
userIdпутьstringДаDiscord ID участника · Discord ID (строка)
Idempotency-KeyзаголовокstringНетНеобязательно. Передайте уникальное значение (UUID) и повторяйте его при ретраях — операция выполнится один раз. Как это работает

Тело запроса

Тело запроса
ПолеТипОбязательноеОписание
reasonstringДаRequired. Shown in the case, the mod log and the member’s DM
1–500 символов
evidencearray of stringНетUp to 5 links
до 5 элементов

Ответ

Поля ответа · 202
ПолеТипОбязательноеОписание
actionIdstringДа
actionstringДаОдно из warn, timeout, untimeout, kick, ban, unban
userIdstringДа
statusstringДаОдно из pending, running, done, failed
caseNumberinteger | nullДа
errorstring | nullДаRefusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS)
requestedAtstring | nullДаISO 8601 date-time
Ответ · 202
{
  "actionId": "234567890123456789",
  "action": "warn",
  "userId": "876543210987654321",
  "status": "pending",
  "caseNumber": 10,
  "error": "example",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Примеры

curl
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/kick" \
  -H "Authorization: Bearer $BOTGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"reason":"Tournament prize","evidence":["example"]}'
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/kick', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
  },
  body: JSON.stringify({
    reason: 'Tournament prize',
    evidence: [
      'example',
    ],
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os, uuid
import requests

res = requests.post(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/kick",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),  # reuse it when you retry this request
    },
    json={
        "reason": "Tournament prize",
        "evidence": [
            "example",
        ],
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Ban a user

POST/guilds/{guildId}/moderation/users/{userId}/ban

Право: moderation:writeЧувствительноеIdempotency-Key

Same as /ban: with durationSeconds a temporary ban the bot lifts automatically; deleteMessageSeconds deletes recent messages. Works for users who already left. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
userIdпутьstringДаDiscord ID участника · Discord ID (строка)
Idempotency-KeyзаголовокstringНетНеобязательно. Передайте уникальное значение (UUID) и повторяйте его при ретраях — операция выполнится один раз. Как это работает

Тело запроса

Тело запроса
ПолеТипОбязательноеОписание
reasonstringДаRequired. Shown in the case, the mod log and the member’s DM
1–500 символов
deleteMessageSecondsintegerНетDelete the user’s messages of the last N seconds (≤ 7 days)
0–604 800
durationSecondsinteger | nullНетTemporary ban (≤ 365 days); omit for a permanent ban
60–31 536 000
evidencearray of stringНетUp to 5 links
до 5 элементов

Ответ

Поля ответа · 202
ПолеТипОбязательноеОписание
actionIdstringДа
actionstringДаОдно из warn, timeout, untimeout, kick, ban, unban
userIdstringДа
statusstringДаОдно из pending, running, done, failed
caseNumberinteger | nullДа
errorstring | nullДаRefusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS)
requestedAtstring | nullДаISO 8601 date-time
Ответ · 202
{
  "actionId": "234567890123456789",
  "action": "warn",
  "userId": "876543210987654321",
  "status": "pending",
  "caseNumber": 10,
  "error": "example",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Примеры

curl
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/ban" \
  -H "Authorization: Bearer $BOTGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"reason":"Tournament prize","deleteMessageSeconds":3600,"durationSeconds":3600,"evidence":["example"]}'
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/ban', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
  },
  body: JSON.stringify({
    reason: 'Tournament prize',
    deleteMessageSeconds: 3600,
    durationSeconds: 3600,
    evidence: [
      'example',
    ],
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os, uuid
import requests

res = requests.post(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/ban",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),  # reuse it when you retry this request
    },
    json={
        "reason": "Tournament prize",
        "deleteMessageSeconds": 3600,
        "durationSeconds": 3600,
        "evidence": [
            "example",
        ],
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Unban a user

POST/guilds/{guildId}/moderation/users/{userId}/unban

Право: moderation:writeЧувствительноеIdempotency-Key

Same as /unban (ends a running tempban). 409 NOT_BANNED when the user isn’t banned. Acts in the name of the key’s creator, who must still have the matching Discord permission; the target must be below their and the bot’s highest role (never the owner, the bot or the creator). The bot runs it within a few seconds — poll GET …/moderation/actions/{actionId}. At most 10 actions a minute per key. Written to the audit log.

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
userIdпутьstringДаDiscord ID участника · Discord ID (строка)
Idempotency-KeyзаголовокstringНетНеобязательно. Передайте уникальное значение (UUID) и повторяйте его при ретраях — операция выполнится один раз. Как это работает

Тело запроса

Тело запроса
ПолеТипОбязательноеОписание
reasonstringДаRequired. Shown in the case, the mod log and the member’s DM
1–500 символов

Ответ

Поля ответа · 202
ПолеТипОбязательноеОписание
actionIdstringДа
actionstringДаОдно из warn, timeout, untimeout, kick, ban, unban
userIdstringДа
statusstringДаОдно из pending, running, done, failed
caseNumberinteger | nullДа
errorstring | nullДаRefusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS)
requestedAtstring | nullДаISO 8601 date-time
Ответ · 202
{
  "actionId": "234567890123456789",
  "action": "warn",
  "userId": "876543210987654321",
  "status": "pending",
  "caseNumber": 10,
  "error": "example",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Примеры

curl
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/unban" \
  -H "Authorization: Bearer $BOTGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"reason":"Tournament prize"}'
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/unban', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
  },
  body: JSON.stringify({
    reason: 'Tournament prize',
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os, uuid
import requests

res = requests.post(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/users/876543210987654321/unban",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),  # reuse it when you retry this request
    },
    json={
        "reason": "Tournament prize",
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Get the result of a moderation action

GET/guilds/{guildId}/moderation/actions/{actionId}

Право: moderation:writeЧувствительное

Only actions made with the same API key. done → caseNumber; failed → error (the bot re-checks everything right before acting).

На сервере должен быть включён модуль: Модерация

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
actionIdпутьstringДа

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
actionIdstringДа
actionstringДаОдно из warn, timeout, untimeout, kick, ban, unban
userIdstringДа
statusstringДаОдно из pending, running, done, failed
caseNumberinteger | nullДа
errorstring | nullДаRefusal code when failed (e.g. HIERARCHY_HIGHER, MODERATOR_MISSING_PERMISSION, NOT_BANNED, BOT_MISSING_PERMISSIONS)
requestedAtstring | nullДаISO 8601 date-time
Ответ · 200
{
  "actionId": "234567890123456789",
  "action": "warn",
  "userId": "876543210987654321",
  "status": "pending",
  "caseNumber": 10,
  "error": "example",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/actions/234567890123456789" \
  -H "Authorization: Bearer $BOTGG_API_KEY"
JavaScript (fetch)
// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/actions/234567890123456789', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os
import requests

res = requests.get(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/moderation/actions/234567890123456789",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Готовы прокачать свой сервер?

Добавьте BotGG бесплатно и включайте нужные функции в веб-консоли.