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.
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.
| Credential | Where it goes | Lifetime and rules |
|---|---|---|
| Login key | POST /api/v1/auth/register, /auth/login | Derived on the device, salted with the server host. Raw passwords are never sent or logged. |
| Access token | Authorization: Bearer, and Hello.access_token on the gateway | Short-lived. Never in a URL, so it stays out of access logs. |
| Refresh token | POST /api/v1/auth/refresh | Single use. Reusing one ends the session (reuse detection), so a refresh always returns a new pair. |
| Session proof | Hello.proof | base64url(HMAC-SHA256(proof_key, "yap/v1/proof\0" + access_token)); a session token without it is refused. Bot tokens ignore it. |
| API key | Authorization: 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 token | Hello.access_token, and REST as a bearer token | Issued by the developer portal, shown once, rotated there. No password exists for a bot account. |
| Device token | POST /auth/login with trust: true | 30 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.
| Method | Path | Auth | Notes |
|---|---|---|---|
POST | /api/v1/auth/register | session | {username, password, proof_key} 201 TokenPair |
POST | /api/v1/auth/login | session | {username, password, proof_key} 200 TokenPair |
POST | /api/v1/auth/refresh | session | {refresh_token, proof} 200 TokenPair (old pair is dead) |
POST | /api/v1/auth/logout | session | {} + Bearer + X-Yap-Proof 204, revokes the session family |
GET | /api/v1/auth/totp | session | {enabled, recovery_left} |
POST | /api/v1/auth/totp/setup | session | {} {secret, uri} |
POST | /api/v1/auth/totp/enable | session | {code} {recovery_codes: [..]} |
POST | /api/v1/auth/totp/disable | session | {code} 204 |
GET | /api/v1/auth/trusted-devices | session | [{id, created_at_ms, expires_at_ms}], newest first, live rows only |
DELETE | /api/v1/auth/trusted-devices/{id} | session | 204 |
DELETE | /api/v1/auth/trusted-devices | session | 204 |
GET | /api/v1/api-keys | session | [{id, name, prefix, created_at_ms, last_used_at_ms, revoked}] |
POST | /api/v1/api-keys | session | {name} (1-32 characters) |
DELETE | /api/v1/api-keys/{id} | session | 204 |
GET | /api/v1/api-keys/usage | session | {total, keys: [{id, name, prefix, requests, last_used_at_ms, revoked}], days: [{day, requests}]} |
GET | /api/v1/klipy | session | 200 {key} |
GET | /api/v1/bots | session | [{id, username, prefix, bio, avatar, created_at_ms, last_used_at_ms, revoked}] |
POST | /api/v1/bots | session | {username} (2-32, the account rules) |
POST | /api/v1/bots/{id}/token | session | 200 {prefix, token} |
DELETE | /api/v1/bots/{id} | session | 204 |
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} | owner | owner only: {bio} (0-256 characters, trimmed, no control characters |
PUT | /api/v1/bots/{id}/avatar`, | owner | owner only: raw PNG body, same rules and {hash} answer as /me/avatar. Costs the owner's upload b… |
DELETE | /api/v1/bots/{id}/avatar`, | owner | owner only: 204 |
PUT | /api/v1/bots/{id}/commands | session | bot token only, and only for itself: {commands: [{name, description}]} |
GET | /api/v1/spaces/{id}/commands | member | members only: [{bot_id, bot_username, bot_name, name, description}] |
POST | /api/v1/spaces/{id}/members | MANAGE_SPACE | {username, permissions?, commands?} adds a bot to a space you can MANAGE_SPACE |
GET | /api/v1/spaces | VIEW_CHANNEL | spaces you belong to, with the channels you can see (VIEW_CHANNEL) |
POST | /api/v1/dms` | session | opens (or reuses) a two-person DM space with a general channel |
POST | /api/v1/spaces/{id}/leave | owner | leaves a space |
POST | /api/v1/spaces` | session | creates the space plus #general |
POST | /api/v1/spaces/{id}/channels` | MANAGE_CHANNELS | needs MANAGE_CHANNELS |
POST | /api/v1/spaces/{id}/categories` | MANAGE_CHANNELS | needs MANAGE_CHANNELS |
PATCH | /api/v1/spaces/{id}` | MANAGE_SPACE | needs MANAGE_SPACE |
PUT | /api/v1/spaces/{id}/icon | MANAGE_SPACE | needs MANAGE_SPACE |
DELETE | /api/v1/spaces/{id}/icon | MANAGE_SPACE | needs MANAGE_SPACE |
PUT | /api/v1/spaces/{id}/banner | MANAGE_SPACE | needs MANAGE_SPACE |
DELETE | /api/v1/spaces/{id}/banner | MANAGE_SPACE | needs MANAGE_SPACE |
PATCH | /api/v1/spaces/{id}/categories` | MANAGE_CHANNELS | needs MANAGE_CHANNELS |
DELETE | /api/v1/spaces/{id}/categories` | MANAGE_CHANNELS | needs MANAGE_CHANNELS |
DELETE | /api/v1/channels/{id} | MANAGE_CHANNELS | needs MANAGE_CHANNELS |
PATCH | /api/v1/channels/{id}` | MANAGE_CHANNELS | needs MANAGE_CHANNELS |
DELETE | /api/v1/spaces/{id} | MANAGE_SPACE | needs MANAGE_SPACE |
POST | /api/v1/spaces/{id}/invites | CREATE_INVITE | needs CREATE_INVITE |
GET | /api/v1/spaces/{id}/invites | MANAGE_SPACE | needs MANAGE_SPACE |
DELETE | /api/v1/spaces/{id}/invites/{code} | MANAGE_SPACE | needs MANAGE_SPACE |
POST | /api/v1/invites/{code} | session | join |
GET | /api/v1/invites/{code} | public | no auth: preview for the website's invite page, {code, vanity, space: {name, encrypted}, members… |
GET | /api/v1/spaces/{id}/vanity | member | members only: {code}, the space's custom invite name, "" if none |
PUT | /api/v1/spaces/{id}/vanity` | MANAGE_SPACE | needs MANAGE_SPACE |
DELETE | /api/v1/spaces/{id}/vanity | MANAGE_SPACE | needs MANAGE_SPACE |
GET | /api/v1/channels/{id}/messages?before=&limit= | session | oldest-first page of up to limit (1-100, default 50) messages with id < before |
PUT | /api/v1/keys` | session | publishes the caller's E2EE public key, 43-character base64url (32 bytes) |
GET | /api/v1/spaces/{id}/keys | member | members only: [{user_id, username, bot, public_key}] |
PUT | /api/v1/e2ee/devices/{device}` | session | publishes or rotates one device's identity key, 32-byte base64url each |
POST | /api/v1/e2ee/devices/{device}/packages` | session | tops up this device's one-time packages |
POST | /api/v1/e2ee/users/{username}/package` | session | claims one package and deletes it, so the delete is the claim and two senders cannot get the sam… |
GET | /api/v1/spaces/{id}/devices | member | members only: [{user_id, username, bot, devices: [{device, identity_key, signature_key, updated_… |
POST | /api/v1/spaces/{id}/e2ee` | session | relays one opaque handshake message (Welcome, Commit, Proposal, sender-key distribution). Needs… |
GET | /api/v1/spaces/{id}/e2ee?after=&limit= | member | members only: handshake messages addressed to the caller's devices or broadcast, oldest first, l… |
GET | /api/v1/spaces/{id}/voice | VIEW_CHANNEL | members only: active voice calls in channels you can VIEW_CHANNEL, as [{channel_id, space_id, me… |
POST | /api/v1/spaces/{id}/voice | session | {channel_id} |
POST | /api/v1/spaces/{id}/voice/state | session | {channel_id, muted, deafened} |
POST | /api/v1/spaces/{id}/scripts | VIEW_CHANNEL | {channel_id, message_id} |
GET | /api/v1/scripts/pending | session | the caller's queued script runs, oldest first, each removed as it is returned. [{id, space_id, c… |
GET | /api/v1/roblox/client | session | the obfuscated Roblox client (YapOverlay.lua, packed by client/roblox/pack.mjs), as text/plain |
GET | /api/v1/roblox/build | session | {"build":"<stamp>"} with Cache-Control: no-store. Public: a running overlay polls it and reloads… |
GET | /api/v1/roblox/scripts?place_id=&q=&page= | session | signed-in people only. Scripts for one Roblox place, proxied from RScripts |
GET | /api/v1/roblox/scripts/{slug} | session | signed-in people only. {id, slug, title, source, risk, game, raw_url}. source is the Lua body, a… |
GET | /api/v1/friends | session | [{id, username, online, activity, place_id}], sorted by username |
POST | /api/v1/friends/{username} | session | 201 {id, username, online, activity, place_id} |
DELETE | /api/v1/friends/{id} | session | 204 |
POST | /api/v1/presence | session | {activity?, place_id?} |
DELETE | /api/v1/presence | session | 204 |
GET | /api/v1/me | session | {id, username, display_name, status, color} |
PATCH | /api/v1/me | session | {display_name?, status?, color?} |
PUT | /api/v1/me/avatar | session | raw PNG or animated GIF body (image/png / image/gif |
PUT | /api/v1/me/banner | session | raw PNG or animated GIF body |
DELETE | /api/v1/me/avatar`, | session | 204 |
GET | /api/v1/users/{id}/avatar?v={hash}`, | session | image/png or image/gif, or 404 |
POST | /api/v1/channels/{id}/messages | VIEW_CHANNEL \ SEND_MESSAGES | {content, attachment?, reply_to?} |
GET | /api/v1/channels/{id}/messages?before=&after=&limit= | session | unchanged |
GET | /api/v1/channels/{id}/messages/search?q=&limit= | VIEW_CHANNEL | newest first |
PATCH | /api/v1/messages/{id} | session | {content} |
DELETE | /api/v1/messages/{id} | author / MANAGE_MESSAGES | 204 |
PUT | /api/v1/messages/{id}/reactions/{emoji} | VIEW_CHANNEL | idempotent |
DELETE | /api/v1/messages/{id}/reactions/{emoji} | session | removes this user's reaction |
GET | /api/v1/channels/{id}/pins | VIEW_CHANNEL | up to 50 pinned messages, newest pin first |
PUT | /api/v1/channels/{id}/pins/{message} | MANAGE_MESSAGES | pin |
DELETE | /api/v1/channels/{id}/pins/{message} | MANAGE_MESSAGES | unpin |
POST | /api/v1/channels/{id}/attachments | VIEW_CHANNEL \ SEND_MESSAGES | raw PNG or animated GIF body |
GET | /api/v1/attachments/{id} | session | image/png or image/gif |
POST | /api/v1/channels/{id}/files?name={name} | VIEW_CHANNEL \ SEND_MESSAGES | raw bytes |
POST | /api/v1/channels/{id}/previews | VIEW_CHANNEL | {url} |
GET | /api/v1/spaces/{id}/roles | session | any member |
POST | /api/v1/spaces/{id}/roles | MANAGE_ROLES | MANAGE_ROLES |
PATCH | /api/v1/roles/{id} | MANAGE_ROLES | MANAGE_ROLES |
DELETE | /api/v1/roles/{id} | MANAGE_ROLES | MANAGE_ROLES |
GET | /api/v1/spaces/{id}/members | session | any member |
PUT | /api/v1/spaces/{id}/members/{user}/roles | MANAGE_ROLES | MANAGE_ROLES |
GET | /api/v1/spaces/{id}/overwrites | session | any member |
PUT | /api/v1/spaces/{id}/overwrites | MANAGE_ROLES | MANAGE_ROLES |
DELETE | /api/v1/spaces/{id}/overwrites | MANAGE_ROLES | MANAGE_ROLES |
DELETE | /api/v1/spaces/{id}/members/{user} | KICK | KICK |
GET | /api/v1/spaces/{id}/bans | BAN | BAN |
PUT | /api/v1/spaces/{id}/bans/{user} | BAN | BAN |
DELETE | /api/v1/spaces/{id}/bans/{user} | BAN | BAN |
GET | /api/v1/spaces/{id}/audit-log?before=&limit=&action= | MANAGE_SPACE | MANAGE_SPACE |
POST | /api/v1/channels/{id}/webhooks | MANAGE_CHANNELS | MANAGE_CHANNELS |
GET | /api/v1/channels/{id}/webhooks | MANAGE_CHANNELS | MANAGE_CHANNELS |
GET | /api/v1/spaces/{id}/webhooks | MANAGE_SPACE | MANAGE_SPACE |
PATCH | /api/v1/webhooks/{id} | MANAGE_CHANNELS | MANAGE_CHANNELS |
DELETE | /api/v1/webhooks/{id} | MANAGE_CHANNELS | MANAGE_CHANNELS |
GET | /api/v1/webhooks/{id}/{token} | public | no auth |
POST | /api/v1/webhooks/{id}/{token} | public | no auth |
POST | /api/v1/channels/{id}/threads | session | VIEW_CHANNEL \ SEND_MESSAGES on the parent text channel |
GET | /api/v1/channels/{id}/threads?archived=&before=&limit= | session | threads of a text channel, newest first |
GET | /api/v1/threads/{id} | session | one thread. |
PATCH | /api/v1/threads/{id} | MANAGE_CHANNELS | MANAGE_CHANNELS |
DELETE | /api/v1/threads/{id} | MANAGE_CHANNELS | MANAGE_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.
| Op | Message | Direction | What it carries |
|---|---|---|---|
| 10 | Hello | client → server | access_token, protocol_version (1), proof |
| 11 | SendMessage | client → server | channel_id, nonce, content, attachment_id, reply_to |
| 12 | Ping | client → server | client_time_ms; send at least every heartbeat_ms |
| 13 | VoiceJoin | client → server | channel_id; leaves any other call first |
| 14 | VoiceLeave | client → server | empty |
| 15 | VoiceUpdate | client → server | muted, deafened, speaking |
| 16 | VoiceSignal | both ways | to_user_id / from_user_id, kind (offer, answer, candidate), payload |
| 20 | Ready | server → client | user, spaces, heartbeat_ms, voice |
| 21 | MessageCreate | server → client | message, nonce on the sender's own copy |
| 22 | ChannelCreate | server → client | channel |
| 23 | Pong | server → client | echoed client_time_ms |
| 24 | Error | server → client | code, message, nonce |
| 25 | VoiceJoined | server → client | channel_id, ice_servers, relay_only, members |
| 26 | VoiceState | server → client | the full member list of one voice channel |
| 27 | SpaceDelete | server → client | space_id |
| 28 | ChannelDelete | server → client | channel_id, space_id |
| 29 | SpaceUpdate | server → client | the full space profile |
| 30 | ChannelUpdate | server → client | channel_id, name, optional category |
| 31 | MessageUpdate | server → client | the edited message |
| 32 | MessageDelete | server → client | message_id, channel_id |
| 33 | ReactionUpdate | server → client | message_id, emoji, count, added |
| 34 | Typing | both ways | ephemeral, never stored; throttle to about one per 3 s |
| 35 | MemberJoin | server → client | space_id, member; never sent for a DM |
| 36 | VoiceJoinRequest | server → client | asks the account's desktop to join, for REST-only clients |
| 37 | VoiceControl | server → client | mute/deafen hand-off, same path as 36 |
| 38 | SetActivity | client → server | the activity line this connection publishes; ephemeral |
| 50 | ProfileUpdate | server → client | a 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.
| Thing | Limit |
|---|---|
| Gateway frame | 64 KiB. Text frames, unknown client ops and malformed frames get Error{BAD_FRAME} and a close. |
| Message body | 4,000 characters; no control characters except newline and tab. |
| Message rate | 5 per second per user, burst 10. |
| Outbound queue | 256 frames. Past that the connection is closed and the client must refetch history. |
| Heartbeat | Ping at least every heartbeat_ms; the server closes after 2.5× that silence. |
| Hello | Within 10 seconds of connecting. |
| Frame sequence | Server frames carry seq from 1. There is no resume: on reconnect, refetch what is on screen. |
| History | limit 1–100, default 50, oldest first. before and after are message ids. |
| Search | q 1–100 characters, limit 1–100 (default 50), newest first, plaintext spaces only. |
| E2EE envelope | yap1: prefix plus a base64url body of at least 200 characters, 16 KiB cap. Plaintext in an encrypted space is refused. |
| E2EE handshake page | limit 1–200, default 100, oldest first; rows older than 7 days are dropped as new ones arrive. |
| Voice | 8 people per channel, full mesh. VoiceSignal payload 16 KiB. |
| Uploads | Up to 3 MB; rate limited to 5, then one a minute. |
| Sign-up | Two accounts per IP address (--max-accounts-per-ip, 0 lifts it). The address is never stored. |
| Roles | @everyone plus 99 more per space. |
| Names | Space 1–64 characters, description up to 190, category label 1–24, vanity invite 3–32 of a-z 0-9 -. |
| Invites | An ordinary invite code is valid 7 days; a vanity name never expires until it is removed. |
| API keys and devices | 10 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.
| Status | Means |
|---|---|
| 400 | Malformed body, a value out of range, or a request the protocol forbids. |
| 401 | Missing, expired or revoked credential. totp_required and totp_invalid arrive as 401 too. |
| 403 | Authenticated but not allowed: a missing permission bit, or an account-level action attempted by a bot. |
| 404 | Unknown id or name, or something the caller may not see (an outsider gets 404 for a space icon, not 403). |
| 409 | A conflict: name taken, already a member, two accounts from one address. |
| 429 | Rate limited. Invite previews are per address, uploads and messages per account. |
| 500 | Something 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.
| Bit | Permission | Gates |
|---|---|---|
| 1 | VIEW_CHANNEL | Reading a channel, its history and search results |
| 2 | SEND_MESSAGES | Posting, editing your own message, reacting |
| 4 | CREATE_INVITE | POST /spaces/{id}/invites |
| 8 | MANAGE_CHANNELS | Channels and categories: create, rename, move, delete |
| 16 | MANAGE_ROLES | Roles and their overwrites |
| 32 | MANAGE_SPACE | The space profile, its icon and banner, invites list, audit log, deletion |
| 64 | CONNECT | Joining a voice channel |
| 128 | SPEAK | Carried for clients; not enforced, because voice audio never reaches the server |
| 256 | MANAGE_MESSAGES | Deleting anyone's message, pins |
| 512 | KICK | Removing a member |
| 1024 | BAN | Banning 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.