Skip to content
DonutStatsAPI
Sign up
Concepts

Data conventions

The rules every endpoint follows, so you can write one parser for all of them.

The API speaks JSON over HTTPS. Responses are UTF-8, field names are camelCase and every endpoint is a GET (or HEAD). Anything else gets 405. URLs are capped at 2,048 characters.

New fields may be added to any object at any time. Ignore fields you do not know. Removing or renaming a field only happens in a new API version.

Every time is a Unix timestamp in milliseconds, UTC, as a plain number. Fields that hold one end in At, such as firstSeenAt and updatedAt. History points use t. Daily series also give a day string in YYYY-MM-DD form, and days always run from midnight to midnight UTC.

const listedAt = new Date(listing.firstSeenAt);
console.log(listedAt.toISOString());

const hoursAgo = (Date.now() - listing.firstSeenAt) / 3_600_000;
KindUnitExample
MoneyDonutSMP dollars, may have decimals4800000000000
Unit pricesDollars per single item: price divided by stack size15125
PlaytimeSeconds14745600
Changes and marginsFractions: 0.05 is 5%, -0.2 is 20% down0.339
Uptime and GiniFractions from 0 to 10.9993
CountsIntegers111050

Big numbers are safe

The largest balances are in the trillions, well inside the range JavaScript numbers hold exactly. No string encoding is needed.

null means we do not know or it does not apply, for example bid: null when nobody has an open buy order. A field that is documented is always present, with two exceptions: inside stats a stat is left out until it has been read once, and every field of ProductDetails only appears when it applies.

Usernames are 1 to 16 letters, digits or underscores. Bedrock players have a leading dot, such as .Bamsden816, and that dot is part of the name. Lookups are case insensitive and responses always use the player's current capitalization.

The market is organised by product: an item plus everything that changes its value. A product key is the item id, followed by the variant in square brackets when there is one.

KeyWhat it is
diamondPlain diamonds
elytra[mending,unbreaking:3]An elytra with Mending and Unbreaking III
enchanted_book[mending]A Mending book
potion[poison]A Potion of Poison
spawner[skeleton]A skeleton spawner
firework_rocket[flight:3]Flight duration 3 rockets
blue_shulker_box[filled]A blue shulker box with items inside

Keys contain brackets, commas and colons, so URL encode them in paths and query strings:

const key = "netherite_sword[sharpness:5,unbreaking:3]";
const response = await fetch(
  `https://api.donutstats.io/v1/items/${encodeURIComponent(key)}`,
  { headers: { "x-api-key": process.env.DONUTSTATS_API_KEY } },
);

The variant is built from these parts. When an item has more than one, they are joined with a semicolon.

  • Enchantments, sorted by id and joined with commas. Level 1 is written without a level: sharpness:5,unbreaking:3, mending. Enchanted books use the enchantments stored in them.
  • Type names for potions, splash and lingering potions, tipped arrows, spawners, trial spawners, goat horns and suspicious stew: poison, skeleton and so on.
  • Flight duration for firework rockets other than 1: flight:2, flight:3.
  • filled for shulker boxes with contents. Each box is different, so these never get a market price. The contents are in details.contents.
  • unique for filled maps, written and writable books and player heads. These never get a market price either.
CategoryHolds
valuablesElytras, totems, beacons, netherite, diamonds, emeralds, gold, enchanted golden apples, dragon heads and similar rare goods
combatSwords, armour, bows, crossbows, tridents, maces, shields, arrows, end crystals, respawn anchors and firework rockets
toolsPickaxes, axes, shovels, hoes, shears, fishing rods, buckets, name tags and other tools
potionsPotions, splash and lingering potions and enchanted books
dropsMob drops such as bones, skulls, pearls, blaze rods, gunpowder, iron ingots and redstone
foodFood, including golden apples and golden carrots
miscSpawners, spawn eggs, smithing templates, pottery sherds and music discs
blocksEvery block and any item without a more specific category, shulker boxes included
StatMeaningLeaderboard
moneyBalance in dollarsmoney (in game)
shardsShards heldshards (DonutStats)
killsPlayer killskills (DonutStats)
deathsDeathsdeaths (in game)
playtimePlaytime in secondsplaytime (in game)
placedBlocksBlocks placedplacedBlocks (in game)
brokenBlocksBlocks brokenbrokenBlocks (in game)
mobsKilledMobs killedmobsKilled (in game)

Boards marked in game are DonutSMP's own leaderboards. Kills and shards have no board on DonutSMP, so DonutStats ranks every player whose stats it has on record.