API reference

Base address: https://api.wyrden.co.uk. Everything is HTTPS with JSON bodies.

Conventions

  • Errors are {"error": "code"}, sometimes with a message.
  • 429 means you are sending too fast. It carries a Retry-After header.
  • 503 with {"status": "unavailable"} means nothing was decided. Try again.
  • Identifiers such as ses_…, gam_… and flg_… are opaque. Do not parse them.
  • Wyrden never stores a raw Meta user ID or device ID. Where you see player_ref or device_ref, it is a keyed hash, different for every game.

Who calls what

Caller Authenticates with Endpoints
Your game (or the SDK) Nothing: the attestation is the proof /v1/session/*
Your game server A game-server key, Authorization: Bearer wyk_gs_… /v1/gs/*
Your tools and CI A management key, Authorization: Bearer wyk_mg_… (Full plan) /v1/games/*
Photon's servers (the Photon add-on) A Photon key, key=wyk_ph_… in the URL or the X-Wyrden-Key header /v1/photon/*
The build plugin, anyone Nothing GET /v1/sdk/revoked-issuers, POST /v1/sdk/refused

Create keys on the game's Setup page. A key is shown once.

Game endpoints

POST /v1/session/nonce

Field
licence required The licence's public ID
user_id required The player's Meta user ID
mode optional Game mode, 1 to 32 of a-z 0-9 _ -. Default default.
sdk optional SDK version
build SDK The build's version code, so Wyrden can choose the login's challenges from that build's tables. It must be the version Meta attests.

Reply: status (ok, denied, unprotected), session_id, nonce (43 characters, valid 120 seconds, single use), expires_in, game_key (the game's X25519 public key, Base64URL) and game_key_id, which names that key. With the SDK's device checks: checks, the login's file and code challenges (the same shape as a heartbeat challenge), to answer in the evidence; and passive: true when Wyrden has put this SDK version into passive mode, in which case send no evidence.

POST /v1/session/attest

Field
licence, session_id, user_id, mode required As sent to and returned by the nonce call
token required The attestation token from Meta
user_proof recommended From Users.GetUserProof(). Without it identity is unverified.
client_key for heartbeats and evidence An X25519 public key made for this login, Base64URL
game_key_id with client_key The game_key_id the nonce reply gave. It names the game key you agreed the session keys with, so a login that started just before the key was replaced still completes.
evidence SDK Evidence sealed with the session's evidence key

Reply: status (ok, denied, unprotected, unavailable, unregistered_device), and when ok: ticket, ticket_expires_at, and heartbeat if the heartbeat check is running. On denied: optionally message (your own update text) or ban (kind, until, appeal_code, appeal_url). On unavailable: the same nonce and token may be presented again, unless retry is new_nonce, which means start again from a new nonce.

unregistered_device answers only the staging licence, on a headset that is not registered for development. It comes with pairing_code (such as ABCD-EFGH, valid 15 minutes, single use): show it, and have someone enter it on the game's Setup page. The same headset gets the same code until it is used or expires. No session is served until then. See development headsets.

What is refused before any rule you configured is looked at, on every plan and preset:

  • a token Meta does not verify, or one Meta reports expired;
  • a nonce that was never issued, has expired, or was already used;
  • a nonce presented with a different session, licence, player or mode;
  • a token whose package name or signing certificate is not registered for the licence.

Session keys

If you send client_key, both sides derive three keys for the session:

shared    = X25519(your private key, game_key)
evidence  = HKDF-SHA256(secret = shared, salt = session_id, info = "wyrden evidence v1", 32 bytes)
heartbeat = HKDF-SHA256(secret = shared, salt = session_id, info = "wyrden heartbeat v1", 32 bytes)
traffic   = HKDF-SHA256(secret = shared, salt = session_id, info = "wyrden traffic v1", 32 bytes)

The traffic key signs your game's own messages to your game server, which reads it from the ticket (tk, below). A message's signature is the first 16 bytes of

HMAC-SHA256(traffic, "traffic" 0x00 seq 0x00 type 0x00 payload)

where seq is the message's sequence number in decimal ASCII, which only goes up within a session, and payload is the message's bytes exactly as sent. The SDK's WyrdenSdk.SignTraffic(type, payload) returns the next seq and the signature in hex; the game-server library's netguard package checks both.

Evidence is sealed with AES-256-GCM under the evidence key: a random 12-byte nonce, then the ciphertext, with "ev|" + session_id as associated data, all Base64URL.

When the game key is replaced, a login that names the previous key with game_key_id is still accepted for 10 minutes. After that it is refused, and the game starts again with a new nonce.

Heartbeats

A challenge is {"id", "seed", "kind", "param", "wait_ms", "timeout_ms"}. Wait wait_ms, then:

POST /v1/session/heartbeat
{"session_id": "ses_…", "id": "hb_…", "answer": "…64 hex…", "mac": "…64 hex…"}
answer = HMAC-SHA256(heartbeat key, "answer" 00 id 00 seed 00 kind 00 param 00 value 00)
mac    = HMAC-SHA256(heartbeat key, "request" 00 session_id 00 id 00 answer 00)

00 is a zero byte after every field. value is empty for kind: "ping". For kind: "manifest" it is the value your build holds for param. For kind: "scatter" (D-135), param is the build's number of Scatter checks n; the value is bits.mac, where bits is a bitmap (Base64URL, ceil(n/8) bytes, bit i of byte i/8 for check i) of the checks that have run and mac is hex(HMAC-SHA256(key = hex-decoded seed, bits followed by each such check's 32-bit token, little-endian, in order)); with a heartbeat, send bits in the evidence as sc. For kind: "file" and kind: "code", param is path|log2|first|count: hash count chunks of 2^log2 bytes from chunk first of the file at path in the APK as the system loaded it (file), or of that library's executable segment in memory (code); take the first 16 bytes of each chunk's SHA-256 and

value = hex(HMAC-SHA256(key = hex-decoded seed, the chunk hashes in order))

Evidence

The SDK's evidence is a JSON object, sealed as above: reports (one {"m": module, "sig": [{"c": code, "d": {…}}]} for each check the build contains; a report with no signals is a clean answer), ans (the login's challenges answered: challenge ID to value), clk (r, l, w: boot time read by system call and through libc, and wall time, in milliseconds), libs (the native libraries the app loaded from its own files), perf (f frames, mean and p95 frame time in ms, drop dropped frames, sdk_us the SDK's main-thread time in µs, bg_ms its background time, win seconds) and err (w where, t error type, n times). Evidence may also ride on a heartbeat request as evidence.

Reply: {"status": "ok", "heartbeat": {…next challenge…}}, {"status": "ended"} if the session no longer exists, or {"status": "unprotected"} if the licence was suspended or revoked during the session. On unprotected, stop sending heartbeats and carry on: the player is not affected.

  • A request with a wrong mac is dropped with 401 and changes nothing.
  • Sending the last accepted answer again (after a lost reply) returns the outstanding challenge again and earns nothing.
  • An older answer is a replay and is evidence.
  • The reply never says whether anything was detected.

POST /v1/session/report

A player reports another player from inside your game, when Player reports is on.

{"session_id": "ses_…", "reported_user_id": "…", "category": "cheating", "note": "…", "ts": 1764300000, "mac": "…64 hex…"}
mac = HMAC-SHA256(heartbeat key, "report" 00 session_id 00 reported_user_id 00 category 00 ts 00)

ts is the current Unix time in seconds; a request more than 5 minutes off is refused. category is 1 to 32 of a-z 0-9 _; note is optional, up to 280 characters. A wrong mac, a stale ts and an ended session all get 401, so a report can only be sent in the name of the session's own player.

Reply: {"accepted": true, "report_id": "rep_…"}, or {"accepted": false, "reason": "repeat"} for a second report of the same player within 24 hours, which is dropped and counts against the reporter. Too many reports in a day get 429. A report never penalises anyone by itself: see Player reports.

Game-server endpoints

GET /v1/gs/config

Returns game_id, env, protection (on or off), keys ([{"kid", "public_key"}], Ed25519, Base64URL), outage ({"default": "allow", "modes": {…}}), cursor, server_time, traffic_seal (32 bytes, Base64URL), the key that opens the traffic keys in this game's tickets, replay ({"on": false}, or {"on": true, "hz", "before_s", "after_s"}), meta ("ok", or "unreachable" once Meta's verification has failed for 30 seconds without a success: Wyrden is then issuing no tickets, and a server applies your outage rule to players without one), and behavior ({"on": false}, or the motion limits: head_speed_max, hand_speed_max, reach_max, head_turn_max, frames, snap_degrees, hold_deg_per_s, hold_frames). Keep the seal on your servers: anyone who holds it and sees a ticket can sign as that player.

protection: "off" means the licence is suspended or revoked: admit players without tickets.

After the ticket key is replaced, keys lists the new key and, for 65 minutes, the old one, so tickets issued just before the change stay valid until they expire. The old key's private half is destroyed at once: nothing new is signed with it.

GET /v1/gs/events?after=<cursor>&wait=<seconds>

A long poll, up to 25 seconds. Returns {"events": [{"id", "type", "session_id", "reason", "message"}], "cursor"}. Pass the returned cursor next time; nothing is lost across reconnects.

type Do
kick Disconnect the player. reason is an opaque code: never show it to the player.
warn A penalty ladder's warning. Show message, which you wrote in the configuration, to the player.
restrict Your policy asks for restricted play from now on, such as a cheater-only lobby at the next match.
config The licence or the keys changed. Fetch /v1/gs/config again now. reason is licence or keys.
replay A session was flagged and the studio keeps replays: the server that has this player sends their recording with POST /v1/gs/replay.

A server that misses a config event still learns of the change: a player with no ticket makes the library check the configuration again before refusing them, at most once every 250 milliseconds.

POST /v1/gs/session/end

{"session_id"}. Tell Wyrden a player left. Only your own game's sessions can be ended.

POST /v1/gs/session/tags

{"session_id", "tags": {"state": "vehicle"}}. Report game state so a suppression rule can refer to it. Up to 8 tags; keys and values are 1 to 32 of a-z 0-9 _ -. Tags can only be set by your game server, never by a client.

POST /v1/gs/flags

{"session_id", "code": "speed_hack", "detail": {…}}. Raise one of your own flags on a live session, with Custom flags on (Full plan). code is 1 to 48 of a-z 0-9 _; detail is up to 8 KB of JSON and is kept with the flag. The flag goes through the same policy as Wyrden's own checks: tier 4, your configured weight and action, suppression rules, the trust score and the penalty ladder. Reply: {"recorded": 1, "action": "kick"}; a kick still arrives through /v1/gs/events after the configured delay.

POST /v1/gs/network

{"session_id", "code", "detail": {…}}. Report network calls your server refused from a player, with Network protection on (Full plan). The netguard package sends these by itself. code is one of:

code Means
unknown_call A message of a type your game never declared
malformed_call A message over its size, or one your validator refused
flood 20 or more messages refused for rate within 2 seconds (both settable)
host_takeover A host-only message from a player who is not the lobby's host

detail is up to 4 KB of JSON. Unsigned, forged and replayed messages are dropped but never reported: on a transport where packets can be spoofed, a third party could send them in another player's name. Reply: {"recorded": 1, "action": "flag"}.

POST /v1/gs/replay

{"session_id", "recording"}. A flagged session's recording, after a replay event, with Session replay on (Full plan). recording is Base64URL of at most 512 KB, in this format, little-endian, then gzip:

"WRP1", u8 frames a second (1 to 30), u8 0, u32 frame count, i64 start (Unix ms)
each frame: u32 ms since the start (never decreasing, at most 10 minutes),
            then head, left hand, right hand, each:
            i32 x, y, z in millimetres (within 1 km), i16 qx, qy, qz, qw times 32767
            (all twenty bytes zero: not tracked)
u16 event count; each: u32 ms since the start, u8 name length, name (a-z 0-9 _, 1 to 32), f32 value

At most 6,000 frames and 1,000 events. Positions and rotations are in the game's own axes. Wyrden takes a recording only for a session it asked about, from that game's servers, once: anything else returns 409; one that does not decode returns 422. Reply: {"stored": true, "frames", "events"}. The library's motion package writes and sends recordings itself.

POST /v1/gs/behavior

{"session_id", "code", "detail": {…}}. A motion limit your server saw a player break, with Behavioral detection on (Full plan): code is head_speed, hand_speed, reach, head_turn or aim_snap, and detail (up to 4 KB) carries the value, the limit and the frames. The motion package sends these. Reply: {"recorded": 1, "action": "flag"}; in dry run the flag is recorded and never enforced.

POST /v1/gs/session/status

{"session_id"}. Whether a session of this game and environment is still live: {"live": true}, or false once it ended, was removed or banned, or never existed.

POST /v1/gs/session/events

{"session_id", "events": [{"name": "coins_gained", "value": 250}]}, 1 to 100 events. Report what a player did, for your Custom rules (Full plan). Send each event for the session of the connection it came from, never for a player named inside a message. Only events a rule reads are kept. Reply: {"kept", "fired": ["coins"]}, the rules that fired.

POST /v1/gs/report

{"reporter_session", "reported_session" or "reported_user_id", "category", "note"}. File a player's report through your server, for example from an in-game menu that your server handles. The same rules and reply as /v1/session/report.

A session of another game or environment returns 404 on every game-server endpoint, the same as a session that does not exist.

Photon endpoints

The Photon add-on's endpoints are called by Photon's servers, with a Photon key (kind photon, bound to one game and environment), in the key parameter or the X-Wyrden-Key header. They answer in Photon's format, with HTTP 200 whenever they could judge the request.

GET or POST /v1/photon/auth?key=…

Photon's custom authentication. The client's values arrive as parameters (ticket, user, mode, added with AddAuthParameter) or as a JSON object (AuthPostData). Answers:

ResultCode When
1 Admitted, with UserId (the Meta user ID) and AuthCookie (ws session, tk sealed traffic key, m mode, tt trust tier, rs restricted, md modded). Also when protection is off or the add-on is not on, with Data {"wyrden": "off"} and nothing else.
2 Refused: no ticket, a ticket not valid for this game, player or mode, expired, a session that has ended, or a ticket used for more than 20 connections. Message says which.
3 Invalid parameters: no key, or not a Photon key, or no user.

POST /v1/photon/webhook/{path}

Photon's room webhooks, any path. A BeforeJoin is refused (ResultCode 2) when the player's session (from the AuthCookie, or from the Photon user ID the gate last admitted) is not live; every other webhook is answered {"ResultCode": 0}.

The session ticket

"w1." + base64url(payload JSON) + "." + base64url(signature)

The signature is Ed25519 over the ASCII bytes of "w1." + base64url(payload). The algorithm is fixed; nothing in the ticket selects it. Base64URL is unpadded.

Payload field Meaning
kid Which public key from /v1/gs/config signed it
sid Session ID
gid, env Game and environment it was issued for
sub `base64url(SHA-256("wyrden-sub-v1
pref Wyrden's reference for the player
mode The game mode the policy was evaluated for
rst true if your policy asked for restricted play
tt Lobby tier, 0 lowest to 3 highest, from the trust score when Cheater-only lobbies is on, for matchmaking
mod true if the player uses a sanctioned mod and you mark them, for modded lobbies. Absent otherwise.
dev true for a development licence
sim true if issued against a simulated Meta verifier: not a real-hardware result
tk The session's traffic key, sealed for your servers: AES-256-GCM under traffic_seal, a 12-byte nonce then the ciphertext and tag, with `"tk
iat, exp Issued and expiry times, Unix seconds

A verifier must: check the signature before trusting any field; refuse an unknown kid (fetch the config once and try again, since keys rotate); refuse an expired ticket, allowing up to 30 seconds of clock difference; refuse a ticket for another game, environment, player or mode; and refuse a ticket it has already admitted.

Management endpoints

Available with a management key on the Full plan, and to the dashboard on every plan. {env} is production or staging; staging is part of the Full plan.

Endpoint Does
GET /v1/games/{game} The game, its licences, its public game key and its plan's features
GET /v1/games/{game}/config/{env} The configuration in force and its version. The document is complete: empty lists and objects are present, not left out.
PUT /v1/games/{game}/config/{env} Save {"doc", "note", "base_version"} as a new version
GET /v1/games/{game}/config/{env}/history Versions, newest first, with author and time
GET /v1/games/{game}/presets/{preset} The document a preset would save, without saving it
POST /v1/games/{game}/config/{env}/preset Replace the configuration with {"preset"}
POST /v1/games/{game}/config/{env}/killswitch Turn {"module"} off everywhere
POST /v1/games/{game}/config/{env}/preview How many players {"doc"} would have affected in the last 7 days
GET /v1/games/{game}/flags The flags feed, newest first. Filters: env, session, user_id, player_ref, module, code, status, since, limit (up to 500). The reply's next is the cursor for the following page; it is empty on the last one.
GET /v1/games/{game}/flags/{flag} One flag
POST /v1/games/{game}/flags/{flag}/review {"status": "open", "false_positive" or "resolved", "severity", "note"}
GET /v1/games/{game}/sessions/{session} One session
GET /v1/games/{game}/builds Uploaded build manifests. Heartbeat values are counted, never returned.
PUT /v1/games/{game}/builds/{build} Upload a build manifest: version (the version code), sdk_version, checks, hb_values
PUT /v1/games/{game}/builds/{build}/files Upload the build's tables after the build: files (up to 48 of {"path", "size", "log2", "hashes", "code"}, hashes as Base64 of 16 bytes a chunk), sdk_bytes, and with Scatter scatter (density, stubs: {"i", "token", "anchor", "where", "variant"}). The build plugin does this.
GET /v1/games/{game}/builds/{build}/scatter Where a build's Scatter checks are (never their tokens)
GET /v1/games/{game}/replay-settings, PUT …/replay-settings Session replay: on, hz (1 to 30), before_s (5 to 120), after_s (0 to 60). Changing them takes a person signed in to the dashboard as an owner or admin; a game played by children cannot turn them on.
GET /v1/games/{game}/replays?player=<ref> Replays, newest first, optionally one player's: session, player, frames, length, size. Moderators.
GET /v1/games/{game}/sessions/{session}/replay One session's replay, decoded: frames as {"t", "h", "l", "r"}, each pose [x, y, z, qx, qy, qz, qw] or null, and events. Moderators.
GET /v1/games/{game}/scatter, PUT …/scatter The game's Scatter settings: enabled, density (light, medium, heavy), kinds (witness, canary, decoy), exclude, assemblies. The build plugin reads them.
PUT /v1/games/{game}/meta-credentials Store {"app_id", "app_secret"}. Write only.
GET /v1/games/{game}/bans, POST …/bans List bans; ban a player or device
POST /v1/games/{game}/bans/{ban}/lift End a ban early
GET /v1/games/{game}/appeals The appeals queue
POST /v1/games/{game}/appeals/{appeal}/decide {"outcome": "upheld" or "overturned", "note"}. The note is shown to the player. Overturning a ban marks the flag behind it a false positive.
GET /v1/games/{game}/enforcement Automatic bans waiting for a moderator (proposed) or for the next ban wave (held), and decided ones
POST /v1/games/{game}/enforcement/wave Apply every held ban now
POST /v1/games/{game}/enforcement/{item}/decide {"outcome": "confirm" or "reject", "note"}. Dashboard only: confirming a permanent ban is a person's decision, and an API key gets 403.
GET /v1/games/{game}/reports Open report cases, one per reported player
GET /v1/games/{game}/reports/{player} The reports about one player, with each reporter's weight when they reported
POST /v1/games/{game}/reports/{player}/decide {"env", "outcome": "upheld" or "dismissed", "note"}. Dismissing lowers every reporter's weight, flags them, and gives back trust points the case took.
GET /v1/games/{game}/players/{player}/trust?env= A player's trust score, its last 30 days, the flags that moved it and their offence counts
GET /v1/games/{game}/scores?env= The protection score and the accuracy score
GET /v1/games/{game}/alerts, POST …/alerts List alert destinations; add one: {"kind": "discord", "slack" or "webhook", "name", "url", "events", "min_action"}
PUT /v1/games/{game}/alerts/{alert}, DELETE … {"enabled", "events", "min_action"}; or delete it
POST /v1/games/{game}/alerts/{alert}/test Send a test alert now: {"delivered", "error"}
GET /v1/games/{game}/device-bans Whether the studio confirmed that Meta approved device bans for the app
PUT /v1/games/{game}/device-bans {"approved", "confirmed"}. Dashboard only, owner or admin.
GET /v1/games/{game}/sdk The game's SDK packages, newest first: id, status (queued, building, done, failed), release, issuer_serial, licences, sha256, size, downloadable. Also per_day and kept_days.
POST /v1/games/{game}/sdk Have a package made: 202 with {"id", "status": "queued"}. One at a time per game (409 busy), 20 a day (429 limit). Needs a registered certificate (409 not_registered).
GET /v1/games/{game}/sdk/{package}/download The package, application/zip, with its SHA-256 in X-Wyrden-SHA256. Files are kept 90 days.
GET /v1/games/{game}/dev-devices Headsets registered for the staging licence, with limit (100) and days (30)
POST /v1/games/{game}/dev-devices {"code", "label"}: register the headset that showed this pairing code, for 30 days. 404 unknown_code if the code is spent or has expired.
DELETE /v1/games/{game}/dev-devices/{device} Remove a registration. The headset is refused within seconds.
POST /v1/games/{game}/keys/rotate {"key": "ticket" or "game"}: replace a key. Owner or admin.

A request for a game that is not yours returns 404, the same as a game that does not exist.

While a game's production licence is suspended or revoked, the game is read-only: every change gets 403 with "error": "licence_cancelled" and a message saying why. Reading still works, and so do deleting a player's data and, in the dashboard, changing the plan. The same applies to the staging configuration while the staging licence is not active.

Roll back by saving an earlier version's doc again. Export and import are the same two calls.

Send the version you read as base_version when you save. If someone else saved in between, the reply is 409 with "error": "version_conflict" and the current version, and nothing is saved. Leave base_version out to save regardless.

A reply of 429 always carries Retry-After, in seconds.

The signing certificates a licence is bound to are changed in the dashboard by an owner or admin. An API key cannot change them.

Creating a ban

{"user_id": "1234567890", "kind": "temp", "hours": 24, "reason": "Modified game files"}

Name the player by user_id (hashed on arrival, never stored), by player_ref, or name a device by device_ref. kind is temp (1 hour to 1 year) or permanent. reason is shown to the player on the appeals page, so write it for them. The reply has the appeal_code. The ban is in force on every node as soon as the call returns, and the player's live sessions are ended.

Alert deliveries

An alert is a POST with a JSON body: {"event", "game_id", "at", "data": {…}}. Discord and Slack get a message in their own format. A webhook delivery carries Wyrden-Event and Wyrden-Signature: t=<unix time>,v1=<hex>, where v1 is HMAC-SHA256 of t, a full stop and the raw body, keyed with the signing secret shown once when you added the destination. Check the signature and refuse a t more than five minutes old. Answer with any 2xx. A failed delivery is tried again for about a day; 20 failures in a row pause the destination. Addresses must be HTTPS on the public internet.

SDK packages

Each package is made for one game. It is a zip file holding:

  • the SDK release, exactly as Wyrden's release key signed it;
  • Wyrden/licence.json, which names the org, the game, the package name, its certificates and its licence IDs;
  • WYRDEN-PACKAGE/: the signed release description, the certificate of the issuing key that signed the package, and the package's manifest with the SHA-256 of every file.

Signatures are OpenSSH signatures (SSHSIG) over Ed25519 keys, so ssh-keygen -Y verify can check them. The build plugin checks all of it before every build: that the release and the issuing key were signed by Wyrden's release key, that the issuing key was valid when the package was made and is not revoked, and that every file matches. A package that fails any check is refused.

GET /v1/sdk/revoked-issuers

{"revoked": ["iss_…"]}: the issuing keys whose packages are refused. Public; the build plugin reads it.

POST /v1/sdk/refused

{"package": "sdk_…", "reason": "…", "plugin": "0.1.0", "unity": "6000.0.85f2"}. The build plugin sends this when it refuses a package, so Wyrden learns that a package was altered or substituted somewhere. It carries no player data and decides nothing. Reply 202.

The configuration reference describes the configuration document.