DonutAPI reference
Live player stats and online status from DonutSMP, as JSON.
Behind the API, real Minecraft accounts stay logged in on DonutSMP. Your request goes to a free account. It runs the command in game, reads the answer, and you get JSON back, usually in under a second.
Base URL: https://your-server
Quickstart
dnt_.Authorization header.result.money, result.playtime (seconds) and more.curl -H "Authorization: dnt_YOUR_KEY" \ https://your-server/v1/stats/Notch
const res = await fetch("https://your-server/v1/stats/Notch", {
headers: { Authorization: "dnt_YOUR_KEY" },
});
const body = await res.json();
if (!res.ok) throw new Error(body.error + ": " + body.message);
console.log(body.result.money, body.result.playtime);
import requests
r = requests.get(
"https://your-server/v1/stats/Notch",
headers={"Authorization": "dnt_YOUR_KEY"},
timeout=30,
)
body = r.json()
r.raise_for_status()
print(body["result"]["money"], body["result"]["playtime"])
Authentication
Every request to /v1/… needs a key. Any of these headers works:
Authorization: dnt_YOUR_KEY Authorization: Bearer dnt_YOUR_KEY X-API-Key: dnt_YOUR_KEY
A missing, wrong or switched-off key gets 401 unauthorized. The API allows calls from any website (CORS), but never put your key in a public web page: anyone can read it there. Call the API from your server or bot.
Java & Bedrock names
| Player | Write it as | Example |
|---|---|---|
| Java | the name | /v1/stats/Notch |
| Bedrock | a dot, then the gamertag | /v1/stats/.SomeGamertag |
Names are 1–16 letters, digits or _ (plus the leading dot for Bedrock). Anything else gets 400 bad_request. The response says which kind it was in platform.
Player stats
Runs /stats <username> in game, reads the stats menu and returns the numbers.
| Query | Effect |
|---|---|
fresh=1 | Skip the cache and always ask the game. Slower, and it uses up the server's capacity: use it only when you really need the newest numbers. |
raw=1 | Also return result.fields: every item in the menu, for debugging. |
Response · 200
{
"status": 200,
"result": {
"username": "Notch",
"platform": "java",
"money": 1200000000,
"shards": 157,
"kills": 58,
"deaths": 35,
"playtime": 201600,
"placed_blocks": 11400,
"broken_blocks": 60700,
"mobs_killed": 149,
"display": { "money": "1.2B", "shards": "157", "playtime": "2d 8h" }
},
"cached": false,
"worker": "w_3f9a1c07be",
"took_ms": 412,
"fetched_at": "2026-11-06T10:41:07.512Z",
"stale": false,
"missing": []
}
Fields of result
| Field | Type | Unit | When | Notes |
|---|---|---|---|---|
username | string | always | as you asked for it | |
platform | string | always | "java" or "bedrock" (from the dot) | |
money | integer | $ | always | exact balance |
shards | integer | always | ||
kills, deaths | integer | always | ||
playtime | integer | seconds | always | 201600 = 2 days 8 hours |
placed_blocks, broken_blocks | integer | always | ||
mobs_killed | integer | always | ||
money_spent_on_shop | integer | $ | optional | only when the game shows it |
money_made_from_sell | integer | $ | optional | only when the game shows it |
kdr | number | optional | kills per death, only when the game shows it | |
display | object | always | the same values as text, exactly as shown in game ("1.2B", "2d 8h") | |
fields | array | with raw=1 | every item in the menu, for debugging |
A name that never played on DonutSMP gets 404 not_found.
Partial answers. Now and then the game shows the stats menu before every number is in. Then missing lists the stats that are not in result (for example ["shards"]). Such an answer is never cached, so asking again usually gets the full one. missing is an empty list for a complete answer.
Is a player online?
How the check works depends on the owner's setting. With the player list (the default), the account reads the server's list of online players, so the player never notices. With whisper, the account sends the player a tiny /msg and reads the reply. The owner can also switch the check off; then every call gets 503 activity_disabled.
{
"status": 200,
"result": {
"username": "Notch",
"platform": "java",
"online": true,
"status": "online",
"reason": "in the player list",
"detail": "Notch"
},
"cached": false,
"worker": "w_8d02e4a1f6",
"took_ms": 12,
"fetched_at": "2026-11-06T10:41:09.020Z",
"stale": false
}
| Field | Type | Notes |
|---|---|---|
online | boolean or null | true = online. false = offline (whisper mode only). null = could not tell: with the player list, a player who is not listed may still be online on another DonutSMP server, or hidden. Rely on this field. |
status | string | online, offline, not_found (never joined; whisper mode) or unknown (not in the player list) |
reason | string | a short text for people |
detail | string | the server's own line, or the listed name. Always included. |
chat | array | only with raw=1: the chat lines the account saw |
Answers that could not tell (online: null) are never cached.
Health
No key needed. Use it for uptime monitors.
{ "ok": true, "workers_online": 12, "workers_total": 25, "queued": 1 }
Every response
| Field | Type | Notes |
|---|---|---|
status | integer | the HTTP status again |
result | object | the answer (see each endpoint) |
cached | boolean | true = answered from memory, not from the game just now |
worker | string | a short id of the account that answered, like w_3f9a1c07be. The same account always has the same id; it is not the account's name. |
took_ms | integer | how long the lookup took, in milliseconds. 0 when cached. |
fetched_at | string (ISO 8601 time, UTC) | when this answer was read from the game. Older than now when it came from the cache or is stale. |
stale | boolean | true when a fresh lookup failed (timeout, every account busy or at its limit…) and you got the last good answer instead, up to about 10 minutes old by default. Check fetched_at to see how old it is. |
missing | array of strings | stats only: the stats the game did not show this time (see partial answers). Empty for a complete answer. |
Errors
Every error looks like this. Code against error; the message is for people and may change.
{ "status": 429, "error": "rate_limited", "message": "rate limit of 60/min exceeded" }
| HTTP | error | Meaning | What your code should do |
|---|---|---|---|
| 400 | bad_request | The name is not a Java name or a .Bedrock name. | Don't retry. Fix the name. |
| 401 | unauthorized | The key is missing, wrong, or switched off. | Don't retry. Check the key. |
| 404 | not_found | No such player (stats), or a wrong URL. | Don't retry. A "no such player" answer is cached for a short while. |
| 405 | bad_request | Not a GET request. | Use GET. |
| 429 | rate_limited | Your key went over its limit per minute, or has too many lookups open at once. | Wait the seconds in the Retry-After header, then go on. Send fewer requests in parallel. |
| 502 | unparsed | The stats menu opened but could not be read. | Retry once, later. |
| 502 | worker_offline, worker_busy, worker_disconnected, internal | The account answering had a problem. The server already retried on another one. | Retry once after a second. |
| 503 | no_workers | No account is online right now. | Back off: retry after 30 s or more. |
| 503 | queue_timeout | Every account stayed busy too long. | Back off a few seconds, then send fewer requests at once. |
| 503 | capacity | Every account has used its lookups for now (the owner limits how often each account may look things up). | Wait the seconds in Retry-After. Cached answers still work. |
| 503 | worker_warming | The accounts just joined and are not ready yet. | Retry after Retry-After, or in about a minute. |
| 503 | overloaded | Too many lookups are already waiting. | Back off for Retry-After seconds, then send fewer at once. |
| 503 | shutting_down | The server is restarting. | Retry after Retry-After seconds. |
| 503 | activity_disabled | The online check is switched off on this server. | Don't retry. Ask the owner. |
| 504 | timeout | The game did not answer in time. | Retry once. |
Every 429 and 503 carries a Retry-After header (seconds); the body then also has retry_after_s with the same number. Many failed lookups are answered with a stale result instead of an error (see stale).
Rate limits
Each key has a limit per minute (the owner sets it per key; keys without their own limit use the server's default, 120 a minute unless changed) and a cap on lookups open at the same time. Over either, you get 429 rate_limited and a Retry-After header in seconds. Separately, the owner limits how fast each game account works, like a real player would. Very large bursts wait in a queue, and can end in 503 queue_timeout or 503 capacity (also with Retry-After).
Caching
| What | Reused for |
|---|---|
| Stats | 60 s by default |
| "Player not found" | 30 s by default |
| Online check | 5 s by default |
The owner can change these. Identical requests already in progress share one answer. cached: true tells you an answer came from memory; ?fresh=1 skips it.
Retrying the right way
Retry only what can succeed later (429, 502, 503, 504), honour Retry-After, and give up after a few tries.
async function donut(path, key, tries = 3) {
for (let i = 0; i < tries; i++) {
const res = await fetch("https://your-server" + path, { headers: { Authorization: key } });
const body = await res.json();
if (res.ok) return body.result;
if (![429, 502, 503, 504].includes(res.status)) throw new Error(body.error);
const wait = Number(res.headers.get("Retry-After")) || 2 ** i;
await new Promise((r) => setTimeout(r, wait * 1000));
}
throw new Error("gave up");
}
import time, requests
def donut(path, key, tries=3):
for i in range(tries):
r = requests.get("https://your-server" + path, headers={"Authorization": key}, timeout=30)
body = r.json()
if r.ok:
return body["result"]
if r.status_code not in (429, 502, 503, 504):
raise RuntimeError(body["error"])
time.sleep(int(r.headers.get("Retry-After", 2 ** i)))
raise RuntimeError("gave up")
CORS and other URLs
Responses carry Access-Control-Allow-Origin: *, allow the Authorization and X-API-Key headers and let scripts read Retry-After, so browsers may call the API (keep the key out of public pages anyway). The same endpoints also answer at /api/stats/:username, /api/activity/:username, /stats/:username and /activity/:username. Only GET (and the browser's OPTIONS) are allowed.
Try it
Questions or a key: ask the owner of this server.