REST API v1 · Entwickler · API-Referenz
Bank-API-Referenz
Alle 4 Bank-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.
| Endpunkt | Scope | Beschreibung |
|---|---|---|
GET/guilds/{guildId}/bank/members/{userId} | bank:read | Get a member’s balance |
GET/guilds/{guildId}/bank/members/{userId}/transactions | bank:read | List a member’s transactions |
POST/guilds/{guildId}/bank/members/{userId}/transactions | bank:write | Add to or remove from a member’s balance |
GET/guilds/{guildId}/bank/leaderboard | bank:read | Top balances |
Neben den unten genannten eigenen Fehlern kann jeder Endpunkt diese allgemeinen zurückgeben:
Get a member’s balance
GET/guilds/{guildId}/bank/members/{userId}
Members without an account yet get the server’s starting balance.
Dieses Feature muss auf dem Server aktiviert sein: Bank
| Name | In | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
guildId | Pfad | string | Ja | Die ID deines Servers · Discord-ID (String) |
userId | Pfad | string | Ja | Die Discord-Nutzer-ID des Mitglieds · Discord-ID (String) |
Antwort
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
userId | string | Ja | |
balance | integer | Ja | |
currency | object | Ja | |
currency.name | string | Ja | |
currency.plural | string | Ja | |
currency.emoji | string | null | Ja |
{
"userId": "876543210987654321",
"balance": 1350,
"currency": {
"name": "Example",
"plural": "example",
"emoji": "🪙"
}
}Beispiele
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/bank/members/876543210987654321" \
-H "Authorization: Bearer $BOTGG_API_KEY"// 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/bank/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);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/bank/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)Fehler
| HTTP | Codes |
|---|---|
| 409 | BANK_DISABLED |
| 503 | SERVICE_UNAVAILABLE |
List a member’s transactions
GET/guilds/{guildId}/bank/members/{userId}/transactions
Newest first. Pass before=<nextCursor> for the next page.
Dieses Feature muss auf dem Server aktiviert sein: Bank
| Name | In | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
guildId | Pfad | string | Ja | Die ID deines Servers · Discord-ID (String) |
userId | Pfad | string | Ja | Die Discord-Nutzer-ID des Mitglieds · Discord-ID (String) |
limit | Query | integer | Nein | 1–100 · Standard 25 |
before | Query | integer | Nein | mindestens 1 |
Antwort
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
items | array of object | Ja | |
items[].id | integer | Ja | |
items[].type | string | Ja | |
items[].amount | integer | Ja | |
items[].balanceAfter | integer | Ja | |
items[].reason | string | null | Ja | |
items[].counterpartyId | string | null | Ja | |
items[].createdAt | string | Ja | |
nextCursor | string | null | Ja |
{
"items": [
{
"id": 98765,
"type": "example",
"amount": 100,
"balanceAfter": 1350,
"reason": "Tournament prize",
"counterpartyId": "234567890123456789",
"createdAt": "2026-10-07T12:00:00.000Z"
}
],
"nextCursor": "98700"
}Beispiele
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/bank/members/876543210987654321/transactions?limit=25" \
-H "Authorization: Bearer $BOTGG_API_KEY"// 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/bank/members/876543210987654321/transactions?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);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/bank/members/876543210987654321/transactions",
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
| HTTP | Codes |
|---|---|
| 409 | BANK_DISABLED |
| 503 | SERVICE_UNAVAILABLE |
Add to or remove from a member’s balance
POST/guilds/{guildId}/bank/members/{userId}/transactions
Same rules as a banker change. Logged in the Bank ledger (type api) and the Bank log channel.
Dieses Feature muss auf dem Server aktiviert sein: Bank
| Name | In | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
guildId | Pfad | string | Ja | Die ID deines Servers · Discord-ID (String) |
userId | Pfad | string | Ja | Die Discord-Nutzer-ID des Mitglieds · Discord-ID (String) |
Idempotency-Key | Header | string | Nein | Optional. Sende einen eindeutigen Wert (eine UUID) und verwende ihn bei einem erneuten Versuch wieder: Die Änderung erfolgt nur einmal. So funktioniert’s |
Request-Body
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
type | string | Ja | add = credit, remove = debit Eines von add, remove |
amount | integer | Ja | 1–1.000.000.000.000 |
reason | string | null | Nein | Shown in the Bank ledger and log bis zu 200 Zeichen |
Antwort
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
transactionId | integer | Ja | |
userId | string | Ja | |
type | string | Ja | Eines von add, remove |
amount | integer | Ja | |
previousBalance | integer | Ja | |
balance | integer | Ja | |
createdAt | string | Ja |
{
"transactionId": 98765,
"userId": "876543210987654321",
"type": "add",
"amount": 100,
"previousBalance": 1250,
"balance": 1350,
"createdAt": "2026-10-07T12:00:00.000Z"
}Beispiele
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/bank/members/876543210987654321/transactions" \
-H "Authorization: Bearer $BOTGG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"type":"add","amount":100,"reason":"Tournament prize"}'// 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/bank/members/876543210987654321/transactions', {
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({
type: 'add',
amount: 100,
reason: 'Tournament prize',
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os, uuid
import requests
res = requests.post(
"https://console.botgg.app/api/v1/guilds/123456789012345678/bank/members/876543210987654321/transactions",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # reuse it when you retry this request
},
json={
"type": "add",
"amount": 100,
"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
| HTTP | Codes |
|---|---|
| 400 | INVALID_JSON |
| 404 | MEMBER_NOT_FOUND |
| 409 | BANK_DISABLED, INSUFFICIENT_FUNDS |
| 413 | PAYLOAD_TOO_LARGE |
| 415 | UNSUPPORTED_MEDIA_TYPE |
| 422 | IDEMPOTENCY_KEY_REUSED, BOT_ACCOUNT, BALANCE_LIMIT |
| 503 | SERVICE_UNAVAILABLE |
Top balances
GET/guilds/{guildId}/bank/leaderboard
Dieses Feature muss auf dem Server aktiviert sein: Bank
| Name | In | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
guildId | Pfad | string | Ja | Die ID deines Servers · Discord-ID (String) |
limit | Query | integer | Nein | 1–100 · Standard 10 |
Antwort
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
items | array of object | Ja | |
items[].rank | integer | Ja | |
items[].userId | string | Ja | |
items[].balance | integer | Ja | |
currency | object | Ja | |
currency.name | string | Ja | |
currency.plural | string | Ja | |
currency.emoji | string | null | Ja |
{
"items": [
{
"rank": 1,
"userId": "876543210987654321",
"balance": 1350
}
],
"currency": {
"name": "Example",
"plural": "example",
"emoji": "🪙"
}
}Beispiele
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/bank/leaderboard?limit=10" \
-H "Authorization: Bearer $BOTGG_API_KEY"// 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/bank/leaderboard?limit=10', {
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);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/bank/leaderboard",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
params={
"limit": 10,
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)Fehler
| HTTP | Codes |
|---|---|
| 409 | BANK_DISABLED |
| 503 | SERVICE_UNAVAILABLE |