Skip to content
Allay AI

WikiAllay Server

Security and privacy

Allay keeps what players ask, what it remembers about them, and their game state, so the backend treats every request as a stranger until it says who it is. This page covers who may call what, how servers stay apart, what the backend keeps and for how long, and how a player gets a copy of their data or has it erased.

#Every request says who sends it

Since 6.0, the backend answers a plugin only when the request carries Authorization: Bearer …:

  • On a hosted backend (billing on, like allay.chat) that's the server's license. A server that brings its own key gets a license free from POST /api/v2/license, and Allay 6.0 does that by itself. A license identifies the server, and paying for it is what turns on the backend's own key.
  • On a self-hosted backend (SELFHOSTED=1) that's PLUGIN_TOKEN, a secret of at least 24 characters you set in the backend's environment and in the plugin's server.token. Without it the backend answers no plugin at all, rather than everyone who can reach it.

Only four things stay open: GET /api/health, POST /api/v2/license (a new license, limited per address), a player's copy by link (GET /api/v2/exports/<token>, since 6.9: 32 random bytes in the link are the key, for 24 hours), and Telegram's webhook, which has its own secret. The admin panel wants a session, and its sign-in locks after failed tries. /allay init wants the token too, since its recovery link resets any admin's password.

#Servers never meet

The backend files every player under a tenant: license:<id> on a hosted backend, self on a self-hosted one. Memories, deaths, players' state, sessions, agents' threads, task outcomes, the public thread, the statistics, and the rate limits all carry it. A server names any player id it likes, but only ever reaches its own players: the same Minecraft account on two servers is two players. A tool result counts only from the server whose run asked for it.

#What the backend keeps

What Where How long
The session: questions, tool results, answers, and a summary MongoDB, sealed 30 days after the last question (CHAT_TTL_SECONDS)
A server's public thread MongoDB, sealed 2 hours after the last public question
An automation agent's thread, and how its tasks ended MongoDB, sealed 2 hours after its last wake, outcomes until the next question
Memories: up to 200 short facts and places MongoDB, sealed Until the player deletes them, or 365 days after their last question
Deaths: the newest 100, with place, cause, and drops MongoDB, sealed 365 days after the player's last question
The player's state: time zone, settings, goals MongoDB, sealed 365 days after the player's last question
The work state of the player's automation agents on each server: brief, job, what they wait for. Since 6.31 MongoDB, sealed (work_states) Until they end, or 30 days after its last change
A link to the player's copy: only its token's digest MongoDB 24 hours
A server's chat, while the plugin's chat_history is on: public lines, local lines with who saw them, private messages. It needs nobody's consent, since everyone on the server reads the chat, and the plugin's /allay privacy says it's kept. Since 6.34 MongoDB (chat_history): names and texts sealed, the sender and readers as pseudonyms 72 hours after each line
A player's consent: which notice they agreed to, its hash, the policy's revision, the age answer, and when MongoDB Until the player withdraws it or is erased, at most 730 days after their last question
A block: the server, the pseudonym, who blocked, and when MongoDB Until an admin unblocks the player, even past an erasure
Runs: numbers per question, the player as a pseudonym MongoDB 730 days
The player directory: a pseudonym's name, UUID, and operator status per server, from the last question MongoDB 730 days after the last question
Days: sums of runs, with the day's pseudonyms MongoDB Sums forever. Who played: 730 days
Traces: prompts, answers, tool calls MongoDB, sealed but for models, tokens, and steps TRACE_DAYS (30)
Telemetry (since 6.24, when set up): numbers per run, step, and tool, the player as a pseudonym, never a word Your OpenTelemetry collector The collector's own. allay.chat keeps 30 days
A server: the address it connects from, the address players join with, the game and plugin versions MongoDB 730 days after its last question
The audit log: who changed what in the panel, from which address MongoDB 730 days

“Sealed” means AES-256-GCM with a random IV per value, under a key derived with HMAC-SHA256 from SECRETS_KEY (or the key file in /data), which never sits in MongoDB: a dump or a backup alone reads nothing (since 6.9). The backend opens what it needs to answer. An owner can open one run's trace in the panel to look into a reported problem, after saying why. Every such look goes to the audit log with the reason, and the environment's account, which scripts use, can't open any. Nothing else shows a player's words.

Not sealed: the player directory (name, UUID, operator status), runs' numbers, consent records, blocks, and the audit log. They hold no player's words, and the panel and the statistics read them.

Runs never hold a player's id or name. Each player shows up there as a pseudonym, p_ and 20 hex digits: an HMAC of the server's tenant and the player's id under a key derived from SECRETS_KEY. Since 6.9 the tenant is part of it, so the same account on two servers is two pseudonyms and the statistics can't tie them together. It's pseudonymised data, not anonymous, since the backend finds a player again from their UUID. Since 6.4 a separate player directory maps each pseudonym on a server to the name, UUID, and operator status of the player's last question, and the panel shows those to admins and owners (to every role before 6.9). Viewers see pseudonyms and numbers only. The panel's operators run the service and need to tell players apart, for support and for erasure on request (GDPR art. 6(1)(f)). A rename shows everywhere at once, and an erasure takes the name off every run. A player who turns on full privacy in the plugin (since 6.5 and Allay 6.3) stays out of the directory: the panel forgets their name and UUID at once and shows them by pseudonym, with Steve's head. Memories, the session, and traces work as before. The panel shows players' faces, which the backend fetches from mc-heads.net by UUID (or by name on offline-mode servers) and caches for 6 hours, so viewers' browsers never call a third party.

The backend's log carries run ids and tenants. It never holds a player's name, id, question, or answer, nor a key, a license, or a token. The one code it prints is a hosted backend's first setup code.

Since 6.1 the plugin (Allay 6.1) shows each player a notice before their first question and asks them to agree. The backend keeps the answer per tenant and player: the notice's version and when they agreed, as proof under GDPR art. 7(1). Since 6.9 it also keeps the SHA-256 of the notice the player saw together with the privacy policy's revision, so the plugin asks again, saying the notice changed, whenever either changes. It also keeps whether the player is old enough to agree where they play, with the age group they picked, which Allay 6.7 asks every player. GET, PUT, and DELETE /api/v2/users/{id}/consent read, record, and withdraw it, and a player withdraws with /allay privacy withdraw. A copy of the player's data shows it, an erasure removes it, and migrate retag moves it with the memories.

On a hosted backend the agreement is enforced (since 6.9): a question, an automation's wake, a memory, a death, or a state from a player with no agreement in force gets 403 CONSENT_REQUIRED, and nothing runs, is traced, or is kept, whatever the plugin's settings. A self-hosted backend leaves the notice to its operator.

Withdrawing (since 6.9) erases what the agreement covered: memories and places, deaths, state, automation agents (since 6.31), links to the player's copy, the session, pending outcomes, and agents' threads. The record of the agreement stays, marked withdrawn, as proof of what the data rested on, until the player's records go. The runs keep their numbers under the pseudonym.

Requests through OpenRouter go only to providers that don't store or train on them (provider.data_collection: "deny", since 6.9, and OPENROUTER_DATA_COLLECTION=allow lifts it).

#A player's copy and erasure

Under the GDPR a player may ask what a server keeps about them and have it erased.

  • In the game, a player runs /allay privacy export for a link to their copy, good for 24 hours, and an operator does it for a player with /allay privacy export <player>. /allay privacy erase <player> erases it. See the plugin's wiki.
  • Through the API, GET /api/v2/users/{id} returns everything about the player of the calling server, and DELETE erases it.
  • In the panel, an admin erases a player from their page, or under Erase a player on the Players page by server and a player picked by name, or a pseudonym or UUID.

A breach that touches players' data reaches the servers' owners through the bot: an owner sends one text to every license holder from the Licenses page (POST /api/admin/licenses/notify), and the audit log keeps how many got it, not the text.

Erasure deletes the player's name in the directory, memories, deaths, state, the chat lines they wrote, open links to their copy, consent, session, pending outcomes, agents' threads, and the traces of their runs. A copy carries the chat lines they wrote over the last 72 hours too. Their runs keep only numbers, under erased, so the statistics still add up and point at nobody. The server's public thread holds other players' talk too, and it expires within 2 hours by itself. The audit log keeps that an erasure happened, under the pseudonym. A block stays: it holds only the pseudonym, and lifting it with an erasure would let a blocked player back in.

#Behind a proxy

The backend sees a proxy's address, not the player's. Set TRUSTED_PROXIES to your proxies' addresses or CIDR ranges, such as 172.18.0.0/16 for a Docker network, and CLIENT_IP_HEADER to the header they set. Forwarding headers from anyone else don't count, and X-Forwarded-For is read from the right. Without TRUSTED_PROXIES, everyone behind a proxy shares one address: one shared limit for new licenses and sign-ins.

#Moving a self-hosted backend to a hosted one

A self-hosted backend's data belongs to the tenant self. To carry it over to a license on a hosted backend:

  1. Dump the self-hosted MongoDB and restore the collections you want into the hosted one: memories, deaths, player_states, consents, runs, run_days, and, when the hosted backend is the same operator's, settings, admin_accounts, admin_audit, and Mastra's mastra_ai_spans. Sessions don't move: they expire on their own.

  2. Inside the hosted backend's container, check and move:

    bun run dist/application/migrate.js status
    bun run dist/application/migrate.js retag --from self --to license:<id> --dry-run
    bun run dist/application/migrate.js retag --from self --to license:<id>

retag moves memories (also those from before 6.0, which have no tenant), deaths, players' state, consents, and runs to the license, turns players' ids in the statistics into pseudonyms under the hosted backend's key, and gives the players it knows (from the directory, consents, memories, deaths, or state) the license's pseudonyms in runs, days, the directory, and blocks, since a pseudonym is per tenant since 6.9. It does nothing a second time. Settings and, since 6.9, players' data sealed with the old SECRETS_KEY open only with the same key. Runs pseudonymised by a 6.0 self-hosted backend keep its pseudonyms, so give both backends the same SECRETS_KEY, or dump from 5.x, to keep players' statistics continuous. On a hosted backend, memories without a tenant reach nobody: the log warns about them on start, and purge-untagged deletes them.

#Naming players from before 6.4

The player directory fills with each question since 6.4, so a player who hasn't asked since shows as a pseudonym. When you know who they are, give their names and UUIDs, with or without dashes, inside the backend's container (for online-mode servers Mojang's https://api.mojang.com/users/profiles/minecraft/<name> gives a UUID, and the server's usercache.json lists everyone who joined):

bun run dist/application/migrate.js players Steve=8667ba71b85a4004af54457a9734eed7 Alex=ec561538f3fd461daff5086b22154bce

It prints each player's pseudonym and the servers whose runs had them. The runs give the first and last question. A UUID without runs changes nothing, and a name a newer question brought stays.

Next: What Allay can do