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}/ticketstickets:readList tickets
GET/guilds/{guildId}/tickets/{ticketNo}tickets:readGet a ticket
GET/guilds/{guildId}/tickets/{ticketNo}/transcripttickets:readGet a closed ticket’s transcript
POST/guilds/{guildId}/tickets/{ticketNo}/closetickets:writeClose a ticket

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

List tickets

GET/guilds/{guildId}/tickets

Право: tickets:read

Newest first. status=active = open + pending. Pass before=<nextCursor> for the next page.

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

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
statusquerystringНетОдно из open, pending, closed, active
panelIdqueryintegerНетне меньше 1
userIdquerystringНетOnly tickets opened by this user
Discord ID (строка)
limitqueryintegerНет1–100 · По умолчанию 25
beforequeryintegerНет1–999 999 999

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
itemsarray of objectДа
items[].ticketNointegerДа
items[].statusstringДаОдно из open, pending, closed
items[].userIdstringДаThe opener
items[].panelIdinteger | nullДа
items[].subjectstring | nullДа
items[].sourcestring | nullДаОдно из panel, command, context_menu, dashboard
items[].isThreadbooleanДа
items[].channelIdstring | nullДа
items[].claimedBystring | nullДа
items[].openedAtstring | nullДаISO 8601 date-time
items[].lastMessageAtstring | nullДаISO 8601 date-time
items[].closedAtstring | nullДаISO 8601 date-time
items[].closedBystring | nullДаnull = closed by the bot (autoclose, API, …)
items[].closeReasonstring | nullДа
items[].closeTypestring | nullДаОдно из manual, autoclose, user_leave, request, channel_deleted, thread_archived
items[].messageCountobjectДа
items[].messageCount.userintegerДа
items[].messageCount.staffintegerДа
items[].ratinginteger | nullДа
items[].hasTranscriptbooleanДа
nextCursorstring | nullДа
Ответ · 200
{
  "items": [
    {
      "ticketNo": 10,
      "status": "open",
      "userId": "876543210987654321",
      "panelId": 98765,
      "subject": "Help with my order",
      "source": "panel",
      "isThread": true,
      "channelId": "234567890123456789",
      "claimedBy": "example",
      "openedAt": "2026-10-07T12:00:00.000Z",
      "lastMessageAt": "2026-10-07T12:00:00.000Z",
      "closedAt": "2026-10-07T12:00:00.000Z",
      "closedBy": "example",
      "closeReason": "example",
      "closeType": "manual",
      "messageCount": {
        "user": 10,
        "staff": 10
      },
      "rating": 10,
      "hasTranscript": true
    }
  ],
  "nextCursor": "98700"
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/tickets?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/tickets?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/tickets",
    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 ticket

GET/guilds/{guildId}/tickets/{ticketNo}

Право: tickets:read

Includes the form answers, added members and a pending close request.

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

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

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
ticketNointegerДа
statusstringДаОдно из open, pending, closed
userIdstringДаThe opener
panelIdinteger | nullДа
subjectstring | nullДа
sourcestring | nullДаОдно из panel, command, context_menu, dashboard
isThreadbooleanДа
channelIdstring | nullДа
claimedBystring | nullДа
openedAtstring | nullДаISO 8601 date-time
lastMessageAtstring | nullДаISO 8601 date-time
closedAtstring | nullДаISO 8601 date-time
closedBystring | nullДаnull = closed by the bot (autoclose, API, …)
closeReasonstring | nullДа
closeTypestring | nullДаОдно из manual, autoclose, user_leave, request, channel_deleted, thread_archived
messageCountobjectДа
messageCount.userintegerДа
messageCount.staffintegerДа
ratinginteger | nullДа
hasTranscriptbooleanДа
panelTitlestring | nullДа
firstResponseAtstring | nullДаISO 8601 date-time
firstResponseBystring | nullДа
answersarray of objectДаForm answers given when opening
answers[].fieldIdstring | nullДа
answers[].labelstringДа
answers[].valuestringДа
membersarray of objectДаUsers / roles added to the ticket
members[].targetIdstringДа
members[].typestringДаОдно из user, role
closeRequestobject | nullДа
closeRequest.reasonstring | nullДа
closeRequest.closeAtstring | nullДаISO 8601 date-time
closeRequest.viaApibooleanДа
Ответ · 200
{
  "ticketNo": 10,
  "status": "open",
  "userId": "876543210987654321",
  "panelId": 98765,
  "subject": "Help with my order",
  "source": "panel",
  "isThread": true,
  "channelId": "234567890123456789",
  "claimedBy": "example",
  "openedAt": "2026-10-07T12:00:00.000Z",
  "lastMessageAt": "2026-10-07T12:00:00.000Z",
  "closedAt": "2026-10-07T12:00:00.000Z",
  "closedBy": "example",
  "closeReason": "example",
  "closeType": "manual",
  "messageCount": {
    "user": 10,
    "staff": 10
  },
  "rating": 10,
  "hasTranscript": true,
  "panelTitle": "example",
  "firstResponseAt": "2026-10-07T12:00:00.000Z",
  "firstResponseBy": "example",
  "answers": [
    {
      "fieldId": "234567890123456789",
      "label": "Example",
      "value": "example"
    }
  ],
  "members": [
    {
      "targetId": "234567890123456789",
      "type": "user"
    }
  ],
  "closeRequest": {
    "reason": "Tournament prize",
    "closeAt": "2026-10-07T12:00:00.000Z",
    "viaApi": true
  }
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/tickets/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/tickets/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/tickets/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)

Ошибки

Get a closed ticket’s transcript

GET/guilds/{guildId}/tickets/{ticketNo}/transcript

Право: tickets:read

The messages saved when the ticket was closed, oldest first, as text: no avatars and no attachment links (only file name, size and type). Pass after=<nextCursor> for the next page. 404 TRANSCRIPT_NOT_FOUND for open tickets or when transcripts are off.

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

Параметры
ИмяГдеТипОбязательноеОписание
guildIdпутьstringДаID вашего сервера · Discord ID (строка)
ticketNoпутьstringДа
limitqueryintegerНет1–500 · По умолчанию 100
afterquerystringНетA message id from nextCursor
Discord ID (строка)

Ответ

Поля ответа · 200
ПолеТипОбязательноеОписание
ticketNointegerДа
generatedAtstring | nullДаISO 8601 date-time
messageContentbooleanДаfalse: the bot ran without the Message Content intent, so other users’ text may be empty
totalMessagesintegerДа
usersobjectДа
messagesarray of objectДа
messages[].idstringДа
messages[].authorIdstring | nullДа
messages[].contentstringДа
messages[].createdAtstringДаISO 8601 date-time
messages[].editedAtstring | nullДаISO 8601 date-time
messages[].systembooleanДа
messages[].replyTostring | nullДа
messages[].embedsarray of objectДа
messages[].embeds[].titlestring | nullДа
messages[].embeds[].descriptionstring | nullДа
messages[].embeds[].fieldsarray of objectДа
messages[].embeds[].fields[].namestringДа
messages[].embeds[].fields[].valuestringДа
messages[].attachmentsarray of objectДа
messages[].attachments[].namestringДа
messages[].attachments[].sizeintegerДа
messages[].attachments[].contentTypestring | nullДа
messages[].stickersarray of stringДа
nextCursorstring | nullДаPass as after for the next page
Ответ · 200
{
  "ticketNo": 10,
  "generatedAt": "2026-10-07T12:00:00.000Z",
  "messageContent": true,
  "totalMessages": 10,
  "users": {},
  "messages": [
    {
      "id": "example",
      "authorId": "234567890123456789",
      "content": "example",
      "createdAt": "2026-10-07T12:00:00.000Z",
      "editedAt": "2026-10-07T12:00:00.000Z",
      "system": true,
      "replyTo": "example",
      "embeds": [
        {
          "title": "example",
          "description": "example",
          "fields": [
            {}
          ]
        }
      ],
      "attachments": [
        {
          "name": "Example",
          "size": 10,
          "contentType": "example"
        }
      ],
      "stickers": [
        "example"
      ]
    }
  ],
  "nextCursor": "98700"
}

Примеры

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/tickets/234567890123456789/transcript?limit=100" \
  -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/tickets/234567890123456789/transcript?limit=100', {
  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/tickets/234567890123456789/transcript",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
    },
    params={
        "limit": 100,
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

Ошибки

Close a ticket

POST/guilds/{guildId}/tickets/{ticketNo}/close

Право: tickets:writeIdempotency-Key

The bot closes it within about a minute exactly like a staff close: transcript (if enabled for the panel), transcript-channel log, DM to the opener, channel deleted / thread archived. The reason is shown as "<reason> (via API: <key name>)". Written to the audit log.

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

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

Тело запроса

Тело запроса
ПолеТипОбязательноеОписание
reasonstring | nullНетShown in the close log and the opener’s DM
до 500 символов

Ответ

Поля ответа · 202
ПолеТипОбязательноеОписание
ticketNointegerДа
status"closing"Да
reasonstring | nullДа
requestedAtstringДаISO 8601 date-time
Ответ · 202
{
  "ticketNo": 10,
  "status": "closing",
  "reason": "Tournament prize",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Примеры

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

Ошибки

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

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