Authentication
Part of the Server API — not a stable public interface yet; see the note there.
Who a client is decides what it may do. There are four kinds:
| Role | Who | Signs in with | May |
|---|---|---|---|
guest |
Anyone who hasn’t signed in, or a device signed in with the guest code | Nothing — or the guest code, once the GM turns it on | Watch: read what players may see, never change anything |
player |
A person at the table, or a shared table screen | Their code | Watch, play on the map, change their own characters — a shared table, the whole party’s |
gm |
A second device run by the GM, such as a touch screen | The GM code | Everything, like the app |
integration |
A tool: Stream Deck, an overlay, another app | An API key | Read, or read and write, as the key allows |
The GM sets all of this up in Settings → Remote Play → Access: the guest code (off until turned on), a code per player and per shared table, the GM code (off until turned on) and API keys. See Remote Play.
Nobody changes anything without signing in. Guests watch, with or without the guest code: the code only decides who may watch — anyone who can reach the server, or only the people the GM gave it to.
A role is a name for a set of permissions — read, write, or both — and a scope, which
entities they apply to:
read |
write |
|
|---|---|---|
| Guests | What players may see | Nothing |
| Players | Their characters, and what players may see | Their characters; the map, as remote interaction allows |
| GM, API keys | Everything | Everything (keys with write only) |
What players may see is everything the GM hasn’t hidden from them — entities, pages, groups,
maps, encounters, references, assets, tables, modules and campaigns, each by its own
visibility or what it sits in: see
Hiding entries from players and
Hiding content from players, and a
system can hide a whole type with visibility.
A player’s characters are the party members the GM gave them in the campaign
settings of the campaign being played. A shared table —
a touch screen the players share — signs in as a player whose characters are every party member
of that campaign, besides the player each of them has: it moves the party’s tokens and changes
their sheets, and sees only what players may see.
Credentials
Section titled “Credentials”People type a code, six letters and digits shown as ABC-DEF, and the app answers with an
access token (ept_…) that the client keeps and sends from then on. Codes can be reused, so a
player signs in on every device they have with the same code; a new code signs out every device
that used the old one. API keys (epk_…) are made in the app, shown once, and sent as they
are. Both go in a header:
Authorization: Bearer ept_4mQ…The WebSocket is the exception: browsers can’t set headers on it, so a connection sends its access
token or key in an authenticate event instead — see
Signing in.
A request without one is a guest’s — or, while guests need the guest code, may do nothing but
sign in. A credential that isn’t valid — revoked, signed out, from a
code that was replaced — is refused with 401 and WWW-Authenticate: Bearer error="invalid_token",
never treated as a guest, so a client learns it has to sign in again. A WebSocket signed in with
it is closed with code 4401 the moment it stops being valid. An Authorization header with
any other scheme, such as a reverse proxy’s Basic, is ignored.
Access tokens and keys don’t expire, and the app stores only their hashes: a lost key can’t be shown again, only revoked and replaced.
Using an API key
Section titled “Using an API key”A tool signs in with a key alone: there is no code to send and nothing to exchange it for. Add one
in Settings → Remote Play → Access
(API keys), copy it while it is shown, and send it on every
request. GET /api/session is a quick check that the key works and what it
allows:
KEY='epk_…'curl http://192.168.1.42:8080/api/session -H "Authorization: Bearer $KEY"{ "role": "integration", "permissions": ["read", "write"], "name": "Stream Deck" }name is the one the key was given in the app, and a read-only key answers ["read"]. From then
on the same header goes on every call:
curl http://192.168.1.42:8080/api/game -H "Authorization: Bearer $KEY"curl -X POST http://192.168.1.42:8080/api/game/next -H "Authorization: Bearer $KEY"The same works from a script or a browser page:
const res = await fetch('http://192.168.1.42:8080/api/game', { headers: { Authorization: `Bearer ${key}` },});if (res.status === 401) throw new Error('The key was revoked or mistyped');const game = await res.json();On the WebSocket the key goes in the authenticate event instead of a header; see
Signing in with an API key. For
MCP it is the same Authorization header.
GET /api/server
Section titled “GET /api/server”Who the app is, and how guests get in. Open to everyone, with or without a credential.
{ "id": "155e17fb-…", "version": "5.2.0", "auth": { "guest": "open" } }| Field | Notes |
|---|---|
id |
Stays the same across launches and address changes: keep sign-ins by it, not by address |
version |
The app’s version |
auth.guest |
open (anyone may watch without signing in) or code (guests sign in with the guest code, and a client without a credential can’t use the API, the WebSocket or MCP; content stays open). Guests never change anything either way |
An app older than sign-in answers this path with something else — a 404, or not JSON — so a
client that finds no auth treats the app as one without sign-in.
GET /api/session
Section titled “GET /api/session”Who the request’s credential signs in as; a guest without one.
{ "role": "player", "permissions": ["read", "write"], "name": "Shelly", "player": { "id": "9B81…", "name": "Shelly", "color": "#E0FF00" }, "characters": [ { "id": "3335…", "name": "Aldric Thorne", "kind": "Character", "detail": "Warrior", "url": "/sheets/default/?id=3335…" } ]}| Field | Notes |
|---|---|
role, permissions |
As above |
name |
The player’s, the shared table’s or the API key’s; none for a guest |
player |
The player or shared table signed in as, for player |
characters |
Only for player: their characters in the campaign being played, by name — a shared table’s are the whole party. url opens one in a browser: the type’s sheet when it has one, else its HTML view; absent for a type that only renders in the app. detail is the line under the name in the app’s library, image and icon as in listed entries. Empty when no character is assigned |
POST /api/session
Section titled “POST /api/session”Signs in with a code, { "code": "ABC-DEF" } — case, spaces and the dash don’t matter. Answers
201 Created with the session, as GET /api/session describes it, plus the accessToken. This is
the only time the access token is sent. The answer also sets the browser’s
page-load cookie; a page on another origin can’t keep it, and ignores it.
curl -X POST http://192.168.1.42:8080/api/session \ -H 'Content-Type: application/json' \ -d '{"code": "FLK-DRP"}'A wrong code is 401. After five wrong codes in a minute from one address, every attempt from it is
429 with Retry-After, the right code included, until the first of them is a minute old.
Join links
Section titled “Join links”A link can carry the code, so opening it signs in: #code=ABC-DEF in the address’s fragment, as in
http://192.168.1.42:8080/client/#code=FLK-DRP. The fragment is never sent to the server and
browsers leave it out of Referer. The web client and the server’s front page read it on load,
remove it from the address at once, and sign in with POST /api/session as above — so each device
still gets its own access token, and New Code in the app makes every link with the old code
stop working. A link wins over a sign-in the browser kept for that server: the old access token is
signed out once the new one is kept. A web client of your own should do the same.
DELETE /api/session
Section titled “DELETE /api/session”Signs out the access token the request sends: 204, also when there is none or it was already
signed out. An API key is 400: keys are revoked in the app. The answer always clears the
page-load cookie.
Who may do what
Section titled “Who may do what”Every request under /api is checked by its method, so a new endpoint follows the same rules
without declaring anything. Full access below means the GM and API keys with write.
| Request | Who may send it |
|---|---|
GET /api/server, and anything on /api/session |
Anyone, signed in or not |
Any other GET |
Anyone who may read: everyone but a client without a credential while guests need the guest code |
POST /api/game/end-turn |
A player, for their own character’s turn, and full access |
GET /api/clients, and every other POST, PUT, PATCH and DELETE |
Full access |
Reads show what the client may see. A player or a guest gets only what players may
see: anything else is left out of lists, and asking for it by id is a 404 — not a 403, so it
doesn’t give away that it exists.
Changes over REST need full access, with one exception: a player may end their own character’s turn. Players change their characters through the WebSocket instead, where each write is checked against what they may change and the entity’s model schema — see Entity subscriptions.
A refusal says whether signing in would help:
| Who was refused | Answer |
|---|---|
| A guest, signed in with the guest code or not | 401 with WWW-Authenticate: Bearer: sign in and try again |
| A client that is signed in | 403: its sign-in doesn’t allow it |
The WebSocket follows the same roles and permissions, checked for each event rather than each
method: a request is answered requestFailed with unauthenticated where REST says 401, and
notAllowed where it says 403. Which events need what is listed under
Events a client can send.
Writes from other sites
Section titled “Writes from other sites”Any page may call the API from a browser (CORS), but browsers never
send an Authorization header by themselves: a page from another site writes only with an access
token or API key someone gave it. Every write needs one — guests never write — so a request with a
valid credential writes from any origin, and one without is 401 from every origin.
A tool hosted on a public site that writes to the API needs an API key with write.
Page loads
Section titled “Page loads”A browser following a link sends no Authorization header, so signing in also
sets a cookie that signs in the browser’s page loads, and signing out clears
it. Nothing else sets it.
Set-Cookie: encounterplus-155e17fb-…=ept_4mQ…; Path=/; Max-Age=34560000; HttpOnly; SameSite=Lax| Name | encounterplus-<server id>, the id of GET /api/server: cookies ignore the port, so two apps on one machine keep their own |
| Value | The access token, so a new code, a sign-out or a deleted player ends it at once |
| Lifetime | 400 days, the most browsers keep a cookie |
| Counts for | GET and HEAD outside /api, without an Authorization header. It opens pages and never authorizes anything else; the API always wants the header |
A cookie whose token is gone counts as a guest’s, and the answer removes it. It isn’t Secure,
since the server is plain HTTP.
An entity’s page at its reference address, /monster/goblin, is a 404 to a client that may not
see the entity, the same as for an entity that doesn’t exist, and so are a page and a table the
client may not see, at every address they render or redirect from. With the cookie, a player opens their
own characters and what players may see, and a GM device everything, also from a sheet that
navigates its frame there.
A browser that lost the cookie but kept its sign-in opens pages as a guest until it signs out and in again.
A cookie belongs to the app’s address, so only pages the app serves get it. A web client served
from elsewhere signs in its API requests and its socket as usual, but the pages it frames open as a
guest’s — browsers send a SameSite=Lax cookie only between pages of the same site, and the
exception, SameSite=None, needs HTTPS. Entities hidden from players are a 404 there, even on a
GM device.
The files outside /api — the web client, module, campaign and system files, sheets’ files and
the landing page at / — are served like any web server’s, to anyone who can reach the port,
guest code or not: see
Static content. A sheet only shows an
entity through the protocol, which checks access.

