Modules
Player Data
What each player keeps: a profile, settings, progress, an inventory. A value is anything JSON can hold, up to 12 KB, and a player keeps up to 100 keys.
Reading and writing
await ansekai.data.set("level", 3);
const level = await ansekai.data.get("level"); // { key, value, version } or null
await ansekai.data.increment("coins", 5);
const everything = await ansekai.data.list();
await ansekai.data.delete("level");-- Server code names the player, the rules don't stop it
ansekai.data.set(ctx.player, "level", 3)
local level = ansekai.data.get(ctx.player, "level")
ansekai.data.increment(ctx.player, "coins", 5)
local everything = ansekai.data.list(ctx.player)
ansekai.data.delete(ctx.player, "level")increment adds in one step, two devices can't lose each other's change.
Versions
Every key has a version that goes up with each write. A write with { version } is refused with version_conflict when the key changed since it was read, version: 0 only creates a key that isn't there.
const save = await ansekai.data.get("hero");
await ansekai.data.set("hero", { ...save.value, level: 4 }, { version: save.version });Rules
The Keys tab of the settings of Player Data says who reaches a key from a game client:
| Access | A client of the player | Other players |
|---|---|---|
| Private | Reads and writes | Nothing |
| Public | Reads and writes | Read it with { playerId } |
| Server | Only reads | Nothing |
A key without a rule follows the default, which is Private unless you change it. Keep anything players could cheat on, like gold, ranks or items, as Server keys and change them from a plugin. A client that tries gets read_only_key.
// A public key of another player
const hero = await ansekai.data.get("hero", { playerId: "..." });In the panel
The Player Data page lists every player with its keys. You can read, change and delete values there, a change counts at once.
Updated November 21, 2026