REST API v1 · Разработчикам · Справочник API
Справочник API: Приглашения и награды
Все 3 эндпоинта раздела «Приглашения и награды» в REST API BotGG v1: права, параметры, поля, ошибки и готовые примеры на curl, JavaScript и Python.
Документация для разработчиков
На этой странице
Эндпоинты
Пути указаны относительно https://console.botgg.app/api/v1. Передавайте API-ключ в заголовке Authorization: Bearer botgg_…; ID — строки.
| Эндпоинт | Право | Описание |
|---|---|---|
GET/guilds/{guildId}/invites/members/{userId} | invites:read | Get a member’s invites |
GET/guilds/{guildId}/invites/leaderboard | invites:read | Invites leaderboard |
POST/guilds/{guildId}/invites/members/{userId}/bonus | invites:write | Add or remove bonus invites |
Кроме собственных ошибок (см. ниже), любой эндпоинт может вернуть эти общие:
Get a member’s invites
GET/guilds/{guildId}/invites/members/{userId}
Invite counters, all-time rank and the active season’s count and rank. Members who invited nobody get zeros.
На сервере должен быть включён модуль: Приглашения и награды
| Имя | Где | Тип | Обязательное | Описание |
|---|---|---|---|---|
guildId | путь | string | Да | ID вашего сервера · Discord ID (строка) |
userId | путь | string | Да | Discord ID участника · Discord ID (строка) |
Ответ
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
userId | string | Да | |
invites | integer | Да | verified + bonus (never below 0) — what milestones and the leaderboard use |
verified | integer | Да | |
pending | integer | Да | |
left | integer | Да | |
fake | integer | Да | |
bonus | integer | Да | |
total | integer | Да | |
rank | integer | null | Да | |
season | object | null | Да | The active season, if any |
season.id | integer | Да | |
season.number | integer | Да | |
season.name | string | null | Да | |
season.startsAt | string | null | Да | |
season.endsAt | string | null | Да | |
season.invites | integer | Да | |
season.rank | integer | null | Да |
{
"userId": "876543210987654321",
"invites": 10,
"verified": 10,
"pending": 10,
"left": 10,
"fake": 10,
"bonus": 10,
"total": 10,
"rank": 1,
"season": {
"id": 98765,
"number": 7,
"name": "Example",
"startsAt": "2026-10-07T12:00:00.000Z",
"endsAt": "2026-10-07T12:00:00.000Z",
"invites": 10,
"rank": 1
}
}Примеры
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/invites/members/876543210987654321" \
-H "Authorization: Bearer $BOTGG_API_KEY"// 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/invites/members/876543210987654321', {
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);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/invites/members/876543210987654321",
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 | Коды |
|---|---|
| 409 | FEATURE_DISABLED |
| 503 | SERVICE_UNAVAILABLE |
Invites leaderboard
GET/guilds/{guildId}/invites/leaderboard
period=all ranks by invites (verified + bonus), period=season by the active season’s invites (empty without a season). Pass cursor=<nextCursor> for the next page.
На сервере должен быть включён модуль: Приглашения и награды
| Имя | Где | Тип | Обязательное | Описание |
|---|---|---|---|---|
guildId | путь | string | Да | ID вашего сервера · Discord ID (строка) |
period | query | string | Нет | Одно из all, season · По умолчанию "all" |
limit | query | integer | Нет | 1–100 · По умолчанию 25 |
cursor | query | integer | Нет | 0–10 000 000 · По умолчанию 0 |
Ответ
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
period | string | Да | Одно из all, season |
season | object | null | Да | |
season.id | integer | Да | |
season.number | integer | Да | |
season.name | string | null | Да | |
season.startsAt | string | null | Да | |
season.endsAt | string | null | Да | |
items | array of object | Да | |
items[].rank | integer | Да | |
items[].userId | string | Да | |
items[].score | integer | Да | |
items[].invites | integer | Да | |
items[].verified | integer | Да | |
items[].bonus | integer | Да | |
total | integer | Да | |
nextCursor | string | null | Да |
{
"period": "all",
"season": {
"id": 98765,
"number": 7,
"name": "Example",
"startsAt": "2026-10-07T12:00:00.000Z",
"endsAt": "2026-10-07T12:00:00.000Z"
},
"items": [
{
"rank": 1,
"userId": "876543210987654321",
"score": 10,
"invites": 10,
"verified": 10,
"bonus": 10
}
],
"total": 10,
"nextCursor": "98700"
}Примеры
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/invites/leaderboard?period=all&limit=25&cursor=0" \
-H "Authorization: Bearer $BOTGG_API_KEY"// 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/invites/leaderboard?period=all&limit=25&cursor=0', {
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);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/invites/leaderboard",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
params={
"period": "all",
"limit": 25,
"cursor": 0,
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)Ошибки
| HTTP | Коды |
|---|---|
| 409 | FEATURE_DISABLED |
| 503 | SERVICE_UNAVAILABLE |
Add or remove bonus invites
POST/guilds/{guildId}/invites/members/{userId}/bonus
Same as /invites add|remove. Counts toward the active season; milestone rewards for additions are granted by the bot within a minute. Written to the audit log.
На сервере должен быть включён модуль: Приглашения и награды
| Имя | Где | Тип | Обязательное | Описание |
|---|---|---|---|---|
guildId | путь | string | Да | ID вашего сервера · Discord ID (строка) |
userId | путь | string | Да | Discord ID участника · Discord ID (строка) |
Idempotency-Key | заголовок | string | Нет | Необязательно. Передайте уникальное значение (UUID) и повторяйте его при ретраях — операция выполнится один раз. Как это работает |
Тело запроса
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
amount | integer | Да | Positive = add bonus invites, negative = remove -100 000–100 000 |
reason | string | null | Нет | Shown in the audit log до 200 символов |
Ответ
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
userId | string | Да | |
amount | integer | Да | |
previousBonus | integer | Да | |
bonus | integer | Да | |
invites | integer | Да | |
verified | integer | Да |
{
"userId": "876543210987654321",
"amount": 100,
"previousBonus": 10,
"bonus": 10,
"invites": 10,
"verified": 10
}Примеры
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/invites/members/876543210987654321/bonus" \
-H "Authorization: Bearer $BOTGG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"amount":100,"reason":"Tournament prize"}'// 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/invites/members/876543210987654321/bonus', {
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({
amount: 100,
reason: 'Tournament prize',
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os, uuid
import requests
res = requests.post(
"https://console.botgg.app/api/v1/guilds/123456789012345678/invites/members/876543210987654321/bonus",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # reuse it when you retry this request
},
json={
"amount": 100,
"reason": "Tournament prize",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)Ошибки
| HTTP | Коды |
|---|---|
| 400 | INVALID_JSON |
| 404 | MEMBER_NOT_FOUND |
| 409 | FEATURE_DISABLED |
| 413 | PAYLOAD_TOO_LARGE |
| 415 | UNSUPPORTED_MEDIA_TYPE |
| 422 | IDEMPOTENCY_KEY_REUSED, BOT_ACCOUNT |
| 503 | SERVICE_UNAVAILABLE |