REST API v1 · Разработчикам · Справочник API
Справочник API: Сервер
Все 4 эндпоинта раздела «Сервер» в REST API BotGG v1: права, параметры, поля, ошибки и готовые примеры на curl, JavaScript и Python.
Документация для разработчиков
На этой странице
Эндпоинты
Пути указаны относительно https://console.botgg.app/api/v1. Передавайте API-ключ в заголовке Authorization: Bearer botgg_…; ID — строки.
| Эндпоинт | Право | Описание |
|---|---|---|
GET/guilds/{guildId} | guild:read | Get the server |
GET/guilds/{guildId}/roles | guild:read | List roles |
GET/guilds/{guildId}/channels | guild:read | List channels |
GET/guilds/{guildId}/members/{userId} | guild:read | Get a member |
Кроме собственных ошибок (см. ниже), любой эндпоинт может вернуть эти общие:
Get the server
GET/guilds/{guildId}
Name, icon, approximate member count, the bot’s language and the enabled BotGG features.
| Имя | Где | Тип | Обязательное | Описание |
|---|---|---|---|---|
guildId | путь | string | Да | ID вашего сервера · Discord ID (строка) |
Ответ
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
id | string | Да | |
name | string | Да | |
icon | string | null | Да | |
iconUrl | string | null | Да | |
memberCount | integer | null | Да | Approximate; null when Discord is unreachable |
locale | string | Да | The bot’s language on this server (en, ru, he) |
enabledFeatures | array of string | Да |
{
"id": "example",
"name": "Example",
"icon": "example",
"iconUrl": "https://example.com",
"memberCount": 10,
"locale": "example",
"enabledFeatures": [
"example"
]
}Примеры
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678" \
-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', {
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",
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)Ошибки
Только общие ошибки, перечисленные в разделе «Эндпоинты».
List roles
GET/guilds/{guildId}/roles
Highest first (Discord order), without @everyone.
| Имя | Где | Тип | Обязательное | Описание |
|---|---|---|---|---|
guildId | путь | string | Да | ID вашего сервера · Discord ID (строка) |
Ответ
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
items | array of object | Да | |
items[].id | string | Да | |
items[].name | string | Да | |
items[].color | string | null | Да | |
items[].position | integer | Да | |
items[].managed | boolean | Да | |
items[].hoist | boolean | Да | |
items[].mentionable | boolean | Да |
{
"items": [
{
"id": "example",
"name": "Example",
"color": "#18d7ff",
"position": 10,
"managed": true,
"hoist": true,
"mentionable": true
}
]
}Примеры
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/roles" \
-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/roles', {
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/roles",
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 | Коды |
|---|---|
| 503 | SERVICE_UNAVAILABLE |
List channels
GET/guilds/{guildId}/channels
In Discord’s sidebar order (categories followed by their channels); threads are not included.
| Имя | Где | Тип | Обязательное | Описание |
|---|---|---|---|---|
guildId | путь | string | Да | ID вашего сервера · Discord ID (строка) |
Ответ
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
items | array of object | Да | |
items[].id | string | Да | |
items[].name | string | Да | |
items[].type | string | Да | Одно из text, voice, category, announcement, stage, forum, media, other |
items[].parentId | string | null | Да | |
items[].position | integer | Да |
{
"items": [
{
"id": "example",
"name": "Example",
"type": "text",
"parentId": "234567890123456789",
"position": 10
}
]
}Примеры
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/channels" \
-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/channels', {
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/channels",
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 | Коды |
|---|---|
| 503 | SERVICE_UNAVAILABLE |
Get a member
GET/guilds/{guildId}/members/{userId}
Basic member info: names, avatar, role ids and join date. Cached for up to 5 minutes.
| Имя | Где | Тип | Обязательное | Описание |
|---|---|---|---|---|
guildId | путь | string | Да | ID вашего сервера · Discord ID (строка) |
userId | путь | string | Да | Discord ID участника · Discord ID (строка) |
Ответ
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
userId | string | Да | |
username | string | null | Да | |
globalName | string | null | Да | |
nickname | string | null | Да | |
displayName | string | null | Да | |
avatarUrl | string | null | Да | |
bot | boolean | Да | |
roles | array of string | Да | Role ids |
joinedAt | string | null | Да |
{
"userId": "876543210987654321",
"username": "example",
"globalName": "example",
"nickname": "example",
"displayName": "example",
"avatarUrl": "https://example.com",
"bot": false,
"roles": [
"example"
],
"joinedAt": "2026-10-07T12:00:00.000Z"
}Примеры
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/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/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/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 | Коды |
|---|---|
| 404 | MEMBER_NOT_FOUND |
| 503 | SERVICE_UNAVAILABLE |