Ansekai DocsAnsekai docs
All pages
Connections and security
Examples

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");

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.

TypeScript
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:

AccessA client of the playerOther players
PrivateReads and writesNothing
PublicReads and writesRead it with { playerId }
ServerOnly readsNothing

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.

TypeScript
// 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

Player Data · Ansekai Docs