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:readGet the server
GET/guilds/{guildId}/rolesguild:readList roles
GET/guilds/{guildId}/channelsguild:readList channels
GET/guilds/{guildId}/members/{userId}guild:readGet a member

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

Get the server

GET/guilds/{guildId}

Право: guild:read

Name, icon, approximate member count, the bot’s language and the enabled BotGG features.

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

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
idstringДа
namestringДа
iconstring | nullДа
iconUrlstring | nullДа
memberCountinteger | nullДаApproximate; null when Discord is unreachable
localestringДаThe bot’s language on this server (en, ru, he)
enabledFeaturesarray of stringДа
Ответ · 200
{
  "id": "example",
  "name": "Example",
  "icon": "example",
  "iconUrl": "https://example.com",
  "memberCount": 10,
  "locale": "example",
  "enabledFeatures": [
    "example"
  ]
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678" \
  -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', {
  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",
    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

Право: guild:read

Highest first (Discord order), without @everyone.

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

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
itemsarray of objectДа
items[].idstringДа
items[].namestringДа
items[].colorstring | nullДа
items[].positionintegerДа
items[].managedbooleanДа
items[].hoistbooleanДа
items[].mentionablebooleanДа
Ответ · 200
{
  "items": [
    {
      "id": "example",
      "name": "Example",
      "color": "#18d7ff",
      "position": 10,
      "managed": true,
      "hoist": true,
      "mentionable": true
    }
  ]
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/roles" \
  -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/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);
Python (requests)
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Коды
503SERVICE_UNAVAILABLE

List channels

GET/guilds/{guildId}/channels

Право: guild:read

In Discord’s sidebar order (categories followed by their channels); threads are not included.

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

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
itemsarray of objectДа
items[].idstringДа
items[].namestringДа
items[].typestringДаОдно из text, voice, category, announcement, stage, forum, media, other
items[].parentIdstring | nullДа
items[].positionintegerДа
Ответ · 200
{
  "items": [
    {
      "id": "example",
      "name": "Example",
      "type": "text",
      "parentId": "234567890123456789",
      "position": 10
    }
  ]
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/channels" \
  -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/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);
Python (requests)
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Коды
503SERVICE_UNAVAILABLE

Get a member

GET/guilds/{guildId}/members/{userId}

Право: guild:read

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 (строка)

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
userIdstringДа
usernamestring | nullДа
globalNamestring | nullДа
nicknamestring | nullДа
displayNamestring | nullДа
avatarUrlstring | nullДа
botbooleanДа
rolesarray of stringДаRole ids
joinedAtstring | nullДа
Ответ · 200
{
  "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
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/members/876543210987654321" \
  -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/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);
Python (requests)
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Коды
404MEMBER_NOT_FOUND
503SERVICE_UNAVAILABLE

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

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