REST API v1 · 開發者 · API 參考

申請 API 參考

BotGG REST API v1 的所有 4 個 申請 端點:範圍、參數、欄位、錯誤,以及可直接執行的 curl、JavaScript 與 Python 範例。

開發者文件
本頁目錄

端點

路徑皆相對於 https://console.botgg.app/api/v1。請以 Authorization: Bearer botgg_… 傳送你的 API 金鑰,ID 皆為字串。

申請 端點
端點範圍說明
GET/guilds/{guildId}/applications/formsapplications:readList application forms
GET/guilds/{guildId}/applications/submissionsapplications:readList applications
GET/guilds/{guildId}/applications/submissions/{number}applications:readGet an application
POST/guilds/{guildId}/applications/submissions/{number}/decisionapplications:writeAccept or deny an application

除了下方各自的錯誤外,每個端點還可能回傳這些常見錯誤:

List application forms

GET/guilds/{guildId}/applications/forms

範圍: applications:read

In the console’s order, with their questions and submission counts.

需要在伺服器上啟用此功能: 申請

參數
名稱位置類型必填說明
guildId路徑string是你的伺服器 ID · Discord ID(字串)

回應

回應欄位 · 200
欄位類型必填說明
itemsarray of object是
items[].idinteger是
items[].titlestring是
items[].descriptionstring是
items[].openboolean是The open toggle (the open window is in opensAt / closesAt)
items[].opensAtstring | null是ISO 8601 date-time
items[].closesAtstring | null是ISO 8601 date-time
items[].questionsarray of object是
items[].questions[].idstring是
items[].questions[].typestring是
items[].questions[].labelstring是
items[].questions[].requiredboolean是
items[].submissionsobject是
items[].submissions.totalinteger是
items[].submissions.openinteger是
回應 · 200
{
  "items": [
    {
      "id": 98765,
      "title": "example",
      "description": "example",
      "open": true,
      "opensAt": "2026-10-07T12:00:00.000Z",
      "closesAt": "2026-10-07T12:00:00.000Z",
      "questions": [
        {
          "id": "example",
          "type": "example",
          "label": "Example",
          "required": true
        }
      ],
      "submissions": {
        "total": 10,
        "open": 10
      }
    }
  ]
}

範例

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

GET/guilds/{guildId}/applications/submissions

範圍: applications:read

Newest first, without answers. status=open = pending + interview + hold, decided = accepted + denied. Pass before=<nextCursor> for the next page.

需要在伺服器上啟用此功能: 申請

參數
名稱位置類型必填說明
guildId路徑string是你的伺服器 ID · Discord ID(字串)
status查詢字串string否其中之一 pending, interview, hold, accepted, denied, withdrawn, open, decided
formId查詢字串integer否至少 1
userId查詢字串string否Only this applicant
Discord ID(字串)
limit查詢字串integer否1–100 · 預設值 25
before查詢字串integer否1–999,999,999

回應

回應欄位 · 200
欄位類型必填說明
itemsarray of object是
items[].numberinteger是
items[].formIdinteger | null是null when the form was deleted
items[].formTitlestring | null是
items[].userIdstring是
items[].statusstring是其中之一 pending, interview, hold, accepted, denied, withdrawn
items[].votesobject是
items[].votes.upinteger是
items[].votes.downinteger是
items[].submittedAtstring | null是ISO 8601 date-time
items[].decidedAtstring | null是ISO 8601 date-time
items[].decidedBystring | null是null = system / API
items[].reasonstring | null是
nextCursorstring | null是
回應 · 200
{
  "items": [
    {
      "number": 7,
      "formId": 98765,
      "formTitle": "example",
      "userId": "876543210987654321",
      "status": "pending",
      "votes": {
        "up": 10,
        "down": 10
      },
      "submittedAt": "2026-10-07T12:00:00.000Z",
      "decidedAt": "2026-10-07T12:00:00.000Z",
      "decidedBy": "example",
      "reason": "Tournament prize"
    }
  ],
  "nextCursor": "98700"
}

範例

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

錯誤

Get an application

GET/guilds/{guildId}/applications/submissions/{number}

範圍: applications:read

With the answers and the applicant snapshot taken at submit time (account age, join date, roles, level).

需要在伺服器上啟用此功能: 申請

參數
名稱位置類型必填說明
guildId路徑string是你的伺服器 ID · Discord ID(字串)
number路徑string是

回應

回應欄位 · 200
欄位類型必填說明
numberinteger是
formIdinteger | null是null when the form was deleted
formTitlestring | null是
userIdstring是
statusstring是其中之一 pending, interview, hold, accepted, denied, withdrawn
votesobject是
votes.upinteger是
votes.downinteger是
submittedAtstring | null是ISO 8601 date-time
decidedAtstring | null是ISO 8601 date-time
decidedBystring | null是null = system / API
reasonstring | null是
answersarray of object是
answers[].idstring是
answers[].typestring是
answers[].labelstring是
answers[].textstring是
applicantobject是
applicant.accountCreatedAtstring | null是ISO 8601 date-time
applicant.joinedAtstring | null是ISO 8601 date-time
applicant.roleIdsarray of string是
applicant.levelinteger | null是
applyingboolean是A console/API decision is still being applied in Discord
failedActionsarray of object是
failedActions[].typestring是
failedActions[].errorstring | null是
回應 · 200
{
  "number": 7,
  "formId": 98765,
  "formTitle": "example",
  "userId": "876543210987654321",
  "status": "pending",
  "votes": {
    "up": 10,
    "down": 10
  },
  "submittedAt": "2026-10-07T12:00:00.000Z",
  "decidedAt": "2026-10-07T12:00:00.000Z",
  "decidedBy": "example",
  "reason": "Tournament prize",
  "answers": [
    {
      "id": "example",
      "type": "example",
      "label": "Example",
      "text": "Example answer"
    }
  ],
  "applicant": {
    "accountCreatedAt": "2026-10-07T12:00:00.000Z",
    "joinedAt": "2026-10-07T12:00:00.000Z",
    "roleIds": [
      "234567890123456789"
    ],
    "level": 5
  },
  "applying": true,
  "failedActions": [
    {
      "type": "example",
      "error": "example"
    }
  ]
}

範例

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

錯誤

Accept or deny an application

POST/guilds/{guildId}/applications/submissions/{number}/decision

範圍: applications:writeIdempotency-Key

Same as Accept / Deny in the console: decided now (status, reason, reapply cooldown after a denial), then the bot gives / removes the form’s roles, DMs the applicant, announces and updates the review within a few seconds (applying). Written to the audit log.

需要在伺服器上啟用此功能: 申請

參數
名稱位置類型必填說明
guildId路徑string是你的伺服器 ID · Discord ID(字串)
number路徑string是
Idempotency-Key標頭string否選填。傳送一個唯一值(UUID),重試時沿用同一個值,變更就只會發生一次。 運作方式

請求內容

請求內容
欄位類型必填說明
decisionstring是其中之一 accepted, denied
reasonstring | null否Sent to the applicant (DM) and shown in the review
最多 1,000 個字元

回應

回應欄位 · 202
欄位類型必填說明
numberinteger是
formIdinteger | null是null when the form was deleted
formTitlestring | null是
userIdstring是
statusstring是其中之一 pending, interview, hold, accepted, denied, withdrawn
votesobject是
votes.upinteger是
votes.downinteger是
submittedAtstring | null是ISO 8601 date-time
decidedAtstring | null是ISO 8601 date-time
decidedBystring | null是null = system / API
reasonstring | null是
answersarray of object是
answers[].idstring是
answers[].typestring是
answers[].labelstring是
answers[].textstring是
applicantobject是
applicant.accountCreatedAtstring | null是ISO 8601 date-time
applicant.joinedAtstring | null是ISO 8601 date-time
applicant.roleIdsarray of string是
applicant.levelinteger | null是
applyingboolean是A console/API decision is still being applied in Discord
failedActionsarray of object是
failedActions[].typestring是
failedActions[].errorstring | null是
回應 · 202
{
  "number": 7,
  "formId": 98765,
  "formTitle": "example",
  "userId": "876543210987654321",
  "status": "pending",
  "votes": {
    "up": 10,
    "down": 10
  },
  "submittedAt": "2026-10-07T12:00:00.000Z",
  "decidedAt": "2026-10-07T12:00:00.000Z",
  "decidedBy": "example",
  "reason": "Tournament prize",
  "answers": [
    {
      "id": "example",
      "type": "example",
      "label": "Example",
      "text": "Example answer"
    }
  ],
  "applicant": {
    "accountCreatedAt": "2026-10-07T12:00:00.000Z",
    "joinedAt": "2026-10-07T12:00:00.000Z",
    "roleIds": [
      "234567890123456789"
    ],
    "level": 5
  },
  "applying": true,
  "failedActions": [
    {
      "type": "example",
      "error": "example"
    }
  ]
}

範例

curl
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/submissions/234567890123456789/decision" \
  -H "Authorization: Bearer $BOTGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"decision":"accepted","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/applications/submissions/234567890123456789/decision', {
  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({
    decision: 'accepted',
    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/applications/submissions/234567890123456789/decision",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),  # reuse it when you retry this request
    },
    json={
        "decision": "accepted",
        "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,再到網頁控制台開啟需要的功能。