REST API v1 · למפתחים · מדריך עיון ל-API

מדריך עיון ל-API: כרטיסים

כל 4 נקודות הקצה של כרטיסים ב-REST API v1 של BotGG: הרשאות, פרמטרים, שדות, שגיאות ודוגמאות מוכנות ב-curl, JavaScript ו-Python.

תיעוד למפתחים
בעמוד הזה

נקודות קצה

הנתיבים יחסיים ל-https://console.botgg.app/api/v1. שלחו את מפתח ה-API בכותרת Authorization: Bearer botgg_…; מזהים הם מחרוזות.

נקודות קצה: כרטיסים
נקודת קצההרשאהתיאור
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כןהמזהה של השרת שלכם · מזהה דיסקורד (מחרוזת)
statusquerystringלאאחד מ: open, pending, closed, active
panelIdqueryintegerלאלפחות 1
userIdquerystringלאOnly tickets opened by this user
מזהה דיסקורד (מחרוזת)
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כןהמזהה של השרת שלכם · מזהה דיסקורד (מחרוזת)
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)

שגיאות

שגיאות
HTTPקודים
404TICKET_NOT_FOUND
409FEATURE_DISABLED
503SERVICE_UNAVAILABLE

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כןהמזהה של השרת שלכם · מזהה דיסקורד (מחרוזת)
ticketNoנתיבstringכן
limitqueryintegerלא1–500 · ברירת מחדל 100
afterquerystringלאA message id from nextCursor
מזהה דיסקורד (מחרוזת)

תשובה

שדות התשובה · 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כןהמזהה של השרת שלכם · מזהה דיסקורד (מחרוזת)
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 בחינם ומפעילים יכולות בקונסולת הווב.