/ cheatsheet ← all documentation

Protocol cheatsheet

Everything you need while writing a client, on one page: auth, every REST path with the permission it needs, the gateway op numbers, the limits that actually reject a request, and the error shapes. Protocol v1 explains the same things at length; docs/protocol.md is normative when the two disagree.

Printing: this page has a print stylesheet — headers, footers and search drop out, and the tables break between rows instead of through them. Print to A4 or Letter and it is two or three pages.

Auth and credentials

A password never reaches the server. The client derives a login key with Argon2id and sends that; the server stores only a verifier over it. Tokens are opaque and stored hashed.

CredentialWhere it goesLifetime and rules
Login keyPOST /api/v1/auth/register, /auth/loginDerived on the device, salted with the server host. Raw passwords are never sent or logged.
Access tokenAuthorization: Bearer, and Hello.access_token on the gatewayShort-lived. Never in a URL, so it stays out of access logs.
Refresh tokenPOST /api/v1/auth/refreshSingle use. Reusing one ends the session (reuse detection), so a refresh always returns a new pair.
Session proofHello.proofbase64url(HMAC-SHA256(proof_key, "yap/v1/proof\0" + access_token)); a session token without it is refused. Bot tokens ignore it.
API keyAuthorization: Bearer yap_...47 characters, shown once, SHA-256 stored, no expiry. REST only: it cannot open a gateway or log a session out. At most 10 active per account.
Bot tokenHello.access_token, and REST as a bearer tokenIssued by the developer portal, shown once, rotated there. No password exists for a bot account.
Device tokenPOST /auth/login with trust: true30 days, at most 10 per account, only a SHA-256 stored. Not a credential alone: a sign-in still needs the login key.

Two-factor is only revealed after the login key verifies, so a wrong password and a 2FA prompt cannot be told apart by a stranger. Recovery codes are single use and stored hashed. There is no email or phone reset by design.

REST paths

All paths are under /api/v1 and answer JSON. Auth is the column that decides a refusal: session means any access token or API key, member means the caller must be in that space, and a permission name means that bit on the member's role union (owners and both DM members bypass). Generated from docs/protocol.md by _tools/gen.py; the notes are the first clause of each row there.

MethodPathAuthNotes
POST/api/v1/auth/registersession{username, password, proof_key} 201 TokenPair
POST/api/v1/auth/loginsession{username, password, proof_key} 200 TokenPair
POST/api/v1/auth/refreshsession{refresh_token, proof} 200 TokenPair (old pair is dead)
POST/api/v1/auth/logoutsession{} + Bearer + X-Yap-Proof 204, revokes the session family
GET/api/v1/auth/totpsession{enabled, recovery_left}
POST/api/v1/auth/totp/setupsession{} {secret, uri}
POST/api/v1/auth/totp/enablesession{code} {recovery_codes: [..]}
POST/api/v1/auth/totp/disablesession{code} 204
GET/api/v1/auth/trusted-devicessession[{id, created_at_ms, expires_at_ms}], newest first, live rows only
DELETE/api/v1/auth/trusted-devices/{id}session204
DELETE/api/v1/auth/trusted-devicessession204
GET/api/v1/api-keyssession[{id, name, prefix, created_at_ms, last_used_at_ms, revoked}]
POST/api/v1/api-keyssession{name} (1-32 characters)
DELETE/api/v1/api-keys/{id}session204
GET/api/v1/api-keys/usagesession{total, keys: [{id, name, prefix, requests, last_used_at_ms, revoked}], days: [{day, requests}]}
GET/api/v1/klipysession200 {key}
GET/api/v1/botssession[{id, username, prefix, bio, avatar, created_at_ms, last_used_at_ms, revoked}]
POST/api/v1/botssession{username} (2-32, the account rules)
POST/api/v1/bots/{id}/tokensession200 {prefix, token}
DELETE/api/v1/bots/{id}session204
GET/api/v1/bots/{id}session{id, username, bio, avatar, banner, created_at_ms} for any live bot, to any signed-in person
PATCH/api/v1/bots/{id}ownerowner only: {bio} (0-256 characters, trimmed, no control characters
PUT/api/v1/bots/{id}/avatar`,ownerowner only: raw PNG body, same rules and {hash} answer as /me/avatar. Costs the owner's upload b…
DELETE/api/v1/bots/{id}/avatar`,ownerowner only: 204
PUT/api/v1/bots/{id}/commandssessionbot token only, and only for itself: {commands: [{name, description}]}
GET/api/v1/spaces/{id}/commandsmembermembers only: [{bot_id, bot_username, bot_name, name, description}]
POST/api/v1/spaces/{id}/membersMANAGE_SPACE{username, permissions?, commands?} adds a bot to a space you can MANAGE_SPACE
GET/api/v1/spacesVIEW_CHANNELspaces you belong to, with the channels you can see (VIEW_CHANNEL)
POST/api/v1/dms`sessionopens (or reuses) a two-person DM space with a general channel
POST/api/v1/spaces/{id}/leaveownerleaves a space
POST/api/v1/spaces`sessioncreates the space plus #general
POST/api/v1/spaces/{id}/channels`MANAGE_CHANNELSneeds MANAGE_CHANNELS
POST/api/v1/spaces/{id}/categories`MANAGE_CHANNELSneeds MANAGE_CHANNELS
PATCH/api/v1/spaces/{id}`MANAGE_SPACEneeds MANAGE_SPACE
PUT/api/v1/spaces/{id}/iconMANAGE_SPACEneeds MANAGE_SPACE
DELETE/api/v1/spaces/{id}/iconMANAGE_SPACEneeds MANAGE_SPACE
PUT/api/v1/spaces/{id}/bannerMANAGE_SPACEneeds MANAGE_SPACE
DELETE/api/v1/spaces/{id}/bannerMANAGE_SPACEneeds MANAGE_SPACE
PATCH/api/v1/spaces/{id}/categories`MANAGE_CHANNELSneeds MANAGE_CHANNELS
DELETE/api/v1/spaces/{id}/categories`MANAGE_CHANNELSneeds MANAGE_CHANNELS
DELETE/api/v1/channels/{id}MANAGE_CHANNELSneeds MANAGE_CHANNELS
PATCH/api/v1/channels/{id}`MANAGE_CHANNELSneeds MANAGE_CHANNELS
DELETE/api/v1/spaces/{id}MANAGE_SPACEneeds MANAGE_SPACE
POST/api/v1/spaces/{id}/invitesCREATE_INVITEneeds CREATE_INVITE
GET/api/v1/spaces/{id}/invitesMANAGE_SPACEneeds MANAGE_SPACE
DELETE/api/v1/spaces/{id}/invites/{code}MANAGE_SPACEneeds MANAGE_SPACE
POST/api/v1/invites/{code}sessionjoin
GET/api/v1/invites/{code}publicno auth: preview for the website's invite page, {code, vanity, space: {name, encrypted}, members…
GET/api/v1/spaces/{id}/vanitymembermembers only: {code}, the space's custom invite name, "" if none
PUT/api/v1/spaces/{id}/vanity`MANAGE_SPACEneeds MANAGE_SPACE
DELETE/api/v1/spaces/{id}/vanityMANAGE_SPACEneeds MANAGE_SPACE
GET/api/v1/channels/{id}/messages?before=&limit=sessionoldest-first page of up to limit (1-100, default 50) messages with id < before
PUT/api/v1/keys`sessionpublishes the caller's E2EE public key, 43-character base64url (32 bytes)
GET/api/v1/spaces/{id}/keysmembermembers only: [{user_id, username, bot, public_key}]
PUT/api/v1/e2ee/devices/{device}`sessionpublishes or rotates one device's identity key, 32-byte base64url each
POST/api/v1/e2ee/devices/{device}/packages`sessiontops up this device's one-time packages
POST/api/v1/e2ee/users/{username}/package`sessionclaims one package and deletes it, so the delete is the claim and two senders cannot get the sam…
GET/api/v1/spaces/{id}/devicesmembermembers only: [{user_id, username, bot, devices: [{device, identity_key, signature_key, updated_…
POST/api/v1/spaces/{id}/e2ee`sessionrelays one opaque handshake message (Welcome, Commit, Proposal, sender-key distribution). Needs…
GET/api/v1/spaces/{id}/e2ee?after=&limit=membermembers only: handshake messages addressed to the caller's devices or broadcast, oldest first, l…
GET/api/v1/spaces/{id}/voiceVIEW_CHANNELmembers only: active voice calls in channels you can VIEW_CHANNEL, as [{channel_id, space_id, me…
POST/api/v1/spaces/{id}/voicesession{channel_id}
POST/api/v1/spaces/{id}/voice/statesession{channel_id, muted, deafened}
POST/api/v1/spaces/{id}/scriptsVIEW_CHANNEL{channel_id, message_id}
GET/api/v1/scripts/pendingsessionthe caller's queued script runs, oldest first, each removed as it is returned. [{id, space_id, c…
GET/api/v1/roblox/clientsessionthe obfuscated Roblox client (YapOverlay.lua, packed by client/roblox/pack.mjs), as text/plain
GET/api/v1/roblox/buildsession{"build":"<stamp>"} with Cache-Control: no-store. Public: a running overlay polls it and reloads…
GET/api/v1/roblox/scripts?place_id=&q=&page=sessionsigned-in people only. Scripts for one Roblox place, proxied from RScripts
GET/api/v1/roblox/scripts/{slug}sessionsigned-in people only. {id, slug, title, source, risk, game, raw_url}. source is the Lua body, a…
GET/api/v1/friendssession[{id, username, online, activity, place_id}], sorted by username
POST/api/v1/friends/{username}session201 {id, username, online, activity, place_id}
DELETE/api/v1/friends/{id}session204
POST/api/v1/presencesession{activity?, place_id?}
DELETE/api/v1/presencesession204
GET/api/v1/mesession{id, username, display_name, status, color}
PATCH/api/v1/mesession{display_name?, status?, color?}
PUT/api/v1/me/avatarsessionraw PNG or animated GIF body (image/png / image/gif
PUT/api/v1/me/bannersessionraw PNG or animated GIF body
DELETE/api/v1/me/avatar`,session204
GET/api/v1/users/{id}/avatar?v={hash}`,sessionimage/png or image/gif, or 404
POST/api/v1/channels/{id}/messagesVIEW_CHANNEL \ SEND_MESSAGES{content, attachment?, reply_to?}
GET/api/v1/channels/{id}/messages?before=&after=&limit=sessionunchanged
GET/api/v1/channels/{id}/messages/search?q=&limit=VIEW_CHANNELnewest first
PATCH/api/v1/messages/{id}session{content}
DELETE/api/v1/messages/{id}author / MANAGE_MESSAGES204
PUT/api/v1/messages/{id}/reactions/{emoji}VIEW_CHANNELidempotent
DELETE/api/v1/messages/{id}/reactions/{emoji}sessionremoves this user's reaction
GET/api/v1/channels/{id}/pinsVIEW_CHANNELup to 50 pinned messages, newest pin first
PUT/api/v1/channels/{id}/pins/{message}MANAGE_MESSAGESpin
DELETE/api/v1/channels/{id}/pins/{message}MANAGE_MESSAGESunpin
POST/api/v1/channels/{id}/attachmentsVIEW_CHANNEL \ SEND_MESSAGESraw PNG or animated GIF body
GET/api/v1/attachments/{id}sessionimage/png or image/gif
POST/api/v1/channels/{id}/files?name={name}VIEW_CHANNEL \ SEND_MESSAGESraw bytes
POST/api/v1/channels/{id}/previewsVIEW_CHANNEL{url}
GET/api/v1/spaces/{id}/rolessessionany member
POST/api/v1/spaces/{id}/rolesMANAGE_ROLESMANAGE_ROLES
PATCH/api/v1/roles/{id}MANAGE_ROLESMANAGE_ROLES
DELETE/api/v1/roles/{id}MANAGE_ROLESMANAGE_ROLES
GET/api/v1/spaces/{id}/memberssessionany member
PUT/api/v1/spaces/{id}/members/{user}/rolesMANAGE_ROLESMANAGE_ROLES
GET/api/v1/spaces/{id}/overwritessessionany member
PUT/api/v1/spaces/{id}/overwritesMANAGE_ROLESMANAGE_ROLES
DELETE/api/v1/spaces/{id}/overwritesMANAGE_ROLESMANAGE_ROLES
DELETE/api/v1/spaces/{id}/members/{user}KICKKICK
GET/api/v1/spaces/{id}/bansBANBAN
PUT/api/v1/spaces/{id}/bans/{user}BANBAN
DELETE/api/v1/spaces/{id}/bans/{user}BANBAN
GET/api/v1/spaces/{id}/audit-log?before=&limit=&action=MANAGE_SPACEMANAGE_SPACE
POST/api/v1/channels/{id}/webhooksMANAGE_CHANNELSMANAGE_CHANNELS
GET/api/v1/channels/{id}/webhooksMANAGE_CHANNELSMANAGE_CHANNELS
GET/api/v1/spaces/{id}/webhooksMANAGE_SPACEMANAGE_SPACE
PATCH/api/v1/webhooks/{id}MANAGE_CHANNELSMANAGE_CHANNELS
DELETE/api/v1/webhooks/{id}MANAGE_CHANNELSMANAGE_CHANNELS
GET/api/v1/webhooks/{id}/{token}publicno auth
POST/api/v1/webhooks/{id}/{token}publicno auth
POST/api/v1/channels/{id}/threadssessionVIEW_CHANNEL \ SEND_MESSAGES on the parent text channel
GET/api/v1/channels/{id}/threads?archived=&before=&limit=sessionthreads of a text channel, newest first
GET/api/v1/threads/{id}sessionone thread.
PATCH/api/v1/threads/{id}MANAGE_CHANNELSMANAGE_CHANNELS
DELETE/api/v1/threads/{id}MANAGE_CHANNELSMANAGE_CHANNELS

Gateway ops

One WebSocket at /gateway, one binary frame per message, Frame{seq, oneof op}. Op numbers are append-only. The first frame from a client is Hello, within 10 seconds.

OpMessageDirectionWhat it carries
10Helloclient → serveraccess_token, protocol_version (1), proof
11SendMessageclient → serverchannel_id, nonce, content, attachment_id, reply_to
12Pingclient → serverclient_time_ms; send at least every heartbeat_ms
13VoiceJoinclient → serverchannel_id; leaves any other call first
14VoiceLeaveclient → serverempty
15VoiceUpdateclient → servermuted, deafened, speaking
16VoiceSignalboth waysto_user_id / from_user_id, kind (offer, answer, candidate), payload
20Readyserver → clientuser, spaces, heartbeat_ms, voice
21MessageCreateserver → clientmessage, nonce on the sender's own copy
22ChannelCreateserver → clientchannel
23Pongserver → clientechoed client_time_ms
24Errorserver → clientcode, message, nonce
25VoiceJoinedserver → clientchannel_id, ice_servers, relay_only, members
26VoiceStateserver → clientthe full member list of one voice channel
27SpaceDeleteserver → clientspace_id
28ChannelDeleteserver → clientchannel_id, space_id
29SpaceUpdateserver → clientthe full space profile
30ChannelUpdateserver → clientchannel_id, name, optional category
31MessageUpdateserver → clientthe edited message
32MessageDeleteserver → clientmessage_id, channel_id
33ReactionUpdateserver → clientmessage_id, emoji, count, added
34Typingboth waysephemeral, never stored; throttle to about one per 3 s
35MemberJoinserver → clientspace_id, member; never sent for a DM
36VoiceJoinRequestserver → clientasks the account's desktop to join, for REST-only clients
37VoiceControlserver → clientmute/deafen hand-off, same path as 36
38SetActivityclient → serverthe activity line this connection publishes; ephemeral
50ProfileUpdateserver → clienta profile picture, banner, name, status or colour changed

Limits

These are the numbers that reject a request. Both backends enforce the same ones; see Protocol v1 for the surrounding rules.

ThingLimit
Gateway frame64 KiB. Text frames, unknown client ops and malformed frames get Error{BAD_FRAME} and a close.
Message body4,000 characters; no control characters except newline and tab.
Message rate5 per second per user, burst 10.
Outbound queue256 frames. Past that the connection is closed and the client must refetch history.
HeartbeatPing at least every heartbeat_ms; the server closes after 2.5× that silence.
HelloWithin 10 seconds of connecting.
Frame sequenceServer frames carry seq from 1. There is no resume: on reconnect, refetch what is on screen.
Historylimit 1–100, default 50, oldest first. before and after are message ids.
Searchq 1–100 characters, limit 1–100 (default 50), newest first, plaintext spaces only.
E2EE envelopeyap1: prefix plus a base64url body of at least 200 characters, 16 KiB cap. Plaintext in an encrypted space is refused.
E2EE handshake pagelimit 1–200, default 100, oldest first; rows older than 7 days are dropped as new ones arrive.
Voice8 people per channel, full mesh. VoiceSignal payload 16 KiB.
UploadsUp to 3 MB; rate limited to 5, then one a minute.
Sign-upTwo accounts per IP address (--max-accounts-per-ip, 0 lifts it). The address is never stored.
Roles@everyone plus 99 more per space.
NamesSpace 1–64 characters, description up to 190, category label 1–24, vanity invite 3–32 of a-z 0-9 -.
InvitesAn ordinary invite code is valid 7 days; a vanity name never expires until it is removed.
API keys and devices10 active API keys per account; 10 trusted devices, 30 days each.

Errors

REST errors are {"error": "...", "message": "..."}. error is a stable machine token, message is shown to people as-is, so it has to be safe and specific.

StatusMeans
400Malformed body, a value out of range, or a request the protocol forbids.
401Missing, expired or revoked credential. totp_required and totp_invalid arrive as 401 too.
403Authenticated but not allowed: a missing permission bit, or an account-level action attempted by a bot.
404Unknown id or name, or something the caller may not see (an outsider gets 404 for a space icon, not 403).
409A conflict: name taken, already a member, two accounts from one address.
429Rate limited. Invite previews are per address, uploads and messages per account.
500Something broke server-side. The message stays generic on purpose.

On the gateway the same situations arrive as Error with a code: 1 bad frame, 2 unauthorized, 3 forbidden, 4 rate limited, 5 invalid, 6 not found, 7 internal. unauthorized is terminal: the client stops reconnecting and asks for a sign-in.

Permission bits

A member's base is the union of @everyone and their roles. Overwrites are applied @everyone, then each of the member's roles, then the member — category first, then channel.

BitPermissionGates
1VIEW_CHANNELReading a channel, its history and search results
2SEND_MESSAGESPosting, editing your own message, reacting
4CREATE_INVITEPOST /spaces/{id}/invites
8MANAGE_CHANNELSChannels and categories: create, rename, move, delete
16MANAGE_ROLESRoles and their overwrites
32MANAGE_SPACEThe space profile, its icon and banner, invites list, audit log, deletion
64CONNECTJoining a voice channel
128SPEAKCarried for clients; not enforced, because voice audio never reaches the server
256MANAGE_MESSAGESDeleting anyone's message, pins
512KICKRemoving a member
1024BANBanning an account from the space

A fresh @everyone grants VIEW_CHANNEL | SEND_MESSAGES | CREATE_INVITE | CONNECT | SPEAK (199). GET /spaces returns the caller's own permissions bits so a client can gate its UI without guessing.

Updated . Part of the documentation index.