REST API v1 · Entwickler · API-Referenz

Tickets-API-Referenz

Alle 4 Tickets-Endpunkte der BotGG-REST-API v1: Scopes, Parameter, Felder, Fehler und sofort ausführbare Beispiele in curl, JavaScript und Python.

Entwicklerdokumentation
Auf dieser Seite

Endpunkte

Pfade sind relativ zu https://console.botgg.app/api/v1. Sende deinen API-Schlüssel als Authorization: Bearer botgg_…; IDs sind Strings.

Tickets-Endpunkte
EndpunktScopeBeschreibung
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

Neben den unten genannten eigenen Fehlern kann jeder Endpunkt diese allgemeinen zurückgeben:

List tickets

GET/guilds/{guildId}/tickets

Scope: tickets:read

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

Dieses Feature muss auf dem Server aktiviert sein: Tickets

Parameter
NameInTypErforderlichBeschreibung
guildIdPfadstringJaDie ID deines Servers · Discord-ID (String)
statusQuerystringNeinEines von open, pending, closed, active
panelIdQueryintegerNeinmindestens 1
userIdQuerystringNeinOnly tickets opened by this user
Discord-ID (String)
limitQueryintegerNein1–100 · Standard 25
beforeQueryintegerNein1–999.999.999

Antwort

Antwortfelder · 200
FeldTypErforderlichBeschreibung
itemsarray of objectJa
items[].ticketNointegerJa
items[].statusstringJaEines von open, pending, closed
items[].userIdstringJaThe opener
items[].panelIdinteger | nullJa
items[].subjectstring | nullJa
items[].sourcestring | nullJaEines von panel, command, context_menu, dashboard, flow
items[].isThreadbooleanJa
items[].channelIdstring | nullJa
items[].claimedBystring | nullJa
items[].openedAtstring | nullJaISO 8601 date-time
items[].lastMessageAtstring | nullJaISO 8601 date-time
items[].closedAtstring | nullJaISO 8601 date-time
items[].closedBystring | nullJanull = closed by the bot (autoclose, API, …)
items[].closeReasonstring | nullJa
items[].closeTypestring | nullJaEines von manual, autoclose, user_leave, request, channel_deleted, thread_archived
items[].messageCountobjectJa
items[].messageCount.userintegerJa
items[].messageCount.staffintegerJa
items[].ratinginteger | nullJa
items[].hasTranscriptbooleanJa
nextCursorstring | nullJa
Antwort · 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"
}

Beispiele

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)

Fehler

Get a ticket

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

Scope: tickets:read

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

Dieses Feature muss auf dem Server aktiviert sein: Tickets

Parameter
NameInTypErforderlichBeschreibung
guildIdPfadstringJaDie ID deines Servers · Discord-ID (String)
ticketNoPfadstringJa

Antwort

Antwortfelder · 200
FeldTypErforderlichBeschreibung
ticketNointegerJa
statusstringJaEines von open, pending, closed
userIdstringJaThe opener
panelIdinteger | nullJa
subjectstring | nullJa
sourcestring | nullJaEines von panel, command, context_menu, dashboard, flow
isThreadbooleanJa
channelIdstring | nullJa
claimedBystring | nullJa
openedAtstring | nullJaISO 8601 date-time
lastMessageAtstring | nullJaISO 8601 date-time
closedAtstring | nullJaISO 8601 date-time
closedBystring | nullJanull = closed by the bot (autoclose, API, …)
closeReasonstring | nullJa
closeTypestring | nullJaEines von manual, autoclose, user_leave, request, channel_deleted, thread_archived
messageCountobjectJa
messageCount.userintegerJa
messageCount.staffintegerJa
ratinginteger | nullJa
hasTranscriptbooleanJa
panelTitlestring | nullJa
firstResponseAtstring | nullJaISO 8601 date-time
firstResponseBystring | nullJa
answersarray of objectJaForm answers given when opening
answers[].fieldIdstring | nullJa
answers[].labelstringJa
answers[].valuestringJa
membersarray of objectJaUsers / roles added to the ticket
members[].targetIdstringJa
members[].typestringJaEines von user, role
closeRequestobject | nullJa
closeRequest.reasonstring | nullJa
closeRequest.closeAtstring | nullJaISO 8601 date-time
closeRequest.viaApibooleanJa
Antwort · 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
  }
}

Beispiele

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)

Fehler

Get a closed ticket’s transcript

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

Scope: 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.

Dieses Feature muss auf dem Server aktiviert sein: Tickets

Parameter
NameInTypErforderlichBeschreibung
guildIdPfadstringJaDie ID deines Servers · Discord-ID (String)
ticketNoPfadstringJa
limitQueryintegerNein1–500 · Standard 100
afterQuerystringNeinA message id from nextCursor
Discord-ID (String)

Antwort

Antwortfelder · 200
FeldTypErforderlichBeschreibung
ticketNointegerJa
generatedAtstring | nullJaISO 8601 date-time
messageContentbooleanJafalse: the bot ran without the Message Content intent, so other users’ text may be empty
totalMessagesintegerJa
usersobjectJa
messagesarray of objectJa
messages[].idstringJa
messages[].authorIdstring | nullJa
messages[].contentstringJa
messages[].createdAtstringJaISO 8601 date-time
messages[].editedAtstring | nullJaISO 8601 date-time
messages[].systembooleanJa
messages[].replyTostring | nullJa
messages[].embedsarray of objectJa
messages[].embeds[].titlestring | nullJa
messages[].embeds[].descriptionstring | nullJa
messages[].embeds[].fieldsarray of objectJa
messages[].embeds[].fields[].namestringJa
messages[].embeds[].fields[].valuestringJa
messages[].attachmentsarray of objectJa
messages[].attachments[].namestringJa
messages[].attachments[].sizeintegerJa
messages[].attachments[].contentTypestring | nullJa
messages[].stickersarray of stringJa
nextCursorstring | nullJaPass as after for the next page
Antwort · 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"
}

Beispiele

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)

Fehler

Close a ticket

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

Scope: 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.

Dieses Feature muss auf dem Server aktiviert sein: Tickets

Parameter
NameInTypErforderlichBeschreibung
guildIdPfadstringJaDie ID deines Servers · Discord-ID (String)
ticketNoPfadstringJa
Idempotency-KeyHeaderstringNeinOptional. Sende einen eindeutigen Wert (eine UUID) und verwende ihn bei einem erneuten Versuch wieder: Die Änderung erfolgt nur einmal. So funktioniert’s

Request-Body

Request-Body
FeldTypErforderlichBeschreibung
reasonstring | nullNeinShown in the close log and the opener’s DM
bis zu 500 Zeichen

Antwort

Antwortfelder · 202
FeldTypErforderlichBeschreibung
ticketNointegerJa
status"closing"Ja
reasonstring | nullJa
requestedAtstringJaISO 8601 date-time
Antwort · 202
{
  "ticketNo": 10,
  "status": "closing",
  "reason": "Tournament prize",
  "requestedAt": "2026-10-07T12:00:00.000Z"
}

Beispiele

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)

Fehler

Bereit, deinen Server aufs nächste Level zu bringen?

Füge BotGG kostenlos hinzu und aktiviere die Features dann in der Web-Konsole.