Status Draft. Protocol version 1 (sv1) of Sloppy Voice v2
Date 2026-12-04
Depends on 00 (overview and conventions), 03 (transport), 04 (crypto conventions), 09 (communities and channels), 14 (sealed messages and history)
Decisions used D-005, D-007, D-009, D-011, D-018, D-021, D-022, D-023, D-026, D-028, D-031, D-032, D-038, D-040, D-048, D-049, D-050, D-051, D-054, D-055, D-056, D-057, D-058, D-061, D-063, D-065, D-069
Owns Content object schema (MessageContent, EditContent, ReactionContent, DeleteContent, ReplyRef, AttachmentRef, ThumbnailRef); the PostEntry carrier; the Entry, Message, SystemItem, ReactionEntry and Tombstone objects; mention hints; the endpoints /v1/contexts/{ctx}/messages…, …/reactions…, …/read, …/typing, …/attachments…, …/webhooks…, /v1/me/presence and /v1/me/read-states; the Attachment, ReadState, Presence and Webhook objects; retention enforcement; the client outbox; the limits maxMessageBytes and maxAttachmentBytes; the feature webhooks; events and error codes in the areas message, reaction, typing, read, presence and attachment; the AccountVault settings mention_hints and typing_indicators

1. Scope

This document specifies everything a context's timeline holds and everything around it:

  • the content object schema that both security modes share: text and its formatting subset, mentions, reply references, attachment references with their file keys, and the edit, delete and reaction operations (§3);
  • the carriers that move content to the hosting server: the content member in insecure contexts and the sealed member (a SealedMessage, 14) in secure contexts, plus the cleartext mention hint of D-063 (§4);
  • the Message object and the other timeline objects, with sequencing, edits, deletes, tombstones, replies, reactions and mentions (§5, §6);
  • the timeline API under /v1/contexts/{ctx}/messages…: paging by seq, sync after reconnect, gap fill and history visibility by membership state and upgradeSeq (§7), and the events it emits (§8);
  • read state (§9), typing (§10) and presence (§11);
  • retention enforcement (§12);
  • the client outbox for queued sends (§13);
  • attachments: upload, download, client-side encryption in secure contexts, padding, encrypted thumbnails and limits (§14);
  • webhooks, an optional feature for insecure channels only (§15);
  • the notification triggers the hosting server hands to 19 (§16), and the error codes of this document's areas (§17).

It does not define:

  • the SealedMessage format, its key derivation, signature and server ingress checks, visibleFromSeq, or manual history sharing (HistoryShare, VisibilityGrant) (14);
  • MLS mechanics, including the content freeze and mls.commit_required (13);
  • how DMs and group DMs are created, hosted and accepted, including dm.request (12);
  • notification delivery, notification records and push (19);
  • moderation actions, including moderator deletion, timeouts and the permission registry (10);
  • the channel object and its settings, including the retentionDays setting and the upgrade procedure (09);
  • the envelope, subscriptions, resume and the session.* messages (03);
  • the attachment encryption construction (SVF1) and its padding buckets (04 §10);
  • the padding of SealedMessage plaintexts (14 §4.5);
  • who may read which seq of a context: visibility ranges (09 §7.2), joinedSeq (12 §12.5), visibleFromSeq and VisibilityGrants (14). This document applies them (§7.5).

1.1 Conformance

This document is normative for the Server class (hosting-server role) and for the Full client, Web client and Bot client classes (00 §1.5). Its client-side outbox (§13) and rendering rules (§3.3, §3.9) are normative for every client class that sends or displays messages. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY" and "OPTIONAL" are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals. Grammars use ABNF (RFC 5234) with the core rules of its Appendix B. Examples are informative unless the text says otherwise. Notes starting with "Rationale:" are informative.

Where this document needs a decision that isn't in spec/DECISIONS.md, it states it inline as a Proposed decision: block.

2. Terminology and constants

2.1 Terms

This document uses the terms of 00 §2 exactly. It adds these:

Term Definition
Entry One accepted write to a context's timeline. Every entry has its own client-generated mid, a kind (message, edit, reaction or delete) and its own seq.
Root message An entry of kind message. It is what users see as "a message".
Target The mid of the entry that an edit, reaction or delete entry acts on.
Carrier The request body that posts an entry: either an insecure carrier (holding content) or a secure carrier (holding sealed). The carrier type of a stored entry is plain or sealed, after the carrier it was posted with.
Content object The JSON object that holds an entry's meaning. It is sent as content in an insecure carrier, and it is the plaintext of the SealedMessage (before 14's padding) in a secure carrier.
Mention hint The cleartext mentions and mentionAll members of a secure carrier (D-063).
Tombstone What remains of a deleted root message: its mid, seq, sender and times, without content.
Visible An event or timeline item that a given account may read in a given context, as §7.5 decides.
System item A timeline item (03 §11.2) defined by another document, such as a membership line, a timeline marker (K1 to K8) or 14's history.shared. Timeline pages list it next to messages (§7.1).
Outbox The client's persistent queue of entries that it has created but the hosting server hasn't yet acknowledged (§13).
Blob The bytes of one uploaded attachment as the hosting server stores them: the file itself in an insecure context, and its SVF1 ciphertext (04 §10) in a secure context.

2.2 Protocol constants

These values are fixed for protocol version 1. They aren't advertised and servers MUST NOT change them, so clients can rely on them.

Constant Value Section
MAX_TEXT_CHARS 4,000 Unicode scalar values in text §3.2
MAX_MENTIONS 50 addresses in mentions (content and hint); the AntiSpamPolicy mentionLimit (10 §12.2) may set a lower limit on distinct addresses §3.4, §4.4
MAX_ATTACHMENTS 10 AttachmentRefs per content object §3.6
MAX_FILENAME_BYTES 255 bytes of UTF-8 §3.6
MAX_REACTION_KEY_BYTES 64 bytes of UTF-8 §3.7
MAX_REACTIONS_PER_USER 20 reaction entries per account per root message §6.5
MAX_REACTION_KEYS 20 distinct reaction keys per root message, among its plain reactions §6.5
INLINE_REACTION_ENTRIES 100 sealed ReactionEntries inlined in a Message object §5.2
PAD_BLOCK 256 bytes (the secure plaintext padding block of 14 §4.5) §3.8
TYPING_TTL 8 s (server), 10 s (client display) §10
TYPING_REFRESH 6 s §10
IDLE_AFTER 10 min without user input §11
OFFLINE_GRACE 30 s after a session's last WebSocket closes §11
MAX_STATUS_CHARS 128 Unicode scalar values §11
PRESENCE_SNAPSHOT_MAX 1,000 entries §11.5
UPLOAD_PENDING_TTL 24 h from upload creation until it must be bound to an entry §14.5
UPLOAD_URL_TTL at most 10 min (03 §3.2 item 1) §14.2
DOWNLOAD_URL_TTL at most 10 min §14.4
THUMB_MAX_PX 512 px on the longer side §14.3
THUMB_MAX_BYTES 256 KiB (thumbnail file before encryption) §14.3
TOMBSTONE_MIN 30 days §5.4
MID_MEMORY_MIN 30 days §4.6
CHANGES_HORIZON_MIN 30 days §7.4
RETENTION_PURGE_MAX 24 h after expiry §12
OUTBOX_MAX_AGE 7 days §13
MAX_WEBHOOKS_PER_CHANNEL 15 §15

2.3 Limits advertised in ServerMetadata

This document owns two size limits (00 §7.12). A server advertises them in ServerMetadata limits (02).

Limit Meaning Default Floor
maxMessageBytes Size of one content object, measured as in §3.8: the JCS serialization of content in an insecure carrier, or the content JSON before padding in a secure carrier (14 §4.5). 16,384 (16 KiB) 8,192 (8 KiB)
maxAttachmentBytes Size of one attachment file before encryption (§14.6). In a secure context the blob may be up to svf1Size(maxAttachmentBytes) (04 §10.7). 26,214,400 (25 MiB) 8,388,608 (8 MiB)

Every conforming server MUST accept at least the floor. A client MUST read the advertised value of the hosting server, and MUST assume the floor if the member is absent.

2.4 Identifier grammar

mid follows 00 §7.6: a UUIDv7 (RFC 9562) in lowercase hyphenated form, generated by the sending client.

mid          = 8lhex "-" 4lhex "-" "7" 3lhex "-" variant 3lhex "-" 12lhex
variant      = "8" / "9" / "a" / "b"
lhex         = DIGIT / %x61-66          ; 0-9 a-f, lowercase only

A server MUST reject a mid that doesn't match mid with 400 core.invalid_request. It MUST NOT check the UUIDv7 timestamp against its own clock, because a message composed offline can be sent days later (§13).

Rationale: the mid is the idempotency key and is bound into K_msg (14). Rejecting old timestamps would break the outbox, and nothing depends on the timestamp; ordering always uses seq (00 §7.6).

The 16-byte binary form of a mid (used by 14 for K_msg) is the 32 hex digits without hyphens, decoded as big-endian bytes.

3. The content object schema

3.1 Kinds

Every entry has one of four kinds. The same content object travels in both carriers (00 §7.4): in an insecure context it is the content member of the carrier; in a secure context its UTF-8 JSON serialization, padded as 14 §4.5 says, is the plaintext of the SealedMessage (14), whose signed header carries the same kind and, for operations, the target as ref.

kind Content object Meaning Has a target?
message MessageContent (§3.2) A new root message. No
edit EditContent (§3.7.1) Replaces the content of a root message by the same author. Yes: a root message
reaction ReactionContent (§3.7.2) Adds one reaction to a root message. It never removes one. Yes: a root message
delete DeleteContent (§3.7.3) Deletes the author's own root message, or removes the author's own reaction. Yes: a root message or a reaction entry

There is no "remove reaction" kind: removing a reaction is a delete whose target is the reaction entry (§6.5). The server can therefore see whether a post adds or removes a reaction, count reactions per account, and apply a different permission to each (§6.5). 14 §4.3 and §5.2 step 12 describe reaction as adding one reaction and accept, for delete, a ref that names a root message or a reaction entry whose sender is the posting account; 10 §3.5 checks add_reactions only on reaction posts.

v1 defines no other kind. In particular it defines no profile kind: v1 has no per-context profile data, because a per-context nickname would weaken the display-name rule of D-005 and D-031. A server MUST refuse any other kind: with 422 sealed.kind_unsupported (14) in a secure carrier, and with 400 core.invalid_request in an insecure carrier. A receiver that meets an unknown kind (from a later minor version) MUST ignore the entry, MUST NOT show it, and MUST still advance its sync position past its seq.

Rationale: making every operation an entry with its own mid gives each one its own K_msg in secure contexts (14) and its own idempotency key in both modes, so one write path, one outbox and one event stream cover everything.

Proposed decision: Every timeline write (message, edit, reaction, delete) is an entry with its own client-generated mid and seq, posted through one endpoint; a reaction only adds, and removing a reaction is a delete of the reaction entry, as 14 §4.3 and 10 §3.5 specify. v1 has no profile kind. Rationale: one write path for both modes, per-operation message keys, uniform idempotency, and server-visible add/remove so per-account caps and "removing one's own reaction is always allowed" work in secure contexts too.

3.2 MessageContent

Member Type Required Default Meaning and constraints
text string Yes — The message text in the formatting subset of §3.3. At most MAX_TEXT_CHARS (4,000) Unicode scalar values. MAY be empty only if attachments is non-empty.
mentions array of string No [] Canonical addresses (D-032) of the users this message mentions by name. Each MUST also appear as a user mention token in text (§3.4). No duplicates. At most MAX_MENTIONS (50).
mentionAll boolean No false true if text contains the <@everyone> token (§3.4). MUST be true if and only if the token is present. Whether it notifies anyone is decided by the server (§4.4).
replyTo ReplyRef or null No null The root message this one replies to (§3.5).
attachments array of AttachmentRef No [] Files attached to the message (§3.6). At most MAX_ATTACHMENTS (10).

Text rules:

  1. text MUST NOT contain U+0000 to U+001F except U+0009 (TAB) and U+000A (LF), and MUST NOT contain U+007F, U+2028 or U+2029. Clients MUST convert CR LF and lone CR to LF before sending. A server MUST refuse a violating insecure content with 400 message.invalid_content; a receiving client MUST replace violating characters in a decrypted secure text with U+FFFD before rendering.
  2. Text is not normalized by servers or clients. Clients SHOULD send text in NFC.
  3. Servers and receiving clients preserve leading and trailing white space as sent. Sending clients SHOULD trim it before sending. A text consisting only of white space counts as empty for the rule that text may be empty only when attachments is non-empty.

Example (the overview's insecure example, 00 §7.4, is a valid MessageContent):

{ "text": "Hello", "replyTo": null, "attachments": [] }

A fuller example:

{
  "text": "Hi <@bob@b.com>, the notes are attached. **Please** check by Friday.",
  "mentions": ["bob@b.com"],
  "mentionAll": false,
  "replyTo": { "mid": "01938f2f-77aa-7c10-9b2e-0c1d2e3f4a5b", "author": "bob@b.com", "ping": true },
  "attachments": [
    {
      "id": "01938f31-0a0b-7c0d-8e0f-101112131415",
      "name": "notes.pdf",
      "mime": "application/pdf",
      "size": 482113
    }
  ]
}

3.3 Text and the formatting subset

text is always interpreted as SV-Markdown, a small subset of CommonMark 0.31.2 with two extensions. There is no "plain" switch: a sender that wants a literal * escapes it with a backslash.

Supported constructs (CommonMark semantics unless stated):

Construct Syntax Notes
Emphasis *x* or _x_ CommonMark emphasis rules.
Strong **x** or __x__ CommonMark strong-emphasis rules.
Strikethrough ~~x~~ As in GitHub Flavored Markdown 0.29 (two tildes only).
Spoiler (extension) ||x|| Inline, same delimiter-run rules as strikethrough with | as the delimiter character and a run length of exactly 2. Rendered hidden until the reader taps it.
Code span `x` CommonMark code spans.
Fenced code block ``` with an optional info string The first word of the info string MAY select syntax highlighting. Indented code blocks are not supported.
Block quote > at line start CommonMark block quotes, nesting limited to 1 level; deeper > markers are literal text.
List - or * or 1. at line start CommonMark lists, nesting limited to 3 levels.
Hard line break LF Every LF is a line break (unlike CommonMark, where a single LF is a soft break).
Autolink (extension) A bare https://, http:// or sloppyv:// URL Recognized by the GitHub Flavored Markdown "extended autolink" rules, restricted to these three schemes.
Mention and channel tokens <@…>, <#…>, <@everyone> §3.4.
Backslash escape \ before any ASCII punctuation character CommonMark backslash escapes.

Everything else is disabled and its characters render literally: headings (ATX and setext), thematic breaks, tables, HTML blocks and inline HTML, entity and numeric character references, link reference definitions, inline links and images ([text](url), ![alt](url)), and autolinks in angle brackets other than the tokens of §3.4.

Rendering rules for clients:

  1. A client MUST render only the constructs above and MUST render any other markup as literal text.
  2. A client MUST NOT load any remote resource (image, font, preview, favicon) because of message text.
  3. A client MUST NOT fetch link previews automatically in a secure context. In an insecure context it SHOULD NOT fetch them unless the user turned that on, and if it does, it MUST fetch them from the client, never through the hosting server.
  4. When the user opens an http or https link, the client SHOULD show the full URL before leaving the app if the link's visible text was shortened.
  5. A sloppyv:// link opens inside the app (01).

Rationale: masked links ([text](url)) are the most common phishing trick in chat apps and add nothing a non-technical user needs. Automatic previews in secure contexts would send what members read to third-party sites and reveal the reader's IP address.

Proposed decision: Message text is a fixed SV-Markdown subset of CommonMark (emphasis, strong, strikethrough, spoiler, code, block quote, lists, autolinks, mention tokens), with no masked links, no images, no HTML and no automatic link previews in secure contexts. Rationale: predictable rendering on every platform and no phishing or tracking surface.

3.4 Mention and channel tokens

Mentions are written into text as tokens. The display layer replaces each token with the current display name.

token           = user-mention / channel-ref / everyone
user-mention    = "<@" token-addr ">"
channel-ref     = "<#" token-addr ">"
everyone        = "<@everyone>"
token-addr      = token-local "@" token-domain
token-local     = 1*tchar
token-domain    = 1*( %x61-7A / DIGIT / "-" / "." )   ; lowercase A-label form
tchar           = %x21-3B / %x3D / %x3F / %x41-7E / UTF8-non-ascii
                ; any visible character except "<" ">" "@"
UTF8-non-ascii  = %x80-FF   ; octets of a well-formed UTF-8 multi-byte sequence
  1. token-addr MUST be a canonical address (01, D-032). Clients MUST canonicalize an address before inserting a token. A token whose address isn't canonical, or doesn't parse under 01, is rendered as literal text and is not a mention.
  2. <@everyone> is a token in its own right and never names a user, because everyone has no @ domain part.
  3. A token inside a code span or fenced code block isn't a token; it renders literally.
  4. The set of user-mention tokens outside code MUST equal the set of addresses in mentions. A server MUST refuse an insecure content that breaks this with 400 message.invalid_content. A receiving client of a secure message uses the tokens found in the decrypted text as authoritative and ignores mentions entries that have no token.
  5. Rendering: a user mention shows "@" plus the address's display name (01), with the domain added when it differs from the context's domain (D-031). If the address isn't a member of the context, the client still renders the name but without highlight. A channel reference shows "#" plus the channel's display name and opens the channel.

Rationale: tokens keep the canonical address inside the text, so edits, copy and paste, and rendering stay correct after a display-name change, and offsets never need recomputing across UTF-8 and UTF-16.

3.5 ReplyRef

Member Type Required Meaning and constraints
mid string Yes mid of the root message replied to. It MUST be in the same context.
author string Yes Canonical address of that root message's sender, so the client can show "Replying to Bob" before it has loaded the original.
ping boolean No (default true) Whether the reply notifies author.

Rules:

  1. Replies are one level deep: a reply MAY point at a message that is itself a reply, but clients show only the direct parent. There are no threads in v1.
  2. In an insecure context, the server MUST check that replyTo.mid names a root message in the same context that the sender can see, and that author is its sender; otherwise 400 message.invalid_content. A deleted (tombstoned) parent is allowed.
  3. In a secure context the server can't check this. A receiving client MUST verify that the parent, once loaded, is in the same context and was sent by author; if not, it shows the message without the reply preview.
  4. If the parent is a tombstone or has expired, the client shows "Original message was deleted" in the preview.
  5. In a secure context a reply's structure is never cleartext. The ping reaches the server only through the mention hint (§4.4).

3.6 AttachmentRef and ThumbnailRef

An AttachmentRef describes one uploaded file (§14).

Member Type Required Meaning and constraints
id string Yes The Attachment ID returned by the upload (§14.2).
name string Yes File name for display and saving. 1 to MAX_FILENAME_BYTES (255) bytes of UTF-8; no /, \, U+0000 to U+001F or U+007F.
mime string Yes Media type (RFC 6838 type/subtype, lowercase, no parameters). application/octet-stream if unknown.
size integer Yes Size of the file in bytes before encryption. 1 to maxAttachmentBytes. Empty files aren't supported: a client refuses to attach a 0-byte file.
sha256 string Insecure: No. Secure: Yes base64url SHA-256 of the file before encryption.
key string Secure: Yes. Insecure: MUST be absent The 32-byte file key K_file of 04 §10.2 (§14.3), base64url.
width integer No Pixel width, for images and video (1–65,535).
height integer No Pixel height, for images and video (1–65,535).
durationMs integer No Duration, for audio and video.
thumb ThumbnailRef No A preview image (§14.3).
spoiler boolean No (default false) Show the preview blurred until tapped.
voice boolean No (default false) The file is a recorded voice message; clients show a player instead of a file card.

ThumbnailRef:

Member Type Required Meaning and constraints
id string Yes Attachment ID of the thumbnail upload (§14.2; purpose thumbnail in an insecure context, file in a secure one).
mime string Yes image/webp, image/jpeg or image/png.
size integer Yes Size before encryption; at most THUMB_MAX_BYTES.
width, height integer Yes At most THUMB_MAX_PX on the longer side.
sha256 string Insecure: No. Secure: Yes base64url SHA-256 of the thumbnail file before encryption.
key string Secure: Yes. Insecure: MUST be absent The thumbnail's own 32-byte file key, base64url.

Rules:

  1. The id values of all AttachmentRefs and ThumbnailRefs in one content object MUST be distinct.
  2. In an insecure context the server MUST check each id exactly as in §14.5 step 3 and MUST check that size equals the stored blob length and mime equals the declared upload mime.
  3. In a secure context name, mime, size, dimensions, key, sha256 and the thumbnail are visible only inside the SealedMessage. The server sees only the IDs (§4.3), how many there are, and the padded blob sizes; it can't tell a thumbnail from a file (§14.2).
  4. In a report (10, 14), the file key travels with the revealed K_msg, because it is inside the reported plaintext (00 HP-11).

3.7 Operation content objects

3.7.1 EditContent

Member Type Required Meaning and constraints
target string Yes mid of the root message being edited.
text string Yes The complete new text, with the rules of §3.2 and §3.3.
mentions array of string No (default []) As in MessageContent, for the new text.
mentionAll boolean No (default false) As in MessageContent, for the new text.
replyTo ReplyRef or null No (default null) A copy of the root message's replyTo. It MUST equal it member by member: an edit never changes what a message replies to.
attachments array of AttachmentRef No (default []) The attachments that remain. Each MUST be one of the target's current attachments, with identical members. An edit can remove attachments but not add them.

An edit is a complete replacement of the root message's content: together with the root's mid, sender and createdAt, an EditContent holds everything needed to show the message, so the original content needn't be kept (§6.2). Edits always target the root message, never an earlier edit. text MAY be empty only if attachments is non-empty.

3.7.2 ReactionContent

Member Type Required Meaning and constraints
target string Yes mid of the root message reacted to.
key string Yes The reaction: exactly one emoji, at most MAX_REACTION_KEY_BYTES (64) bytes of UTF-8.

Valid key. A key is valid when it is a single extended grapheme cluster (UAX #29) that matches the possible_emoji expression of UTS #51 ("EBNF and Regex"), and is at most 64 bytes of UTF-8. Servers check only this structure, never membership in the RGI emoji list, so a server with older Unicode data doesn't refuse emoji that newer clients offer. Clients SHOULD offer only RGI emoji sequences (UTS #51) in their picker.

Clients compare reaction keys after removing U+FE0F VARIATION SELECTOR-16 from both sides, so "❤" and "❤️" count as one reaction. Insecure servers MUST apply the same rule when aggregating. Custom (image) emoji aren't part of v1.

3.7.3 DeleteContent

Member Type Required Meaning and constraints
target string Yes mid of the root message or reaction entry to delete.

3.8 Size measurement, maxMessageBytes and padding

Insecure carriers. The size of content is the length in bytes of its serialization under the JSON Canonicalization Scheme (JCS, RFC 8785). A server MUST compute this from the parsed object, MUST refuse a content larger than maxMessageBytes with 413 message.too_large, and MUST NOT count insignificant white space or escape choices in the request.

Secure carriers. The plaintext of a SealedMessage and its padding are defined by 14 §4.5: the content JSON, followed by space bytes (0x20) up to a multiple of PAD_BLOCK (256) bytes. In a secure carrier maxMessageBytes applies to the content JSON before padding.

  • A client MUST check that the unpadded content JSON is at most maxMessageBytes before sealing, and MUST NOT send a longer one.
  • A client MUST pad every secure plaintext, of every kind, as 14 §4.5 describes, so its length is the smallest multiple of 256 that is at least the content JSON's length. A reaction or delete content object serialized without insignificant white space is always shorter than 256 bytes (at most 250 bytes even with every non-ASCII character escaped), so its padded plaintext MUST be exactly 256 bytes.
  • The server can't see the unpadded length. It enforces only 14's bound: the decoded ct minus its 16-byte tag is at most roundUp256(maxMessageBytes) (14 §4.1, §4.5). This check is part of 14 §5.2 step 5 and fails with 413 message.too_large.

Plaintext encoding in secure carriers. The content JSON is a UTF-8 JSON serialization of the content object. It need not be JCS. Receivers MUST accept any valid I-JSON serialization followed only by white space, and MUST reject (treat as undecryptable, §3.9) a plaintext that isn't one valid I-JSON object followed only by white space, or that has duplicate member names.

Rationale: servers see "how big" (00 §5.4). Padding every kind to 256-byte blocks hides the exact length of short messages at a small cost. Padding reactions is mandatory because a reaction's length is a constant plus the length of its emoji, so an unpadded reaction would tell the server which emoji was used (SM-6 requires reaction values to be encrypted). JCS gives servers and clients the same number for insecure content regardless of how the client's JSON library formats it. §19.2 gives test vectors.

Proposed decision: maxMessageBytes is measured as the RFC 8785 (JCS) length of content in insecure carriers and as the length of the content JSON before 14's padding in secure carriers; clients MUST pad every secure plaintext, including reactions and deletes, to a multiple of 256 bytes. Rationale: one unambiguous measurement in each mode, one padding scheme (14's), and no reaction-value leak through lengths.

3.9 Receiver validation of content

A client that receives an entry (in an event or an HTTP response) MUST apply these checks. A failing entry is shown as described and never causes a security warning (D-055).

Check Applies to On failure
Secure: SealedMessage verifies and decrypts (14). Every secure entry Show a placeholder "This message can't be shown" for a root message; ignore an operation entry. If the cause is a missing history key that the key archive or a manual share is still delivering, keep the placeholder and retry when keys arrive; K4 appears above it only where 14 §6.4 and §7.9 show it (a user's own new device restoring from the key archive, or a share being loaded). If the device will never get the key (for example an item sealed in an epoch in which no device of the account had a leaf, 14 §10.4), show 20's ST.history_unavailable, or fold it into K6 as 20 §5 says.
Plaintext is a valid content object for the header's kind; required members present and well typed. All As above.
The decrypted target equals sealed.ref (14 §4.3), which the server has checked against the cleartext target (§4.3). Secure operation entries Ignore the entry.
An edit or author delete comes from the same account as its target: same sender address, and in secure contexts the signing device belongs to that account (14). edit, delete Ignore the entry.
The id of every AttachmentRef and of its thumb in the decrypted content, taken together, are exactly the server-bound attachmentIds of that entry (§5.2, §5.3). Secure message and edit Show the attachments whose IDs don't match as "This file isn't available"; show the rest of the message normally.
Each AttachmentRef of an edit equals, member by member, one AttachmentRef of the message's previous content (the root, or the edit before it), and the edit's replyTo equals the root's (§3.7.1). Checked when the client still holds that earlier content. edit (secure; the server checks it in insecure contexts) Ignore the edit.
mentions matches the tokens (§3.4 rule 4). message, edit Use the tokens.
<@everyone> is honoured only if the server-validated mentionAll of the Message object (or of the edit) is true (§4.4). message, edit Render <@everyone> as plain text without highlight or notification.
Unknown members. All Ignore them (00 §7.2).

4. Carriers and posting entries

4.1 Endpoint

POST {base}/v1/contexts/{ctx}/messages
Authorization: Bearer <session token>   (or Bot <token>)
Content-Type: application/json

Every entry, of every kind and in both modes, is posted here. The body is a PostEntry. The sender's address and device are taken from the session, never from the body (00 §7.4).

4.2 PostEntry

Member Type Required Meaning and constraints
mid string Yes Client-generated UUIDv7 (§2.4). Idempotency key.
kind string No (default message) message, edit, reaction or delete.
target string Required for edit, reaction, delete; absent for message The target's mid, in cleartext. In a secure carrier it MUST equal sealed.ref (§4.3).
content object Insecure carrier: Yes. Secure: MUST be absent The content object for kind (§3).
sealed object Secure carrier: Yes. Insecure: MUST be absent A SealedMessage (14) whose plaintext is the content object for kind, padded (§3.8).
mentions array of string Secure, message and edit only; otherwise absent Mention hint (§4.4).
mentionAll boolean Secure, message and edit only; otherwise absent Mention hint (§4.4).
attachmentIds array of string Secure message: Yes when the content has attachments. Secure edit: Yes when the target has bound attachments, and [] then means "remove them all". Otherwise absent The IDs of every attachment and thumbnail the encrypted content references (§4.3). For an edit, the IDs that remain; they MUST be a subset of the target's bound IDs (§6.2).

Exactly one of content and sealed MUST be present. A body with both, neither, a member that this table says must be absent, or a secure edit of a target with bound attachments that lacks attachmentIds, is refused with 400 core.invalid_request.

4.3 The insecure and secure carriers

Insecure carrier (the context is insecure, 00 §4.1). The body carries content, exactly as in 00 §7.4:

POST {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/messages

{ "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
  "content": { "text": "Hello", "replyTo": null, "attachments": [] } }

The server reads, validates and stores the content. For an operation it MUST check that content.target equals target.

Secure carrier (the context is secure). The body carries sealed, as in 00 §7.4. Its cleartext members are only the ones the server needs to run the context:

Cleartext member Why the server needs it
kind (and sealed.kind) To apply the rules for that kind (edit and delete by the author only, reaction limits, cascades). 00 §5.4 lists kinds as visible metadata.
target (and sealed.ref) To attach edits and reactions to their message, to delete the right ciphertext, and to cascade deletes.
attachmentIds To bind uploads to the message, so they are deleted with it and expire with it (§14.5).
mentions, mentionAll The mention hint for notifications (D-063, §4.4).

The server MUST check that sealed.ctx equals the path's context, sealed.mid equals mid, sealed.kind equals kind, and, for operations, sealed.ref equals target; a mismatch is refused with 400 sealed.header_mismatch (14 §5.2 step 6). It then runs the rest of the SealedMessage ingress checks of 14 in the order of §4.5. ref is part of the signed SealedHeader and of the AEAD associated data (14 §4.4), so the link between an operation and its message is authenticated by the sender: a server can't move an edit or reaction to another message without the signature failing.

Secure edit example:

POST {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/messages

{ "mid": "01938f35-2c3d-7e4f-8a5b-6c7d8e9fa0b1",
  "kind": "edit",
  "target": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
  "sealed": {
    "v": 1,
    "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
    "gen": 1,
    "mid": "01938f35-2c3d-7e4f-8a5b-6c7d8e9fa0b1",
    "epoch": 42,
    "ekid": "q83vEjRWeJA",
    "kind": "edit",
    "ref": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
    "did": "q2bS9xVg3m0yJpQe1vT0Aw",
    "nonce": "Hq2w9b0AAAAAAAAA",
    "kc": "Xb2kP0aL9qR2sT5uV8wZ1A",
    "ct": "8fQ…",
    "sig": "c2Vh…"
  },
  "mentions": [],
  "mentionAll": false }

Insecure reaction and delete examples:

{ "mid": "01938f36-0000-7a00-8b00-000000000001",
  "kind": "reaction",
  "target": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
  "content": { "target": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6", "key": "👍" } }
{ "mid": "01938f37-0000-7a00-8b00-000000000002",
  "kind": "delete",
  "target": "01938f36-0000-7a00-8b00-000000000001",
  "content": { "target": "01938f36-0000-7a00-8b00-000000000001" } }

Rationale: the secure carrier exposes only what 00 §5.4 already lists as metadata. Reply structure, reaction values, file names and types stay inside the SealedMessage.

Proposed decision: In secure carriers, target (equal to the signed sealed.ref of 14) and attachmentIds travel in cleartext next to the SealedMessage; receivers check the encrypted content against both; reply structure stays encrypted. Rationale: the server must cascade deletes, attach edits and reactions, and expire attachments, but needs nothing else.

4.4 Mention hints (D-063)

In a secure context the server can't read who is mentioned, but it must notify mentioned users who are offline (19). The secure carrier therefore carries a cleartext mention hint:

  • mentions: canonical addresses to notify. When hints are on, this is the content's mentions plus, for a reply with ping: true, the reply's author (unless it is the sender). At most MAX_MENTIONS.
  • mentionAll: equal to the content's mentionAll.

User opt-out. Each user has a setting "Send mention notifications in encrypted chats", stored as the AccountVault setting mention_hints (08 §8.6.4; boolean, default true) so all their devices follow it. When it is false, the client sends mentions: []. It doesn't affect mentionAll, which is always sent truthfully, because notifying everyone reveals nothing about any one person and the server must check the permission for it.

When hints are off, the people mentioned or replied to still see the mention highlighted when they open the context, because their client reads the encrypted content; they just don't get a push or a mention badge for it while they're away. The settings screen MUST say this in one line, for example "If you turn this off, people you @mention or reply to in encrypted chats won't get a notification while they're away. If it's on, the server can see who you mention."

Server rules for hints (and for content.mentions and content.mentionAll in insecure carriers), in this order:

  1. More than MAX_MENTIONS (50) entries in mentions as received, counting invalid addresses and duplicates: 400 message.too_many_mentions (data.limit: 50). 1a. Otherwise, more distinct addresses in mentions as received than the hosting server's AntiSpamPolicy mentionLimit (10 §12.2; default 20, never above MAX_MENTIONS), in any context it hosts: 400 message.too_many_mentions with data.limit set to mentionLimit.
  2. Otherwise every address in mentions (and, in an insecure carrier, replyTo.author) MUST pass 01 §7.5 checks 1 to 5; else 400 address.non_canonical with data.field. The server then keeps only addresses equal to the canonical address of an account that can see the context (§7.5), which meets 01's check 6 without discovery, and drops the others and duplicates without refusing the entry. In an insecure carrier it doesn't change content; the dropped addresses simply aren't notified.
  3. mentionAll: true takes effect only if the sender has the mention_everyone permission (10), or, for a webhook, allowMentionAll (§15). Without it the server accepts the entry, records the validated mentionAll as false, and notifies nobody for it (10 §3.1, §3.5). It never refuses an entry for this.
  4. The server stores the validated hint (secure) or the validated mentionAll (both modes) with the entry, and includes them in the Message object and events (§5.2, §8.2), so receivers can apply §3.9.

Clients SHOULD read mentionLimit from GET /v1/moderation/policy (10 §12.2) and say so in the composer before sending.

Receiver rules: a client treats itself as mentioned by a secure message, for highlights and badges, when its own address is in the decrypted mentions or the message is a reply to it with ping: true. In both modes it honours <@everyone> only if the content says so and the server-validated mentionAll is true; otherwise <@everyone> renders as plain text. A notification triggered by a hint that the decrypted content doesn't support (the user isn't mentioned or replied to) MUST be suppressed silently when the device decrypts it (19).

In an insecure context the server reads content.mentions, content.mentionAll and content.replyTo directly. The hint members MUST be absent.

Rationale: a reply ping is just a mention of the parent's author, so the server needs no cleartext reply structure to notify. mentionAll stays honest in every case so the permission check means something. Accepting an unauthorized "everyone" without notifying anyone follows 10 and means a person who types @everyone without the permission never sees their message fail.

Proposed decision: The D-063 opt-out (mention_hints) covers only the per-user mentions list; mentionAll is always sent truthfully; without mention_everyone the entry is accepted with a validated mentionAll of false, and recipients honour <@everyone> only when the validated value is true; reply pings travel as mentions. Rationale: keeps the mention_everyone permission enforceable in secure contexts, matches 10, and avoids a cleartext reply graph.

4.5 Server acceptance procedure

The hosting server MUST process a PostEntry in this order and stop at the first failure. This is the one normative order for the posting endpoint: it includes the SealedMessage checks of 14 §5.2, which run as step 10, and 14 §5.2 steps 1 to 4 and 7 are performed here as steps 1, 3 and 4 to 8.

Step Check Failure
1 The session is valid. 401 core.unauthenticated / core.token_expired (03)
2 Body shape (§4.2), mid grammar (§2.4), kind one of §3.1. 400 core.invalid_request; an unknown kind in a secure carrier, 422 sealed.kind_unsupported (14)
3 Idempotency (§4.6). An entry with this mid already exists in the context and was sent by the caller's account. Same kind and target: answer 201 with the stored EntryAck and stop, whatever the caller's current access, the context's mode or the caller's permissions. Different kind or target: 409 core.idempotency_conflict (reason: "mismatch"). The first request with this mid is still being processed: 409 core.idempotency_conflict (reason: "in_progress", retryable, retryAfterMs ≥ 500) (03 §14.1).
4 ctx exists on this server and the caller may see it and post to it. Channel: 09 §9.3 steps H3, H4 and H5 (existence, view, community membership; active and needs_encryption members pass). DM or group DM: the caller is an active participant (12 §6.3); a participant in state pending, or a 1:1 participant in state declined, also passes, and implicit acceptance (12 §8.7) makes them active in the transaction that accepts the entry. If the mid exists with another sender account, 409 core.idempotency_conflict (reason: "mismatch") once this step has passed. 404 core.not_found for an unknown context or one the caller may not know about (03 §18.6, 09 §9.3, 12 §6.5). Channel: 403 member.not_member, 403 member.pending (09) or 403 moderation.banned (10). DM: 403 dm.not_participant (12) for a participant who left or was removed; 403 moderation.banned for a target of a server-scope ban (10 §9.4 step 7).
5 SM-4 for secure contexts: insecure account (including a needs_encryption membership, 09), unenrolled device. Then, for a channel, 09 §9.3 H8: the caller is a channel member. 403 security.account_required / security.device_not_enrolled (00 §4.11); security.upgrade_required for an account in that state (05); 403 channel.join_required (09)
6 The DM or group DM is in a state that takes content (12): not closed, not encryption_pending, and, for a plaintext body, not upgrading. 409 dm.closed, 409 dm.encryption_pending, 409 dm.upgrade_in_progress (12)
7 Carrier matches the context's current mode (§4.7). A sealed body in an insecure context: 409 sealed.not_secure (14). A plaintext body in a secure channel, or in any channel while a server upgrade is being applied (09 §11.4 T1): 409 channel.plaintext_rejected (09 §15.3; data.security, data.upgradeSeq); in a secure DM or group DM: 409 sealed.required (14).
8 Moderation and permission (10 §6.3 checks a, b, d and e, in that order): a. timeout, for message, edit and reaction (never for delete, which needs no permission); b. permission: send_messages for message and edit, add_reactions for reaction, and in addition attach_files for a message that binds attachments; nothing beyond step 4 for delete; d. new-member restriction (10 §6.2 modifier c) for those permissions; e. slow mode, for message only. Rate limits are step 14. 403 moderation.timed_out; 403 core.forbidden with data.permission; 403 moderation.new_member_restricted; 429 moderation.slow_mode (10)
9 Insecure: size (§3.8). 413 message.too_large
10 Insecure: content valid (§3). Secure: 14 §5.2 steps 5, 6, 8, 9, 10, 11, 12 and 13 in that order (shape and the padded-size bound of §3.8; binding to the carrier, including ref = target, §4.3; device; group membership; content freeze of 13; epoch; kind and ref; signature). 400 message.invalid_content; the codes of 14 §5.2; 409 mls.commit_required (13)
11 Target rules for the kind (§6). In a secure carrier, 14 §5.2 step 12 has already checked that the target exists, isn't deleted and, for edit and delete, was sent by the caller (sealed.ref_invalid). §6 codes
12 Mentions and mentionAll (§4.4). 400 message.too_many_mentions; 400 address.non_canonical (01)
13 Attachments bind (§14.5 step 3). attachment.* codes
14 Rate limits (§17.3). 429 core.rate_limited

On success the server, in one transaction: assigns the next context seq (03); sets createdAt to its current time, which MUST NOT be earlier than the createdAt of the entry with the previous seq in the same context (if the clock went backwards, it uses that earlier value); stores the entry; binds attachments; applies the entry's effect (§6); emits the event (§8); and hands notification triggers to 19 (§16).

Rationale: idempotency comes before access, mode and permission checks so that a resend of an entry whose response was lost always returns the stored acknowledgement, even if the sender has since been timed out, the context has changed mode, or the DM was closed. Otherwise the outbox would show "Not sent" for a message everyone else already has. Only the original sender gets this answer, so it reveals nothing. createdAt being non-decreasing in seq is what lets retention purge a prefix of the timeline (§12).

4.6 Response and idempotency

On success the server answers 201 Created with an EntryAck:

Member Type Meaning
mid string The entry's mid.
kind string The entry's kind.
seq integer The seq assigned.
createdAt string The server timestamp.
HTTP/1.1 201 Created
Content-Type: application/json

{ "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6", "kind": "message", "seq": 4182, "createdAt": "2026-12-04T18:22:31.512Z" }

Idempotency (00 §7.11 and 03 §14.1, with the narrower comparison that 03 §14.1 rule 2 lets an owner define):

  1. The scope of a mid is the context. The fingerprint of an entry is its sender account (canonical address and incarnation, §5.1), kind and target, not the body bytes.
  2. If an entry with the same mid exists in the context with the same fingerprint, the server answers 201 Created with the stored EntryAck (the status of the original, 03 §14.1 rule 3) and changes nothing, even if the bytes of content or sealed differ. This makes re-sealing a queued message under a newer epoch safe (§13.4).
  3. If it exists with a different fingerprint, the server answers 409 core.idempotency_conflict with reason: "mismatch" (03).
  4. A duplicate that arrives while the original is still being processed gets 409 core.idempotency_conflict with reason: "in_progress", retryable: true and retryAfterMs of at least 500 (03 §14.1 rule 6). The outbox waits and resends (§13.3).
  5. The server MUST remember every accepted mid with its fingerprint for at least MID_MEMORY_MIN (30 days) after the entry was accepted, even after the entry is deleted or purged. Within that time a resend of a deleted or purged entry returns 201 with the stored EntryAck and doesn't recreate it (03 §14.1 rule 5 lets the owner define this).
  6. Idempotency-Key is not used on this endpoint; mid plays that role.

4.7 Carriers across security transitions

The required carrier is fixed by the context's current security mode when the server processes the entry:

  1. Insecure context: insecure carrier only. A sealed body is refused with 409 sealed.not_secure (14).
  2. Secure context: secure carrier only. A content body is refused with 409 channel.plaintext_rejected in a channel (09 §10.4 A1, §15.3) and 409 sealed.required in a DM or group DM (14). A DM that is upgrading already refuses plaintext with 409 dm.upgrade_in_progress (12 §11.4). For an upgraded channel, every entry with seq > upgradeSeq (09) is sealed. A needs_encryption member can't post at all (§4.5 step 5); 09 §7.2 and §9.3 step H6 describe what it can still read.
  3. Edits stay in their mode. An edit MUST use the same carrier type as its target. If the target was sent in the other mode (it predates an upgrade, or a 1:1 DM changed mode since), the server refuses with 409 message.not_editable, data.reason: "security_changed". Reactions and deletes always use the current carrier, whatever the target's carrier; so a secure account can delete its own pre-upgrade plaintext messages with a sealed delete.

What a client does when the mode changed under a queued entry. The client refreshes the context's state (09 for channels, 12 for DMs) and then:

  • Insecure to secure (channel.plaintext_rejected, sealed.required, dm.upgrade_in_progress): if the account is secure and the device enrolled, it waits until it holds the group's state, re-encodes the entry as a SealedMessage with the same mid, and resends it, without asking the user (09 §10.5, 12 §11.4). Otherwise the item waits for the user's own action (G1 or G2, §13.3).
  • Secure to insecure (sealed.not_secure): the client MUST NOT re-encode or resend content composed under a closed lock as plaintext automatically, in any context type (14 §4.7 step 12). The item becomes failed with the ordinary "Not sent. Tap to retry or delete." copy (§13.5); markers K2 and W7, which the context already shows, explain why. Before it sends that item as plaintext after the user taps "Retry", the client checks the change itself:
    • channel: a channel it has pinned as secure and now sees presented as insecure is W9 (D-056): sending stays disabled and nothing is sent;
    • group DM: a secure group DM never becomes insecure (SM-9, D-069). The client treats the presentation as an error: it sends nothing, records a diagnostic, and keeps the item failed;
    • 1:1 DM: the client recomputes the DM's security from fresh IdentityStates of both participants, fetched from their home servers (07, 12 §11.1), never from the hosting server's answer alone. If they still say both are secure, it sends nothing as plaintext, records a diagnostic, and keeps the item failed.

Rationale: content written under a closed lock must never leave in plaintext without the user doing something, and a hosting server's word alone is never enough to make a client send plaintext in a context it knows as secure. Moving the other way is always safe, so it is automatic. Using the codes of 09, 12 and 14 instead of a code of this document means every owner's refusal has exactly one meaning.

Proposed decision: Edits must use the target's carrier and can't cross a security change; insecure-to-secure re-encoding of queued entries is automatic, secure-to-insecure never is, in any context type, and a 1:1 DM's downgrade is confirmed from IdentityStates before any plaintext send; needs_encryption members can't post at all. Rationale: an edit never silently changes how a message is protected, and no server can extract plaintext from a secure conversation by claiming a downgrade.

5. Timeline objects

5.1 Sender

Every stored entry has a Sender, filled in by the server from the session (00 §7.4).

Member Type Required Meaning
addr string Yes, except for webhooks Canonical address of the sending account.
name string Yes The account's display name (01) when the server produced the object, or the webhook's name. When the name failed 01 §6.4 at this server, the server puts the prepared local part here (01 §6.5). Every account has a display name, which is its prepared local part unless its holder chose another capitalization or spacing (01 §6.3).
did string Yes, except for webhooks Device ID of the sending device (00 §7.6).
kind string No (default user) user, bot or webhook. A receiver treats an unknown value as bot.
webhook string Only when kind is webhook The Webhook ID (§15).

Clients MUST check name against addr with the display-name rule of 01 (D-031) and show the local part if it fails. A Sender of kind webhook MUST be shown with a "Webhook" badge and MUST NOT be shown as, or linked to, any account. In a secure context the bot badge comes from the IdentityCertificate's kind (07), not from this member. A Sender of kind webhook is not an AddressRef (01 §6.7): it has no addr.

Incarnation (D-086). With every entry it stores, the server also records the sending account's incarnation (inc, 05 §11.1): from the session's HomeAssertion (06 §4.3) for a remote account, and from 05 for a local one. It isn't part of the Sender object on the wire. Wherever this document or 14 compares an entry's sender account with the caller's account (the fingerprint of §4.6, the author rules of §6.2 and §6.3, and 14 §5.2 steps 7 and 12), the two are the same account only when both the canonical address and the recorded inc are equal. A later account at the same address (01 §5.7, 06 §11.6) is therefore never the author of an earlier account's entries: it can't edit or delete them (403 message.not_author, or 422 sealed.ref_invalid with reason not_author in a secure carrier).

5.2 Message object

The Message object is the folded, current view of one root message. HTTP responses return it; message.created carries it.

Timelines mix carriers: an upgraded channel holds plaintext messages from before upgradeSeq that can receive sealed reactions afterwards, and a 1:1 DM that changes mode (SM-8) holds both kinds. So every member below is keyed on the carrier type of the entry it represents, never on the context's current mode.

Member Type Required Meaning
type string In timeline pages (§7.1) only "message".
mid string Yes The root message's mid.
ctx string Yes in HTTP; omitted in events (the envelope carries it) Context reference.
seq integer Yes in HTTP; omitted in events (the envelope carries it) seq at which the root message was accepted.
carrier string Yes plain or sealed: the carrier type of the root message. A receiver treats an unknown value as sealed and shows the placeholder of §3.9.
sender Sender Yes Who sent it.
createdAt string Yes Server timestamp of acceptance.
content MessageContent plain, not deleted The current content: the root content, or the latest edit's content if there is one (§6.2).
sealed SealedMessage sealed, not deleted, not edited The root message's SealedMessage, as posted (14). Absent once the message has been edited, because the server deletes the original ciphertext then (§6.2).
edit EditEntry or null sealed only The latest edit (§5.3), or null. It is self-contained (§3.7.1).
mentions array of string sealed only The server-validated mention hint of the root message (§4.4).
mentionAll boolean Yes The server-validated mentionAll of the root message (§4.4): true only if the content asked for it and the sender was allowed to.
attachmentIds array of string sealed, when any are bound The IDs currently bound to this message (§14.5): the root's, or after an edit the latest edit's (equal to edit.attachmentIds).
editedAt string or null Yes Time of the latest edit, or null.
deleted Deletion or null Yes null, or how it was deleted (§5.4).
reactions array of ReactionSummary Yes, unless deleted (may be empty) Aggregated plain reaction entries (§5.3).
reactionEntries array of ReactionEntry When there are sealed reaction entries Up to INLINE_REACTION_ENTRIES (100) sealed reaction entries, oldest first.
reactionEntryCount integer With reactionEntries Total number of sealed reaction entries; when larger than the inlined count, fetch the rest (§7.3).
updatedSeq integer Yes seq of the latest entry that changed this message: its creation, an edit, a reaction added or removed, or its deletion.

A Message object MAY carry both reactions and reactionEntries. Clients render both, merging counts per normalized key (§3.7.2) and counting each account at most once per key.

An insecure Message object (as an HTTP item):

{
  "type": "message",
  "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "seq": 4182,
  "carrier": "plain",
  "sender": { "addr": "alice@a.com", "name": "Alice", "did": "q2bS9xVg3m0yJpQe1vT0Aw", "kind": "user" },
  "createdAt": "2026-12-04T18:22:31.512Z",
  "content": { "text": "Hello, everyone in **Lobby**", "replyTo": null, "attachments": [] },
  "mentionAll": false,
  "editedAt": "2026-12-04T18:23:02.004Z",
  "deleted": null,
  "reactions": [ { "key": "👍", "count": 3, "me": true }, { "key": "🎉", "count": 1, "me": false } ],
  "updatedSeq": 4190
}

A secure Message object:

{
  "type": "message",
  "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "seq": 4182,
  "carrier": "sealed",
  "sender": { "addr": "alice@a.com", "name": "Alice", "did": "q2bS9xVg3m0yJpQe1vT0Aw", "kind": "user" },
  "createdAt": "2026-12-04T18:22:31.512Z",
  "sealed": { "v": 1, "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "gen": 1, "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6", "epoch": 42, "ekid": "q83vEjRWeJA", "kind": "message", "did": "q2bS9xVg3m0yJpQe1vT0Aw", "nonce": "3q2-7wAAAAAAAAAA", "kc": "mZ8rQ1cX0vB7nT4yL2kP9w", "ct": "Vt1yQm9…", "sig": "Jk3b0xW…" },
  "mentions": ["bob@b.com"],
  "mentionAll": false,
  "edit": null,
  "editedAt": null,
  "deleted": null,
  "reactions": [],
  "reactionEntries": [
    { "mid": "01938f36-0000-7a00-8b00-000000000001", "target": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6", "seq": 4185,
      "carrier": "sealed",
      "sender": { "addr": "bob@b.com", "name": "Bob", "did": "Yx3kP0aL9qR2sT5uV8wZ1A", "kind": "user" },
      "createdAt": "2026-12-04T18:22:40.100Z",
      "sealed": { "v": 1, "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "gen": 1, "mid": "01938f36-0000-7a00-8b00-000000000001", "epoch": 42, "ekid": "q83vEjRWeJA", "kind": "reaction", "ref": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6", "did": "Yx3kP0aL9qR2sT5uV8wZ1A", "nonce": "…", "kc": "…", "ct": "…", "sig": "…" } }
  ],
  "reactionEntryCount": 1,
  "updatedSeq": 4185
}

5.3 EditEntry, ReactionSummary and ReactionEntry

EditEntry (edits of sealed root messages only; a plain edit is applied to content):

Member Type Required Meaning
mid string Yes The edit entry's mid.
seq integer Yes Its seq.
sender Sender Yes Same account as the root message; did may differ (another of the author's devices).
createdAt string Yes Server timestamp.
sealed SealedMessage Yes Kind edit, ref the root's mid; plaintext is an EditContent.
mentions, mentionAll Yes The edit's server-validated hint (§4.4).
attachmentIds array of string When the root had bound attachments The IDs that remain bound after this edit.

ReactionSummary (aggregates plain reaction entries), one per distinct reaction key, ordered by the seq of the first reaction with that key:

Member Type Meaning
key string The reaction key, as first sent.
count integer Number of accounts with a live reaction entry with this key (keys compared as in §3.7.2).
me boolean Whether the requesting account is among them. Present only in HTTP responses.

ReactionEntry (both modes; the object of reaction.added and of §7.3):

Member Type Required Meaning
mid string Yes The reaction entry's mid. Removing the reaction means deleting this mid.
target string Yes The root message's mid.
seq integer Yes in HTTP; omitted in events Its seq.
carrier string Yes plain or sealed, as for Message.
sender Sender Yes Who reacted.
createdAt string Yes Server timestamp.
key string plain only The reaction key.
sealed SealedMessage sealed only Kind reaction, ref the root's mid; plaintext is a ReactionContent.

5.4 Tombstones

When a root message is deleted (by its author, §6.3, or by a moderator, 10), the server replaces it with a tombstone: a Message object with deleted set, mentionAll false, editedAt null, and with content, sealed, mentions, attachmentIds, edit, reactions, reactionEntries and reactionEntryCount absent. For a sealed target the server also keeps, outside the object, what 14 §5.7 requires (did, gen, epoch and sigHash) so that a report can still be verified.

Deletion object:

Member Type Meaning
at string When it was deleted.
by string author or moderator. A receiver treats an unknown value as moderator.

The server MUST delete the content, the SealedMessage, every edit, every reaction entry and every bound attachment blob at deletion time (in backups within its normal backup rotation, which SHOULD be at most 30 days). It MUST keep the tombstone for at least TOMBSTONE_MIN (30 days) after deletion, so clients that sync later learn of the deletion (§7.4); afterwards it MAY drop it, and then GET …/messages/{mid} answers 404.

UX: clients remove a deleted message from the timeline without a placeholder when the author deleted it. When a moderator deleted it, clients MAY show a one-line "Message removed by a moderator". A reply whose parent is a tombstone shows "Original message was deleted".

5.5 How a client folds a secure message

A secure client builds what it shows from a Message object whose carrier is sealed as follows:

  1. If edit is null: decrypt and verify sealed (14) into a MessageContent, and apply §3.9.
  2. If edit is non-null: decrypt and verify it into an EditContent and apply §3.9 (same author, target equals ref, attachment IDs, and, if the client still holds the root's content from before, replyTo and attachments equal to the root's). If it passes, show its content and mark the message "(edited)". If it can't be decrypted yet, show the root content if the client still holds it, otherwise the placeholder of §3.9, and retry when keys arrive. If it fails §3.9, show the root content if the client holds it, otherwise the placeholder.
  3. Reactions: decrypt each sealed ReactionEntry; drop those failing §3.9; add the plain ReactionSummaries; group by normalized key (§3.7.2); count each account at most once per key.
  4. Mentions and highlights per §4.4.

A client that held the root's decrypted content before an edit arrived replaces it with the edit's content and SHOULD delete the old plaintext from its storage.

6. Operations

6.1 Messages

A message entry needs send_messages (10) in the context, and also attach_files (10) if it binds attachments. In DMs and group DMs, every participant with access has both (10, 12). The content's mentions, validated mentionAll and reply ping are notification triggers (§16).

6.2 Edits

The server accepts an edit only if all of these hold, and refuses with the code shown otherwise:

Rule Failure
The target is a root message in this context visible to the sender. 404 message.target_not_found
The target isn't deleted. 409 message.target_deleted
The sender's account is the target's sender account. A webhook message can't be edited through this endpoint. 403 message.not_author
The target was sent with the same carrier type (§4.7 rule 3). 409 message.not_editable (data.reason: "security_changed")
Insecure: content.replyTo equals the target's replyTo, and content.attachments is a subset of the target's current attachments with identical members. Secure: attachmentIds is a subset of the target's bound IDs (receivers check the rest, §3.9). 400 message.invalid_content

In a secure carrier the first three rules are checked by 14 §5.2 step 12 and fail with 422 sealed.ref_invalid (reason not_found, deleted or not_author); the codes above apply to insecure carriers.

Effect:

  • Insecure: the server replaces the stored content with the edit's text, mentions, mentionAll, replyTo and attachments, records the validated mentionAll (§4.4) and sets editedAt. It MUST NOT return earlier versions through any endpoint of this document. Whether it retains them for moderation is governed by 10.
  • Secure: the server stores the edit as the message's edit. It then deletes the ct of the previous edit, if any, and, on the first edit, the ct of the root SealedMessage, keeping for each only what 14 §5.7 keeps for a tombstone (mid, sender, did, gen, epoch and sigHash). It never serves a deleted ct again. The latest edit is self-contained (§3.7.1), so nothing else is needed to show the message.
  • Both: attachments no longer referenced are unbound and their blobs (and thumbnails) deleted (§14.5). updatedSeq becomes the edit's seq. The server emits message.edited.

There is no time limit on edits. New mentions in an edit are notification triggers only for addresses not already mentioned by the root message or an earlier edit (§16).

UX: clients show "(edited)" next to an edited message, with the time of the edit on hover or long-press. They don't show edit history.

Rationale: people edit to remove things they shouldn't have pasted, such as a password or an address. Deleting the earlier ciphertext gives secure contexts the same promise as insecure ones: nobody who loads the message from the server afterwards, including a member's own new device or someone the message is later shared with (D-007), can read the earlier version. Members who already decrypted it may still hold it (§20). The kept sigHash lets a report of the original still be verified from a copy the reporter kept (14 §5.7).

Proposed decision: An edit is a complete, self-contained replacement of a message's content (including replyTo, which must not change), and in secure contexts the server deletes the original and earlier edits' ciphertext when it accepts an edit, keeping only the tombstone fields of 14 §5.7. Rationale: editing out a secret protects people equally in both modes.

6.3 Deletes by the author

The target of a delete is either a root message or a reaction entry.

Rule Failure
The target is a root message or reaction entry in this context. 404 message.target_not_found
It isn't already deleted. 409 message.target_deleted
The sender's account is the target's sender account. 403 message.not_author

In a secure carrier these rules are checked by 14 §5.2 step 12 and fail with 422 sealed.ref_invalid (reason not_found, deleted or not_author).

Effect for a root message: tombstone it and delete everything listed in §5.4; emit message.deleted with by: "author". Effect for a reaction entry: delete it; emit reaction.removed with by: "author". The delete entry itself isn't kept as a timeline item; its mid is remembered (§4.6) and its seq is the seq of the event.

A client that gets message.target_deleted, or sealed.ref_invalid with reason: "deleted", for a queued delete treats the delete as done.

Deleting someone else's message is a moderation action (10, manage_messages). It has the same effect with by: "moderator". In secure contexts the server deletes the ciphertext without reading it (D-023).

UX: "Delete for everyone" is the only delete. Clients ask "Delete this message for everyone?" once, with a "Don't ask again" option. Clients MUST NOT promise that copies are gone from other members' devices; in secure contexts, other members' clients delete their decrypted copy, but a modified client could keep it.

6.4 Replies

A reply is a message with replyTo (§3.5). It has no separate operation. In insecure contexts the server notifies replyTo.author when ping is true and the author isn't the sender. In secure contexts the notification comes from the mention hint (§4.4).

6.5 Reactions

The server accepts a reaction only if:

Rule Failure
The sender has add_reactions (10) (§4.5 step 8). 403 core.forbidden with data.permission: "add_reactions"
The target is a root message in this context visible to the sender, not deleted. 404 message.target_not_found, 409 message.target_deleted (secure carrier: 422 sealed.ref_invalid, 14)
The sender has fewer than MAX_REACTIONS_PER_USER (20) live reaction entries on the target. 409 reaction.too_many (data.limit: 20)
Plain carrier: key is valid (§3.7.2). 400 reaction.invalid_key
Plain carrier: the sender has no live plain reaction with the same normalized key on the target. 409 reaction.already_exists, with data.mid naming the existing entry
Plain carrier: the target has fewer than MAX_REACTION_KEYS (20) distinct keys among its plain reactions, or the key is already among them. 409 reaction.too_many (data.limit: 20)

Effect: store the ReactionEntry; updatedSeq of the target becomes its seq; emit reaction.added.

Removing a reaction is a delete of the reaction entry (§6.3). It needs no permission beyond access to the context, so removing one's own reaction is always allowed, in both modes (10). A client that gets reaction.already_exists for a queued reaction treats it as done and records data.mid as its entry.

In a secure carrier the server can't see keys, so it can't detect duplicates or count distinct keys. Clients MUST NOT send a second live reaction with the same normalized key on the same message, and receivers count each account at most once per key (§5.5). The reaction picker SHOULD offer at most 20 distinct keys per message.

Rationale: the per-user cap of 20 bounds storage and fan-out in both modes even when the server can't read keys.

6.6 Mentions

Mentions are described in §3.4 (tokens), §4.4 (hints and permission) and §16 (notifications). A mention of an address that has no access to the context doesn't give it access and doesn't notify it.

7. The timeline API and sync

All endpoints in this section require a session that can see the context (§7.5), and answer 404 core.not_found for contexts unknown to the caller. They follow 03 §13.1 and add the members below.

7.1 Paging the timeline

GET {base}/v1/contexts/{ctx}/messages?before=<seq>&limit=<n>
GET {base}/v1/contexts/{ctx}/messages?after=<seq>&limit=<n>
GET {base}/v1/contexts/{ctx}/messages?around=<seq>&limit=<n>
GET {base}/v1/contexts/{ctx}/messages?limit=<n>
GET {base}/v1/contexts/{ctx}/messages?changedAfter=<seq>[&through=<seq>]&limit=<n>

The timeline items of a context (03 §11.2) are its root messages, including tombstones (Message objects, §5.2), and the system items that other documents register as timeline items, such as membership lines, the markers K1 to K8 and 14's history.shared (09, 10, 12, 14). Of this document's event types, only message.created is a timeline item (§8.1): edits, reactions and deletes change a Message object instead of adding an item.

Parameter Type Meaning
before integer ≥ 1 Timeline items with seq < before, the newest limit of them.
after integer ≥ 0 Timeline items with seq > after, the oldest limit of them.
around integer ≥ 1 Up to floor(limit / 2) timeline items with seq < around, the item at around if there is one, and the rest with seq > around.
(none of these) The newest limit timeline items.
limit integer 1–100 Default 50 (03 §13.1).
changedAfter integer ≥ 0 The changes feed (§7.4).
through integer ≥ 0 Only with changedAfter (§7.4).

At most one of before, after, around and changedAfter may be given, and through only with changedAfter; otherwise 400 core.invalid_request.

Response MessagePage:

Member Type Meaning
items array of Message or SystemItem Timeline items the caller can see (§7.5), including tombstones, excluding expired and purged ones. In ascending seq order, except for changedAfter, where the order is ascending updatedSeq (§7.4). Every item has a type member.
hasMore boolean For before and the newest page: older visible items exist. For after and changedAfter: newer ones exist. For around: hasMoreBefore or hasMoreAfter.
hasMoreBefore, hasMoreAfter boolean Only for around.
headSeq integer The context's latest seq (any durable event) when the page was read (03 §13.1).
ranges array of [integer, integer or null] The seq ranges the caller may read in this context (§7.5 rule 5), ascending and merged; null as an end means "open". [] if none.
grants array of [integer, integer] The seq ranges of the caller's VisibilityGrants in this context (14), ascending and merged; [] if none, and always in insecure contexts. Only sealed items, and the attachments bound to them, are served inside them (§7.5).
withheldBeforeSeq integer or null In a secure context: the seq at which the caller's current membership began (its visibleFromSeq, 14) when the context holds content items before that seq that the caller isn't served (sealed items and what derives from them, or pre-upgrade plaintext messages; 14 §10.2). Membership and other system events alone don't make it non-null. In a 1:1 DM it is non-null only for an account re-added after its own identity change (12 §11.5 item 4). After a reopening (12 §6.4) it is null, and W2's new-account line marks the restart (20 §3.2). The client shows K6 there (20 §5, D-007). Otherwise null, and always in insecure contexts.
purgedThroughSeq integer Every root message with seq ≤ this has been purged (§12); 0 if none.

SystemItem: a timeline item owned by another document, carried in the form of its event.

Member Type Meaning
type string "event".
seq integer The event's seq.
t string The event type, as its owner registered it, for example channel.security_changed (09) or dm.security_changed (12).
ts string The event's ts.
d object The event's payload as its owner defines it, in the form that owner defines for this viewer.

A client renders a SystemItem as its owner and 20 say. It ignores an item whose type or t it doesn't know, apart from counting its seq as covered.

Coverage guarantee. A page proves there are no other visible timeline items in the interval it covers. Let L be the larger of purgedThroughSeq + 1 and the smallest start among the ranges in ranges and grants; nothing visible exists below L. Between ranges, only sealed items inside grants are visible.

  • before=N: from items[0].seq (or from L if hasMore is false) up to N − 1;
  • after=N: from N + 1 up to the last item's seq (or up to headSeq if hasMore is false);
  • newest page: from items[0].seq (or L) up to headSeq;
  • around=N: the union of the two sides by the same rules.

Clients keep a list of covered intervals per context and fill holes with after= requests (gap fill). On every page they drop cached root messages with seq ≤ purgedThroughSeq, and those outside both ranges and grants, except that in a secure context a device keeps items it stored during an earlier membership of the account (cached items below withheldBeforeSeq, §7.5 rule 6).

GET {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/messages?before=4183&limit=3

{
  "items": [
    { "type": "event", "seq": 4180, "t": "member.joined", "ts": "2026-12-04T18:21:40.002Z",
      "d": { "…": "as 09 defines" } },
    { "type": "message", "seq": 4181, "mid": "01938f2f-77aa-7c10-9b2e-0c1d2e3f4a5b", "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
      "carrier": "plain", "sender": { "addr": "bob@b.com", "name": "Bob", "did": "Yx3kP0aL9qR2sT5uV8wZ1A" },
      "createdAt": "2026-12-04T18:21:59.001Z", "content": { "text": "hi" }, "mentionAll": false,
      "editedAt": null, "deleted": null, "reactions": [], "updatedSeq": 4181 },
    { "type": "message", "seq": 4182, "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6", "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
      "carrier": "plain", "sender": { "addr": "alice@a.com", "name": "Alice", "did": "q2bS9xVg3m0yJpQe1vT0Aw" },
      "createdAt": "2026-12-04T18:22:31.512Z", "content": { "text": "Hello", "replyTo": null, "attachments": [] }, "mentionAll": false,
      "editedAt": null, "deleted": null, "reactions": [], "updatedSeq": 4182 }
  ],
  "hasMore": true,
  "headSeq": 4190,
  "ranges": [[1, null]],
  "grants": [],
  "withheldBeforeSeq": null,
  "purgedThroughSeq": 0
}

7.2 One message

GET {base}/v1/contexts/{ctx}/messages/{mid}

Returns the Message object (or tombstone) for a root message. It answers 404 message.target_not_found if mid isn't a root message in this context, isn't visible to the caller (§7.5), has expired or been purged, or its tombstone was dropped. Clients use it to show a reply's parent and to jump to a message: they read its seq, then page with around.

7.3 Reactions of one message

GET {base}/v1/contexts/{ctx}/messages/{mid}/reactions?cursor=<c>&limit=<n>[&key=<k>]

A collection (03 §13.2, cursor paging, limit 1–100, default 50) of ReactionEntry objects for the root message mid, oldest first. key (URL-encoded) filters by normalized key; with it, only plain entries are returned, because the server can't read sealed ones. Clients use key for "who reacted with 👍" on plain reactions, and the unfiltered list to fetch sealed entries beyond the inlined 100.

7.4 The changes feed

GET {base}/v1/contexts/{ctx}/messages?changedAfter=<C>[&through=<T>]&limit=<n>

Returns the visible timeline items whose updatedSeq > C (for a SystemItem, its seq counts as its updatedSeq) and, when through is given, whose seq ≤ T, in ascending updatedSeq order, as a MessagePage. Each change has exactly one seq and affects exactly one item, so these values are distinct and paging is exact: the next request uses the last item's updatedSeq (or seq) as changedAfter, with the same through. When hasMore is false, the client has every change up to headSeq to the items in the requested range.

through lets a client that resyncs ask only for changes to the part of the timeline it already holds; newer items come from the newest page and from gap fill (§7.6).

The server MUST keep enough information to answer for any changedAfter that is the seq of an event less than CHANGES_HORIZON_MIN (30 days) old. It records changesFloorSeq: the highest deletion seq among tombstones it has dropped. If changedAfter < changesFloorSeq, it answers 410 message.changes_expired with data.changesFloorSeq, and the client discards its cache for the context and reloads (§7.6).

Root messages that were purged (§12) don't appear as items; purgedThroughSeq tells the client to drop every cached root message at or below it.

7.5 History visibility

The server decides what each account may read in a context with the rules of the documents that own them, and applies the result to every endpoint of this section, to attachment downloads (§14.4) and to event delivery (§7.6, §8.3).

Context The account may read the durable events with seq s when Owner
Channel Its channel membership is active or needs_encryption, and s lies in one of its visibility ranges. In an insecure channel the ranges cover the whole stored history; in a secure channel they start at the account's current membership, plus the pre-upgrade plaintext for accounts that were members at the upgrade; they close at leaving and at u + 1 for needs_encryption. 09 §7.1, §7.2
DM or group DM It is an active participant (or becomes one by implicit acceptance, 12 §8.7), and s is at or after its joinedSeq. A participant in state left or removed is served no timeline item (12 §6.5). 12 §12.4, §12.5, §6.4, §11.5
Any secure context, in addition A sealed item, or anything else derived from content, with s below the account's visibleFromSeq (the seq at which its current membership began, D-007) is never served, unless one of the account's VisibilityGrants covers it. 14
VisibilityGrant (secure contexts only) A sealed item, and the attachments bound to it, whose s lies in one of the account's VisibilityGrants is served to it outside its ranges or joinedSeq too, while the account is a current member. Plaintext items, membership events and other non-sealed events never are. 14

This document adds these rules:

  1. Visibility is per account, never per device. A user's new device is served the same items from the account's visibleFromSeq and decrypts them through the key archive (D-007, D-054, 08, 14).
  2. Pre-upgrade plaintext (seq ≤ upgradeSeq) follows the channel's visibility ranges: it is served, under K3, only to accounts that were members at the upgrade, unless an admin deleted it (09 §7.1, §12.4). An account whose membership began after the upgrade isn't served it (D-007).
  3. An operation entry (edit, reaction, delete) is visible to an account only if its target's root message is visible to that account. Its event is otherwise delivered with the reduced payload of §8.3. This holds for an operation sequenced after the account joined on a message from before its join, even though the account's keys could decrypt it (§20).
  4. A request for a range entirely outside the caller's visibility gets an empty page with hasMore: false, not an error.
  5. MessagePage ranges carries the caller's channel visibility ranges (09 §7.2), or for a DM or group DM [[joinedSeq, null]] while it is an active participant (an account that has left or been removed is served nothing, 12 §6.5). grants carries its VisibilityGrants, and withheldBeforeSeq its join point when K6 applies (§7.1). In a secure context the server also omits sealed items below visibleFromSeq that no grant covers; clients see those seq values as covered and empty.
  6. Earlier memberships. When a new membership begins in a secure context (a rejoin, a re-add after leaving or after an identity change), the account isn't served items of its earlier memberships again (D-007). A client doesn't delete cached items only because they now lie outside ranges for that reason: what a device stored during an earlier membership stays on that device and is shown above K6 (20 §5). The account's other devices can't fetch it.

Who may post is decided by §4.5, not by this section: a needs_encryption member can still read up to u + 1 but can't post.

Rationale: one source of truth per context type keeps every server consistent. It also gives the behaviour people expect: in insecure contexts rejoining restores what a member had and newcomers see the history; in secure contexts nobody is served content from before their current join without a member's deliberate share (D-007); and a reopened DM never shows a re-registered address the earlier conversation (12 §6.4).

7.6 Live delivery and sync after reconnect

Live. The hosting server emits the events of §8 to sessions subscribed to the context (03). Every subscriber receives every seq (03 §7.2 D4): when a subscriber isn't entitled to an event's full payload under §7.5, the server delivers the envelope with the reduced payload of §8.3. When a resume would start at a position after which the next events aren't visible to the account at all, the server sends session.resync_required with reason access_changed (03 §7.4); individual invisible events are withheld (09 §7.2), never replaced by a resync. Each client deduplicates by mid: the sender's own session receives message.created for its own entry, and the client replaces its pending outbox item (§13) with it.

Applying events. Durable payloads of this document are idempotent (03 §7.2 D8) under this rule: a client applies message.edited, message.deleted, reaction.added and reaction.removed to a cached Message only if the envelope's seq is greater than that Message's cached updatedSeq, and then sets updatedSeq to that seq; otherwise it ignores the event, because the cached object already reflects it (for example a snapshot fetched over HTTP after the event, 03 §2.8). A message.created for a mid it already holds changes nothing except replacing an outbox item. message.purged is applied by dropping everything at or below throughSeq, which is idempotent.

Resume. On reconnect the client sends its last processed seq per context in session.hello resume (03), and the server replays missed durable events.

Resync. When the server sends session.resync_required for a context (03 §7.5), or the client has no live socket history, the client MUST:

  1. Load the newest page (no paging parameter) and show it at once (03 §7.5). Record its interval as covered. Let H be its headSeq.
  2. If it has a cache for the context with a sync cursor C (the highest seq whose effect on message state it has applied) and T (the highest seq of a timeline item it holds): request changedAfter=C&through=T and follow pages until hasMore is false; apply every item (insert, replace, or remove if tombstoned and the client hides tombstones); drop cached root messages as §7.1 says (purged, or outside both ranges and grants, keeping a secure context's items from an earlier membership). Then set C to H.
  3. If step 2 answers 410 message.changes_expired, or the client has no cache: discard the cache apart from the page of step 1, and set C to H.
  4. The interval between T and the newest page is a hole. Fill it with before= requests from the newest page as the user scrolls back, or with after= requests in the background (gap fill).
  5. In a secure context, decrypt as keys allow. While a user's own new device restores keys from the key archive, or messages shared with the user load, K4 sits above the waiting messages (14, 20 §5).

The client MAY resync several contexts in parallel, at most 4 at once per server.

Rationale: showing the newest page first means a user coming back after a long absence sees the present at once, and through bounds the changes feed to what the client already holds, so catching up costs requests in proportion to what changed in the cached part, not to everything that was said while the user was away. The 30-day horizon keeps the server's bookkeeping bounded.

8. Events

8.1 Event registrations

Registered in the format of 03 §11.2. Every type here is carried on the client WebSocket only (none is an S2S event) and travels from server to client.

Type Class Stream Targeted Timeline item Recipients d
message.created durable The context No Yes Every subscriber; full payload for those who can see it (§7.5), otherwise §8.3 Message object without ctx and seq (§5.2)
message.edited durable The context No No As message.created EditEvent (§8.2)
message.deleted durable The context No No As message.created DeleteEvent (§8.2)
message.purged durable The context No No Every subscriber PurgeEvent (§8.2)
reaction.added durable The context No No As message.created ReactionEntry without seq (§5.3)
reaction.removed durable The context No No As message.created ReactionRemovedEvent (§8.2)
read.updated durable me (the account stream of this server, 03 §7.1) No No The account's own sessions on this server ReadState (§9.1)
typing.started ephemeral The context Yes: sessions of accounts other than the typist that can see the context — §10.2 TypingEvent (§10.2)
typing.stopped ephemeral The context As typing.started — §10.2 TypingEvent (§10.2)
presence.updated ephemeral me Yes: sessions entitled to see it (§11.4) — §11.4 Presence (§11.3)
presence.snapshot ephemeral The context Yes: the session that just subscribed — §11.5 PresenceSnapshot (§11.5)

Durable events carry their stream's seq (00 §7.4, 03 §7.2). Ephemeral events carry no seq and are never replayed. A receiver ignores unknown event types and still advances its position past a durable one (03 §11.2). This document defines no attachment.* events in v1; uploads are request and response only. Typing is transient and never needed after reconnecting; presence is re-sent as a snapshot after subscribing (§11.5) and one's own presence is readable over HTTP (§11.2), as 03 §7.2 E4 requires.

8.2 Payloads

EditEvent (message.edited):

Member Type Required Meaning
target string Yes The edited root message.
mid string Yes The edit entry's mid.
carrier string Yes plain or sealed.
sender Sender Yes The editing account and device.
createdAt string Yes The edit's server timestamp (the new editedAt).
content EditContent plain The edit.
sealed SealedMessage sealed The edit.
mentions array of string sealed The edit's validated hint.
mentionAll boolean Yes The edit's validated mentionAll (§4.4).
attachmentIds array of string sealed, when the target had bound attachments The remaining IDs.

A receiver that applies a sealed edit discards the root's decrypted content it held and keeps the edit's (§5.5).

DeleteEvent (message.deleted):

Member Type Required Meaning
target string Yes The deleted root message.
by string Yes author or moderator. A receiver treats an unknown value as moderator.
mid string When by is author The delete entry's mid.
deletedAt string Yes When.

The receiver removes the root message, its edit, all its reactions and its cached attachments.

ReactionRemovedEvent (reaction.removed):

Member Type Required Meaning
target string Yes The removed reaction entry's mid.
message string Yes The root message it was on.
by string Yes author or moderator. A receiver treats an unknown value as moderator.
mid string When by is author The delete entry's mid.

PurgeEvent (message.purged):

Member Type Meaning
throughSeq integer Every root message with seq ≤ throughSeq, and everything attached to it, is gone.
reason string retention (§12), pre_upgrade_deleted (09, D-057) or admin. A receiver treats an unknown value as admin.

Example:

{
  "v": 1,
  "t": "reaction.removed",
  "id": "01938f40-aaaa-7bbb-8ccc-dddddddddddd",
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "seq": 4191,
  "ts": "2026-12-04T18:30:00.000Z",
  "d": {
    "target": "01938f36-0000-7a00-8b00-000000000001",
    "message": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
    "by": "author",
    "mid": "01938f37-0000-7a00-8b00-000000000002"
  }
}

8.3 Reduced payloads and tombstone forms

03 §7.2 D4 requires every subscriber to receive every seq, and D7 lets a replay carry the owner's tombstone form. This section defines both for the durable events of §8.1.

Reduced payload (live delivery or replay to a subscriber that may not see the event under §7.5: for example a sealed message.created below its visibleFromSeq, or an edit, reaction or delete whose target's root message it can't see):

{ "withheld": true }

The envelope keeps its t, ctx, seq, id and ts. Nothing else is revealed: no mid, sender or content.

Tombstone forms on replay (the content has since been deleted, moderated, purged or expired):

Event d on replay
message.created of a root message now deleted The tombstone Message object (§5.4), without ctx and seq.
message.created of a sealed root message since edited The current Message object (with edit, without the deleted root sealed, §6.2), without ctx and seq.
message.created of a root message now purged or expired { "withheld": true }.
message.edited, reaction.added whose content has since been deleted (a later edit replaced it, the reaction was removed, or the root message was deleted, purged or expired) { "target": <the event's target>, "withheld": true }.
message.deleted, reaction.removed, message.purged Unchanged.

A client that receives withheld: true advances its position P past the event (03 §7.3) and does nothing else. The later events of the same stream, or a fresh fetch, carry the current state.

Content-withheld form. Only inside a dm.request sent to a secure home server for an insecure DM (12 §8.2): the Message object of a plain message without content, with "contentWithheld": true. A receiver shows it as 12 §10.4 says ('Accept to see this message') and fetches the content through §7 after Accept. This form never appears on the timeline API or the client WebSocket, and is distinct from the reduced payload { "withheld": true } (03 §7.2).

Rationale: a reduced payload keeps gap detection a single integer comparison (03 §7.2) without telling anyone what they may not read, and the tombstone forms mean the server never has to keep deleted ciphertext just to replay it.

9. Read state

Read state is one number per account per context: the highest seq the user has read. It is stored by the hosting server, private to the account, and shared by all the account's devices.

9.1 ReadState object

Member Type Meaning
ctx string The context.
readSeq integer ≥ 0 Everything with seq ≤ readSeq counts as read. 0 means nothing read.
updatedAt string or null When readSeq last changed.
headSeq integer The context's latest seq (03 §13.1).
lastMessageSeq integer seq of the newest visible, non-deleted root message, or 0. Items visible only through a VisibilityGrant (14) don't count.
unreadCount integer 0–1,000 Visible, non-deleted root messages with seq > readSeq not sent by this account, capped at 1,000. Items visible only through a VisibilityGrant (14) don't count.
unreadCapped boolean true if the true count exceeds 1,000 (clients show "999+").
mentionCount integer 0–1,000 Among those, the ones that mention this account: by mentions, by a validated mentionAll, or by a reply ping. In secure contexts this comes from the mention hints (§4.4). Capped at 1,000.

9.2 Endpoints

GET {base}/v1/contexts/{ctx}/read
PUT {base}/v1/contexts/{ctx}/read
GET {base}/v1/me/read-states?cursor=<c>&limit=<n>

GET …/read returns the caller's ReadState for one context. PUT takes:

Member Type Required Meaning
readSeq integer ≥ 0 Yes The new read position. Values above headSeq are lowered to headSeq.
markUnread boolean No (default false) If false, the stored value becomes max(old, readSeq). If true, it becomes readSeq even if lower ("Mark as unread").

It returns the new ReadState. When the stored value changes, the server emits read.updated (d: the ReadState) on the account stream to every session of the account on this server, including the caller's. When an account posts a root message, the server sets its readSeq to at least that message's seq and emits read.updated.

All read states at once. GET {base}/v1/me/read-states returns, as a collection (03 §13.2), the caller's ReadState for every context on this server that the caller can currently see (§7.5): the channels it can view and the DMs and group DMs hosted here in which it participates. The order is by ctx, stable. limit is 1 to 1,000, default 200. A client calls it at start-up and after a resync of the me stream, so it can show every unread badge on a server with one or a few requests instead of one per context; after that, read.updated and session.heads (03 §5.7) keep it current.

00 §7.3 lists GET /v1/me/read-states with owner 11. Rationale: a community with hundreds of channels would otherwise need hundreds of requests per server to show unread badges at start-up.

PUT {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/read

{ "readSeq": 4190 }
{ "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "readSeq": 4190, "updatedAt": "2026-12-04T18:31:12.400Z",
  "headSeq": 4191, "lastMessageSeq": 4188, "unreadCount": 0, "unreadCapped": false, "mentionCount": 0 }

9.3 Client behaviour

  1. A client advances readSeq to the seq of the newest root message that has been on screen in a focused window, at most once every 2 s per context, and once more when the user leaves the context.
  2. A secure client recomputes mentions from decrypted content when it opens a context and uses its own count from then on; mentionCount is only the server's estimate.
  3. Clearing badges and notifications shown by the home server is described in 19.
  4. Read state is never shown to other people in v1. There are no read receipts.

Rationale: one monotonic number is cheap to store and sync and enough for unread markers on every device. Read receipts would add a metadata leak and a social pressure that the product doesn't need in v1.

10. Typing

10.1 Endpoint

POST {base}/v1/contexts/{ctx}/typing
Member Type Required Meaning
typing boolean Yes true: the user is typing. false: the user stopped without sending.

The server answers 204 No Content. typing: true requires what posting a message requires (§4.5 steps 1 and 4 to 8, including send_messages), and is refused otherwise with the same codes. typing: false requires only steps 1 and 4 and is never refused because of a timeout (10 §6.3 check a).

10.2 Server behaviour

  1. On typing: true the server emits typing.started to subscribed sessions of every other account that can see the context, and remembers that the account is typing for TYPING_TTL (8 s).
  2. It accepts at most one typing: true per account per context every 3 s; it answers 204 to excess requests and doesn't emit for them.
  3. On typing: false, if the account is marked typing, it emits typing.stopped and clears the mark.
  4. When the account's message entry is accepted, it clears the mark without emitting typing.stopped; receivers clear it themselves on message.created.
  5. When TYPING_TTL expires without a refresh, the server clears the mark and MUST NOT emit typing.stopped. Receivers expire it themselves (§10.3 rule 2), because ephemeral events may be dropped anyway (03 §7.2 E3).

TypingEvent (typing.started, typing.stopped):

Member Type Meaning
sender Sender The typing account (did is the typing device).
expiresInMs integer Only on typing.started: 8,000.

10.3 Client behaviour

  1. Send typing: true on the first change to a non-empty draft, then again every TYPING_REFRESH (6 s) while the draft keeps changing. Send typing: false when the draft becomes empty or the user leaves the context without sending.
  2. Show a typing account until its typing.stopped, its message.created, or 10 s after its last typing.started.
  3. Show "Alice is typing…", "Alice and Bob are typing…", or "Several people are typing…" for three or more.
  4. The user setting "Show when I'm typing" (AccountVault setting typing_indicators, 08 §8.6.4: boolean, default true; for an insecure account, which has no AccountVault, stored on the device) stops the client calling this endpoint at all when it is false.

Typing is visible to the hosting server in every mode (00 §5.4).

11. Presence

11.1 Model

Presence says whether a person is around. It is per server: each server knows only what that account's own sessions on that server tell it. Presence is never sent server to server.

  • A client that is connected to several servers (its home server and the remote servers whose contexts it uses, D-004) sets its presence on each of them.
  • A server derives each account's effective status from the account's chosen status and the state of its sessions on that server.
  • Limit, stated plainly: "online" on a server means "has an app open that is connected to this server". A person whose phone is connected only to their home server shows as offline on another server, for example to a DM partner whose DM is hosted there, even while they are active elsewhere. Clients SHOULD keep their event WebSocket open to every server whose contexts the user has open while the app is in the foreground, so that this is rare, and the presence copy of 20 SHOULD NOT imply more than this.
Chosen status Meaning for the user
online Normal. Becomes idle automatically when every connected session is idle.
idle Shown as away.
dnd Do not disturb. Shown as such; also used by 19 to hold back pushes.
invisible Appear offline to everyone.

Effective status, as others see it:

Condition (evaluated in order) Effective status
No session of the account has had an open event WebSocket on this server for the last OFFLINE_GRACE (30 s) offline
Chosen invisible offline
Chosen dnd dnd
Chosen idle, or every connected session reports idle: true idle
Otherwise online

A receiver treats an unknown effective status as online; a server refuses an unknown chosen status with 400 core.invalid_request.

11.2 Own presence: /v1/me/presence

GET {base}/v1/me/presence
PUT {base}/v1/me/presence

OwnPresence (the GET response and the PUT response):

Member Type Meaning
status string Chosen status: online, idle, dnd or invisible. Default online for a new account.
statusText string or null Custom status, at most MAX_STATUS_CHARS (128) Unicode scalar values, no line breaks.
statusEmoji string or null One emoji, as for reaction keys (§3.7.2).
clearAt string or null When the server clears statusText and statusEmoji.
idle boolean The calling session's idle flag.
effective string The effective status others currently see on this server.
updatedAt string When the account-level members last changed.

PUT body:

Member Type Required Meaning
status string No (absent: unchanged) Chosen status.
statusText string or null No (absent: unchanged) null clears it.
statusEmoji string or null No (absent: unchanged) null clears it.
clearAt string or null No (absent: unchanged) null for no automatic clearing; otherwise a future time at most 30 days ahead.
idle boolean No (absent: unchanged) Sets the calling session's idle flag only. A session's flag is false when its event WebSocket opens.

A body that contains any of status, statusText, statusEmoji or clearAt MUST contain all four; otherwise 400 core.invalid_request. A body with only idle changes only the calling session's flag and never the account-level members.

The account-level members (status, statusText, statusEmoji, clearAt) are last-write-wins across the account's sessions. The server applies clearAt within 60 s of the time given. Up to 10 PUTs per session per minute are accepted; more get 429 core.rate_limited.

PUT {base}/v1/me/presence

{ "status": "dnd", "statusText": "In a meeting until 3", "statusEmoji": "📅", "clearAt": "2026-12-04T15:00:00.000Z", "idle": false }

11.3 Presence object

What other people see, carried by presence.updated and presence.snapshot:

Member Type Meaning
addr string Canonical address.
name string Display name (01).
status string Effective status: online, idle, dnd or offline.
statusText string or null null whenever status is offline.
statusEmoji string or null null whenever status is offline.
updatedAt string When this presence last changed.

The server emits presence.updated when any member of the Presence object changes. It never reveals the chosen status invisible, idle flags of single sessions, device counts or last-seen times.

11.4 Who sees presence

On a given server, account B may see account A's presence only if both are active members of the server's community (09), or both are participants of a DM or group DM hosted on that server that both have accepted (12). Nobody else can see it, and there is no endpoint to look up an arbitrary account's presence.

Delivery of presence.updated for A to a session of B:

  1. MUST happen while the session is subscribed (03) to a DM or group DM shared with A;
  2. SHOULD happen while the session is subscribed to a channel that A can see, if the community has at most 1,000 active members;
  3. MAY be limited or omitted otherwise. Clients MUST tolerate missing presence and then show none, never "offline".

A's own sessions also receive presence.updated for A, which is how the user's other devices learn of a status change.

11.5 Presence snapshots

When a session subscribes to a context (03), the server SHOULD send it one presence.snapshot:

Member Type Meaning
items array of Presence Accounts with access to the context whose effective status isn't offline, at most PRESENCE_SNAPSHOT_MAX (1,000), in no particular order.
truncated boolean true if more existed.

The snapshot is an ephemeral event on that context; later changes arrive as presence.updated.

11.6 Client behaviour

  1. A client sets idle: true after IDLE_AFTER (10 min) without user input on that device, and idle: false on the next input. A mobile app that keeps its WebSocket open in the background sets idle: true when backgrounded. It sets the flag with a body that contains only idle.
  2. The home server holds the chosen status for all devices. At start-up a client reads GET {home}/v1/me/presence and sends the same status, statusText, statusEmoji and clearAt to every other server it connects to. When the user changes status, the client sends PUT to the home server first, then to every other server it is connected to. A device that receives presence.updated for its own address from its home server re-applies the change to the other servers it is connected to. These copies omit idle, so they never change a session's idle flag.
  3. Clients show a coloured dot (online, idle, do not disturb) and nothing for offline. The status picker explains in one line that the custom status is visible to everyone who shares a community or conversation with the user, on every server they use.
  4. Bots set presence like any client; a connected bot is online.

Rationale: making presence per server, driven by the client's direct connections (D-004), means no server learns about the user's activity on other servers, and nothing about presence needs federation.

Proposed decision: Presence is per server and never federated: each server derives effective status from the account's own sessions there plus a chosen status the client copies from its home server. Rationale: no presence fan-out between servers and no cross-server activity leak.

12. Retention

12.1 Source of the retention period

The retention period R of a channel is retentionDays × 86,400,000 ms, from the channel's retentionDays setting (09 §6.1, §7.3); null means unlimited. DMs and group DMs have unlimited retention in v1. When R is unlimited nothing in this section applies.

12.2 What expires

A root message expires when createdAt + R ≤ now. With it expire its edits, its reaction entries, its tombstone if it has one, and every attachment and thumbnail bound to it, whatever their own times. Retention doesn't cover membership events, MLS handshakes (13), HistoryShares (14), the audit log (10), or copies kept in reports (10).

Because createdAt doesn't decrease as seq increases (§4.5), the expired root messages of a context are always every root message with seq ≤ some value. The server tracks this value as purgedThroughSeq.

12.3 Server duties

  1. Stop serving at expiry. From the moment a root message expires, the server MUST NOT return it, its operations or its attachments through any endpoint, even if it hasn't deleted them yet.
  2. Delete promptly. It MUST delete expired content, SealedMessages, attachment blobs and tombstones within RETENTION_PURGE_MAX (24 h) of expiry, and remove them from backups within its normal backup rotation, which SHOULD be at most 30 days.
  3. Tell clients. After deleting, it advances purgedThroughSeq and emits message.purged with reason: "retention", at most once per hour per context (coalescing several sweeps into one event).
  4. Keep the minimum. It keeps only the mid registry entries of §4.6 for MID_MEMORY_MIN, so a late resend from an outbox doesn't recreate an expired message.
  5. Secure contexts. The server deletes ciphertext; it doesn't need keys to do so. History keys stay in members' key archives (08); without ciphertext they reveal nothing. What happens to HistoryShares and VisibilityGrants whose items have all expired is decided by 14.

12.4 Changing the period, and other purges

  • Shortening R applies to existing messages at the server's next sweep, within 24 h.
  • Lengthening R, or making it unlimited, never brings back content already deleted.
  • When an admin deletes pre-upgrade history during a channel upgrade (09 §10.4 S6, D-057), the server stops serving every root message with seq ≤ upgradeSeq (and everything attached to it) at once, advances purgedThroughSeq and emits message.purged with reason: "pre_upgrade_deleted" at once. Physical deletion follows §12.3 rule 2, which meets 09's "within 30 days".
  • An operator-initiated purge of a whole context prefix uses reason: "admin".

12.5 Client duties

  1. A client MUST stop showing a root message once it has expired by the channel's R and its createdAt, and on message.purged for every root message with seq ≤ throughSeq.
  2. It SHOULD delete from its own storage the content, decrypted plaintext, and cached attachments of expired messages. It MUST NOT delete files the user explicitly saved outside the app.
  3. When R is set, the channel header or info screen shows it in plain words, for example "Messages are deleted after 30 days. People in the channel can still keep copies." Clients MUST NOT describe retention as a guarantee that no copies remain.

Rationale: retention is server-enforced deletion. In secure contexts it can't be cryptographically enforced on other members' devices, and the copy says so.

Proposed decision: Retention is enforced as a prefix purge of the timeline (purgedThroughSeq), announced by message.purged; DMs have unlimited retention in v1. Rationale: a monotonic watermark is simple to enforce, sync and test.

13. The client outbox

Every entry a user creates (messages, edits, reactions and deletes) goes through the outbox, so nothing the user wrote is lost while a hosting server is down, the network drops, or encryption keys are still being set up (00 HP-9).

13.1 Storage

  1. The outbox MUST persist across app restarts (a database on native platforms; IndexedDB on the web) and keep each item for up to OUTBOX_MAX_AGE (7 days) after it was queued.
  2. In a secure context the outbox holds plaintext. It MUST be stored with the same protection as the client's other message data (08) and deleted at sign-out and when the device is revoked.
  3. On a shared computer (D-065, keys in memory only), the outbox for secure contexts is in memory only.

13.2 Outbox item

Field Meaning
mid Generated when the user creates the entry (§2.4). Never changes.
ctx, server Where it goes.
kind, target As in PostEntry.
content The content object (plaintext).
composedMode The context's security mode (insecure or secure) when the user created the entry. An entry composed secure never leaves as plaintext without a user action (§4.7).
lastBody The exact PostEntry last sent, if any.
attempted Whether any request was sent whose outcome is unknown or failed in transit.
queuedAt When the user created it.
state §13.3.
lastError The last problem object received, if any.

13.3 States

State Meaning Entered when
uploading Attachments are uploading (§14.2). A message with files is created.
queued Ready, waiting its turn. Created without files; uploads finished; the user taps "Retry".
sending A request is in flight. Its turn comes.
waiting_for_server The hosting server can't be reached or asked the client to wait. Network error, timeout (30 s without response), HTTP 502, 503 or 504, core.unavailable, core.internal, core.idempotency_conflict with reason: "in_progress", and any other problem with retryable: true not listed for another state. (On core.rate_limited and moderation.slow_mode the item stays sending and waits as §13.4 rule 2 says.)
waiting_for_keys Secure context: encryption state isn't ready, and the client fixes it by itself. No MLS state for the group yet; mls.commit_required (13); sealed.wrong_epoch, sealed.not_in_group (14); mls.group_not_found, mls.generation_retired with a non-null nextGeneration, mls.fork_detected, and mls.not_member with reason no_leaf and removedFor null, evicted, stale_leaf or identity_changed (13; the client resolves each as 14 §4.7 step 11 says); dm.upgrade_in_progress (12); channel.plaintext_rejected or sealed.required while the account is secure and the device enrolled (§4.7).
waiting_for_action Only a person can unblock it; the context shows the surface that asks for it. security.account_required or security.upgrade_required (G1); security.device_not_enrolled (G2); a blocking W2 for a verified contact in this DM, not yet accepted (the client doesn't send at all); dm.encryption_pending (12: another participant must turn on encryption); moderation.timed_out (10); moderation.new_member_restricted (10, until data.until); member.pending (09, until the request is approved).
sent Acknowledged (201). Removed from the outbox once message.created (or the matching event) has been seen or 60 s have passed. EntryAck received; or, for a delete, message.target_deleted or sealed.ref_invalid with reason: "deleted"; or, for a reaction, reaction.already_exists.
failed Won't succeed without the user. sealed.not_secure (§4.7); mls.generation_retired with nextGeneration null (handled as sealed.not_secure, 14 §4.7 step 11); mls.not_member with reason removal_pending, or no_leaf with any other removedFor; dm.closed with no successor (below); any other problem with retryable: false; OUTBOX_MAX_AGE reached.

Transitions out of waiting_for_server and waiting_for_keys go to sending when the client retries (§13.4). An item in waiting_for_action goes back to queued by itself as soon as the cause is gone: G1 or G2 completed (00 §4.12.2: the interrupted action resumes by itself), W2 accepted, the membership request approved, the DM's dm.state_changed or dm.security_changed received, or the timeout's or restriction's until passed. It is then re-encoded as §4.7 says, with the same mid. Out of failed, only the user moves an item: "Retry" → queued, "Delete" → removed.

Membership refusals. On channel.join_required the client joins the channel silently (POST /v1/channels/{id}/join, 09 §4.5, §9.5) and resends the item with the same mid; the item stays sending meanwhile. On member.pending the item is waiting_for_action until the request is approved. member.not_member, moderation.banned and dm.not_participant make the item failed.

Closed DMs. On dm.closed the client looks for the closed DM's successor (12 §13.3), creating it if 12 says so. If there is one, it moves every queued item of the closed DM to the successor, in order, with the same mids, re-encoded for the successor's mode; but an item whose composedMode is secure never moves to an insecure successor automatically: it becomes failed (§4.7). Without a successor the item is failed.

Uploading. In uploading the client runs the upload of §14.2 for each file:

Problem What the client does
Network error, timeout, 5xx, core.unavailable Retry that step with the backoff of §13.4 rule 2. The item shows "Waiting for b.com".
The upload URL expired (the PUT couldn't start before upload.expiresAt, or the storage answers 403 after it) Delete the upload and start again at §14.2 step 1.
attachment.quota_exceeded, core.rate_limited Wait retryAfterMs, then retry.
attachment.size_mismatch or attachment.hash_mismatch at completion Upload the bytes once more; on a second mismatch the item becomes failed.
attachment.too_large, crypto.malformed, attachment.blocked, missing attach_files (403 core.forbidden) failed, with the reason.
attachment.expired when the entry is posted Upload the files again (new IDs, and in a secure context new keys) and rebuild the content (§13.4 rule 3).

13.4 Sending rules

  1. Order. Items of one context are sent in the order created, one request in flight per context. A failed item doesn't block later ones. An item in waiting_for_server, waiting_for_keys or waiting_for_action blocks later items of the same context. Different contexts are independent.
  2. Backoff. After a failure that leaves the item waiting, retry after 1, 2, 4, 8, 16, 30 and 60 s, then every 60 s, each with ±20 % random jitter, and never sooner than a retryAfterMs or Retry-After the server gave. Retry at once when the event WebSocket to that server reconnects, when the network changes, or when the user taps "Retry now".
  3. Same mid, same body. Every attempt uses the same mid. The client resends lastBody byte for byte unless re-encoding is required:
    • the secure group moved to a newer epoch, or 14 reports sealed.wrong_epoch: re-seal the same content under the current epoch, with the same mid (14 §4.7 step 10), only when the epoch has changed; a retry in the same epoch resends the stored SealedMessage bytes (04 §9.6);
    • the context became secure (§4.7): re-encode as a SealedMessage with the same mid;
    • the context became insecure: never automatically (§4.7);
    • attachment.expired for an upload: re-upload the files, which gives new IDs, and rebuild the content. The server's idempotency rule (§4.6) makes every one of these safe.
  4. Changes to unsent items. If the user edits an item that has never been attempted, the client rewrites its content in place. If the user deletes such an item, the client removes it. If the item has been attempted, the edit or delete is queued behind it as a normal entry.
  5. Waiting for keys. The client resolves the cause itself (13 and 14: commit pending proposals, join or resync by external commit, bootstrap a DM group as 12 §11.4 says, restore history keys from the key archive). It never prompts.

13.5 What the user sees

Outbox items appear at the bottom of the timeline, after all acknowledged messages, in creation order. RECOMMENDED copy (20 may refine it; none of it is a security warning, and none of it adds to the catalogue of 00 §4.12):

State Presentation
uploading The message with a progress bar per file and "Cancel".
sending The message slightly faded. After 2 s, a small clock icon.
waiting_for_server Clock icon and "Waiting for b.com — will send when it's back", naming the context's domain. One line per context, not per message.
waiting_for_keys Clock icon and "Getting encryption ready…".
waiting_for_action Clock icon and "Will send when you're ready", next to the context's own G1, G2 or W2 surface, or the status line of 12 ("You can write again once Bob turns on encryption."), or "You can send again at 15:30" for a timeout, or "You can send files at 15:30" for a new-member restriction.
sent Normal.
failed A neutral 'not sent' marker (no security or danger styling, 20 §2.1 rule 3) and "Not sent. Tap to retry or delete.", with a short reason where one exists: "This message is too long", "This file is too large", "You can't send messages here".

A mobile client that has a failed item while in the background SHOULD show one local notification per context: "A message to Lobby wasn't sent".

Rationale: one serial queue per context keeps the order people expect, and resending the same mid means the user never sees a message twice, whatever happened to the network. Separating "waiting for the server", "waiting for keys" and "waiting for you" means a message is marked as failed only when nothing will fix it by itself.

14. Attachments

Files (D-011) are uploaded to the hosting server of the context they are posted in, as separate blobs, before the entry that references them. In a secure context the client encrypts every file and thumbnail with its own random key before upload, and the key travels only inside the SealedMessage (SM-6).

14.1 Attachment object

Member Type Meaning
id string UUIDv7, generated by the server.
ctx string The context it was uploaded to. It can be bound only to an entry in this context.
purpose string file or thumbnail. Always file in a secure context (§14.2). A receiver treats an unknown value as file.
state string pending (created, bytes not verified), uploaded (verified, not yet referenced), bound (referenced by a root message) or deleted. A receiver treats an unknown value as deleted.
blobBytes integer Exact size of the blob in bytes.
mime string Insecure: the declared media type. Secure: always application/octet-stream.
sha256 string base64url SHA-256 of the blob bytes.
uploader string Canonical address of the uploading account.
createdAt string When the upload was created.
expiresAt string or null While pending or uploaded: createdAt + UPLOAD_PENDING_TTL (24 h). Otherwise null.
mid string or null The root message it is bound to, when bound.

14.2 Upload

Step 1: create the upload.

POST {base}/v1/contexts/{ctx}/attachments
Member Type Required Meaning and constraints
purpose string No (default file) file or thumbnail. In a secure context it MUST be file, for thumbnails too, so the server can't tell which blobs are previews of images or videos; thumbnail there is refused with 400 core.invalid_request.
blobBytes integer Yes Size of the blob that will be uploaded. Limits in §14.6.
mime string Yes Insecure: the file's media type. Secure: MUST be application/octet-stream.
sha256 string Yes base64url SHA-256 of the blob bytes.

The server requires what posting a message with attachments requires (§4.5 steps 1 and 4 to 8, with attach_files (10) instead of send_messages) and checks §14.6. It answers 201 Created:

Member Type Meaning
attachment Attachment The new object, state: "pending".
upload object Where to send the bytes.
upload.url string An HTTPS URL. Either {base}/v1/contexts/{ctx}/attachments/{id}/content, or a pre-signed URL of the server's object store.
upload.method string Always PUT.
upload.headers object Header names and values the client MUST send unchanged (for example a checksum header the object store verifies). May be empty.
upload.expiresAt string The latest time at which the PUT may start, at most UPLOAD_URL_TTL (10 min) after creation. A pre-signed URL outside {base}/ is a capability URL (03 §3.2 item 1): at least 128 bits of randomness, bound to this one pending blob, never logged.
POST {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/attachments

{ "purpose": "file", "blobBytes": 524288, "mime": "application/octet-stream", "sha256": "n4bQgYhMfWWaL-qgxVrQFaO_TxsrC4Is0V1sFbDwCgg" }
HTTP/1.1 201 Created

{
  "attachment": {
    "id": "01938f31-0a0b-7c0d-8e0f-101112131415",
    "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
    "purpose": "file", "state": "pending", "blobBytes": 524288, "mime": "application/octet-stream",
    "sha256": "n4bQgYhMfWWaL-qgxVrQFaO_TxsrC4Is0V1sFbDwCgg", "uploader": "alice@a.com",
    "createdAt": "2026-12-04T18:20:00.000Z", "expiresAt": "2026-12-05T18:20:00.000Z", "mid": null
  },
  "upload": {
    "url": "https://chat.b.com/server/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/attachments/01938f31-0a0b-7c0d-8e0f-101112131415/content",
    "method": "PUT",
    "headers": {},
    "expiresAt": "2026-12-04T18:30:00.000Z"
  }
}

Step 2: send the bytes. The client sends PUT upload.url with the blob as the body, Content-Type: application/octet-stream, Content-Length: blobBytes and every header in upload.headers. It MUST send its Authorization header only if upload.url starts with {base}/, and never to any other URL. The server's own upload endpoint (PUT {base}/v1/contexts/{ctx}/attachments/{id}/content) accepts only the uploader's session and answers 204. If the PUT can't start before upload.expiresAt, or fails after it, the client deletes the upload and starts again at step 1. Uploads aren't resumable in v1.

A pre-signed upload URL outside {base}/ MUST answer CORS as 00 §7.3 does: Access-Control-Allow-Origin: *, and a preflight that allows PUT and every header named in upload.headers plus Content-Type. A server whose object store can't do this MUST give its own upload endpoint as upload.url. Web clients (D-010) depend on it.

Step 3: complete.

POST {base}/v1/contexts/{ctx}/attachments/{id}/complete

The server checks that the stored blob is exactly blobBytes long (else 422 attachment.size_mismatch) and that its SHA-256 equals sha256 (else 422 attachment.hash_mismatch). On a mismatch it discards the bytes and the upload stays pending, so the client can upload again. In a secure context the server SHOULD also check the SVF1 structure it can see without the key (04 §10.7: the magic, the length rules) and refuse a blob that fails with 400 crypto.malformed (04). On success the state becomes uploaded and the server returns the Attachment. Completing an uploaded attachment again returns it unchanged. In an insecure context the server MAY apply a content policy (malware scanning, blocked types) at this step and refuse with 403 attachment.blocked.

Step 4: reference it. The client posts the entry (§4): in an insecure context through content.attachments[].id and thumb.id; in a secure context through attachmentIds and the encrypted AttachmentRefs. Accepting the entry binds the attachments (§14.5).

Cancel. DELETE {base}/v1/contexts/{ctx}/attachments/{id} by the uploader removes a pending or uploaded attachment (204). A bound attachment can't be deleted this way (409 attachment.already_bound); it goes away with its message.

14.3 Encryption in secure contexts

Every file and every thumbnail in a secure context is encrypted with SVF1 (04 §10), under its own file key. For each one, the sending client:

  1. generates a fresh 32-byte file key K_file (04 §10.2). A key is used for exactly one blob and never reused, including when the same file is sent again;
  2. computes sha256 of the file bytes for the AttachmentRef or ThumbnailRef;
  3. encrypts the file with SVF1 (04 §10.5) under K_file. The blob is exactly the SVF1 output: the 43-byte header, then the segments of the framed and padded file. SVF1 applies the padding buckets itself (04 §10.3);
  4. uploads the blob with purpose: "file" and mime: "application/octet-stream", and puts key, size, sha256, name, mime and the other members in the encrypted AttachmentRef or ThumbnailRef.

A receiving client:

  1. downloads the blob (§14.4);
  2. decrypts it with SVF1 (04 §10.6), which checks the key commitment, every segment's tag and the final-segment flag, and removes the framing and the padding;
  3. checks that the output is exactly size bytes long and that its SHA-256 equals sha256;
  4. on any failure, shows the generic attachment failure (ST.file_failed, copy in 20 §14.3) with its retry action. This is never a security warning (D-055). 04 §10.6 says what a client may do with segments that verified before a failure.

Thumbnails. For images and videos the sending client SHOULD make a thumbnail (the image, or a frame of the video, scaled to at most THUMB_MAX_PX (512 px) on the longer side, as WebP, JPEG or PNG, at most THUMB_MAX_BYTES (256 KiB)) and upload it as its own attachment: with purpose: "thumbnail" in an insecure context, and with purpose: "file" in a secure one, where it is encrypted exactly like a file with its own file key and its ThumbnailRef carries that key. In a secure context the server can't check the thumbnail limits; a receiving client ignores a thumbnail whose size or dimensions exceed them. Receivers download the thumbnail first and the full file only when it is opened or, for images within 2 MiB, automatically on Wi-Fi.

Metadata. In both modes a client MUST remove location data (EXIF GPS and equivalent) from photos and videos before upload, unless the user has turned this off in settings.

Rationale: a random key per blob means a file key revealed in a report (D-040) opens only that file. SVF1's key commitment stops one blob from decrypting under two keys, and the signed sha256 inside the SealedMessage pins the exact file content to the sender's signature, so a sender can't make one blob show different files to different readers and a reporter can't swap the file. Separate thumbnail blobs let phones show previews without downloading 25 MiB files.

14.4 Download

GET {base}/v1/contexts/{ctx}/attachments/{id}
GET {base}/v1/contexts/{ctx}/attachments/{id}/content

The first returns the Attachment object; the second returns the blob.

Access. A bound attachment may be fetched by any account that can see the root message it is bound to (§7.5), including through a VisibilityGrant (14). A pending or uploaded attachment may be fetched only by its uploader. Anything else, including a deleted, expired or purged attachment, or one in another context, answers 404 attachment.not_found.

Delivery. The server answers either:

  • 200 with the blob. It MUST support single-range Range requests (RFC 9110 §14) and SHOULD send ETag set to the quoted sha256 value; or
  • 302 or 307 to a short-lived capability URL that needs no Authorization, contains at least 128 bits of unguessable randomness, is bound to this blob, and expires within DOWNLOAD_URL_TTL (10 min). It MUST support single-range Range requests, MUST serve the response headers listed below, and MUST answer CORS as 00 §7.3 does (Access-Control-Allow-Origin: *, and Range allowed in a preflight), so that web clients can follow the redirect with fetch(). A server whose object store can't do all of this MUST serve blobs itself.

Clients MUST NOT send their Authorization header to a redirect target outside {base}/. Web clients fetch blobs with fetch() and show them through blob: URLs; they never put a session token in a URL (03).

Response headers for every blob, whether served by the server itself or from a capability URL, in both modes:

  • Content-Type: in an insecure context, the stored mime if it is one of image/png, image/jpeg, image/gif, image/webp, video/mp4, video/webm, audio/ogg, audio/mpeg, audio/mp4, audio/webm; otherwise, and always in secure contexts, application/octet-stream;
  • X-Content-Type-Options: nosniff;
  • Content-Security-Policy: sandbox; default-src 'none';
  • Content-Disposition: attachment;
  • Cross-Origin-Resource-Policy: cross-origin, with the CORS headers of 00 §7.3.

Clients show images, video and audio of the types above inline; every other file is a card with its name, size and a "Save" action. A client MUST NOT open or run a downloaded file automatically. In a DM that is still a message request (12), attachments aren't fetched until the user accepts; the card says "Accept to see this file".

14.5 Lifecycle

           create (§14.2)          complete OK             entry accepted
  (none) ----------------> pending ------------> uploaded ---------------> bound
                              |                     |                        |
          24 h, or DELETE     |  24 h, or DELETE    |   edit removes it,     |
          by uploader         v                     v   delete, moderation,  v
                           deleted <------------ deleted   retention ---> deleted
  1. Expiry. An attachment still pending or uploaded at expiresAt is deleted. Referencing it afterwards fails with 410 attachment.expired.

  2. Binding happens in the same transaction that accepts the entry.

  3. Bind checks (§4.5 step 13). For each referenced ID:

    • it exists in this context and was uploaded by the posting account; otherwise 404 attachment.not_found (the server doesn't reveal which);
    • its state is uploaded; pending gives 409 attachment.not_uploaded, bound gives 409 attachment.already_bound, an expired one gives 410 attachment.expired;
    • insecure: IDs used as thumb.id have purpose thumbnail and the others purpose file, else 400 message.invalid_content;
    • the total number of IDs is at most 20 (10 files and their thumbnails), else 400 message.invalid_content.

    An edit binds nothing new: the IDs it keeps must already be bound to its target (§6.2), and the others are unbound.

  4. Unbinding and deletion. When an edit drops an attachment, or its message is deleted (by author or moderator) or expires, the server stops serving the blob at once and deletes it within 24 h (in backups within its rotation).

  5. One message per blob. A blob is bound to exactly one root message. To share a file again, the client uploads it again (in secure contexts with a new key).

14.6 Limits

Limit Rule Failure
File size (maxAttachmentBytes) Insecure: blobBytes ≤ maxAttachmentBytes for purpose file. Secure: blobBytes ≤ svf1Size(maxAttachmentBytes) (04 §10.7; 27,269,675 for the default 25 MiB). Clients MUST check the file size against maxAttachmentBytes before encrypting. 413 attachment.too_large
Secure blob shape In a secure context, blobBytes MUST be a length SVF1 can produce: at least 4,155, and P = blobBytes − 43 − 16·n (with n = ceil((blobBytes − 43) / 65,552)) a value of 04's pad(), and the last segment ciphertext blobBytes − 43 − 65,552 × (n − 1) at least 4,112 bytes (every length rule of 04 §10.7). 400 crypto.malformed (reason: "length", 04)
Thumbnails Insecure, purpose thumbnail: blobBytes ≤ THUMB_MAX_BYTES. Secure: checked by clients only (§14.3). 413 attachment.too_large
Pending uploads At most 50 attachments in pending or uploaded per account per server. 429 attachment.quota_exceeded
Upload volume RECOMMENDED: 2 GiB of blobs per account per server per 24 h; servers MAY choose another value. 429 attachment.quota_exceeded with retryAfterMs

UX: before upload the client checks the size and says, for example, "This file is too large. Files here can be up to 25 MB." It never starts an upload that it knows will fail.

15. Webhooks

15.1 Scope and feature flag

A webhook lets an outside service post messages into one insecure channel with a secret token, without being a member. Webhooks are an optional feature: a server that supports them lists webhooks in ServerMetadata features (00 §7.8). A server that doesn't implement webhooks answers every webhook path with 404 core.not_found and data.reason: "unknown_endpoint"; one that implements them but has turned them off answers 501 core.unsupported_feature with data.feature: "webhooks" (03 §2.1, §12.2). Clients decide from features, not by probing.

Webhooks exist only in insecure channels (D-061):

  • in a secure channel, creating a webhook, enabling one, rotating its token and executing it answer 403 security.context_secure_unsupported. Listing, reading and deleting (GET …/webhooks, GET …/webhooks/{id}, DELETE …/webhooks/{id}) keep working, so admins can see and remove the webhooks an upgrade disabled (§15.5), and PATCH may still rename one;
  • in a DM or group DM every webhook endpoint answers 404 core.not_found.

v1 has incoming webhooks only. Services that need to read or react use a bot account (05).

15.2 Webhook object

Member Type Meaning
id string UUIDv7, server-generated.
ctx string The channel.
name string Shown as the sender name. 1–80 Unicode scalar values; no @, no <, >, control characters or line breaks.
state string active or disabled. A receiver treats an unknown value as disabled.
disabledReason string or null admin or secure_context, or null when active.
allowMentionAll boolean Whether its messages may use <@everyone>. Default false.
createdBy string Canonical address of the creator.
createdAt string Creation time.
lastUsedAt string or null Last accepted execution.
token string Only in the responses to creation and token rotation: whk_ followed by base64url of 32 random bytes. The server stores only a hash of it.

15.3 Management

All management requests need manage_channels (10) in the channel.

Request Effect Response
POST {base}/v1/contexts/{ctx}/webhooks {name, allowMentionAll?} Create. At most MAX_WEBHOOKS_PER_CHANNEL (15), else 409 message.webhook_limit. 201 Webhook with token
GET {base}/v1/contexts/{ctx}/webhooks List (cursor collection, 00 §7.10). 200
GET {base}/v1/contexts/{ctx}/webhooks/{id} Read. 200 Webhook
PATCH {base}/v1/contexts/{ctx}/webhooks/{id} {name?, state?, allowMentionAll?} Rename, enable or disable (state: "disabled" sets disabledReason: "admin"). A webhook with disabledReason: "secure_context" can't be enabled (403 security.context_secure_unsupported). 200 Webhook
POST {base}/v1/contexts/{ctx}/webhooks/{id}/token Rotate: the old token stops working at once. 200 Webhook with token
DELETE {base}/v1/contexts/{ctx}/webhooks/{id} Delete. Messages already posted stay. 204

The admin UI shows the token once, with a "Copy" button and the line "Anyone with this token can post in this channel."

15.4 Executing a webhook

POST {base}/v1/contexts/{ctx}/webhooks/{id}/messages
Authorization: Bearer whk_…
Member Type Required Meaning
mid string No A UUIDv7 (§2.4) for idempotency. If absent, the server generates one and the request isn't idempotent.
content object Yes A MessageContent with only text, mentions and mentionAll. replyTo and attachments MUST be absent or empty.

The server checks: the feature is on; the channel is insecure (else 403 security.context_secure_unsupported); the webhook exists, is active, and the token matches (else 401 core.unauthenticated, without saying which); the content is valid (§3); at most 30 executions per webhook per minute (else 429 core.rate_limited). mentionAll is validated as in §4.4 rule 3, with allowMentionAll in place of mention_everyone: without it the message is accepted and notifies nobody. It then accepts a root message exactly as in §4.5 with Sender { "kind": "webhook", "webhook": id, "name": name } and answers 201 with an EntryAck. Webhook messages can be reacted to, replied to and deleted by moderators like any other.

15.5 Channel upgrade

When a channel becomes secure (09), the server, in the same transaction, sets every webhook of the channel to disabled with disabledReason: "secure_context" and invalidates their tokens. Executions then fail with 403 security.context_secure_unsupported. Because channels never downgrade (D-018), these webhooks never work again; admins can only list and delete them (§15.1). The upgrade dry run of 09 SHOULD list the channel's active webhooks among the things that will stop working.

Proposed decision: v1 webhooks are incoming only, for insecure channels only, authenticated with a Bearer token (never a token in the URL), shown with a non-fakeable "Webhook" badge, and disabled permanently when their channel is upgraded. Rationale: minimal integration surface that respects D-061 and 03's token rules.

16. Notification triggers

The hosting server derives notification triggers from each accepted entry and hands them to the notify machinery of 19, which decides delivery (foreground sessions, coalescing, user settings, dnd, push). This document only defines who is triggered and by what.

Trigger Insecure source Secure source Recipients
Mention content.mentions Hint mentions Each listed account with access, except the sender.
Reply content.replyTo.author when ping is true Arrives as a mention through the hint (§4.4); the server can't tell it apart. The parent's author, except the sender.
Everyone content.mentionAll, validated (§4.4 rule 3) Hint mentionAll, validated (§4.4 rule 3) Every account that can see the context, except the sender.
DM message Every root message in a DM or group DM Same Every other participant.
Edit Addresses in the edit's mentions not mentioned by the root message or any earlier edit Same, from the hints Those addresses only.

Entries posted through a webhook (§15.4) produce the Mention and Everyone triggers like any other entry; the sender handed to 19 is the webhook Sender { "kind": "webhook", "webhook": id, "name": name }, with no address.

For one entry and one recipient at most one message trigger is produced; when several rows apply, 19 §4.1's priority (mention > reply > mention_all > dm_message) picks it. A trigger caused by an edit is identified by the edit entry's mid.

Reactions, deletes, typing, read state and presence trigger no notifications in v1. When a message that triggered a notification is deleted or expires, or an insecure message whose notification carried a preview is edited, the hosting server passes that on to 19 (19 §4.6) so the notification can be withdrawn where 19 supports it. A preview (insecure contexts only, D-051) is taken from the current text, with tokens replaced by display names.

No trigger is produced for an account that can't see the entry under §7.5. So an edit made after someone joined a secure context, of a message from before they joined, never notifies them, even if it newly mentions them (D-007). A manual history share (14's history.shared) triggers no notification.

17. Error codes

17.1 Codes owned by this document

Code HTTP retryable userAction Meaning data
message.invalid_content 400 false none A content object, AttachmentRef, reply reference or attachment set is malformed or breaks a rule of §3. field, reason
message.too_large 413 false none Insecure carrier: the JCS size of content exceeds maxMessageBytes (§3.8). Secure carrier: the decoded ct minus its tag exceeds roundUp256(maxMessageBytes) (14 §5.2 step 5). limit, size
message.too_many_mentions 400 false none More than MAX_MENTIONS (50) entries in mentions, or more distinct addresses than the hosting server's mentionLimit (10 §12.2). limit (the limit that was exceeded)
message.target_not_found 404 false none Plain carrier, or GET …/messages/{mid}: the target doesn't exist, isn't visible or has expired. —
message.target_deleted 409 false none Plain carrier: the target was deleted. —
message.not_author 403 false none Plain carrier: editing or deleting another account's entry. —
message.not_editable 409 false none The target can't be edited. reason: security_changed
message.changes_expired 410 false none changedAfter is older than the server's change horizon (§7.4); the client reloads. changesFloorSeq
message.webhook_limit 409 false none The channel already has 15 webhooks. limit
reaction.invalid_key 400 false none The reaction key isn't one emoji within 64 bytes. —
reaction.already_exists 409 false none The account already reacted with this key. mid
reaction.too_many 409 false none Per-account or distinct-key reaction limit reached. limit
attachment.too_large 413 false none Over maxAttachmentBytes or the thumbnail limit. limit
attachment.not_found 404 false none No such attachment visible to the caller in this context. —
attachment.not_uploaded 409 true retry Referenced before complete succeeded. —
attachment.already_bound 409 false none Already bound to a message. —
attachment.expired 410 false retry Not bound within 24 h; upload again. —
attachment.size_mismatch 422 true retry Uploaded length differs from blobBytes. expected, actual
attachment.hash_mismatch 422 true retry Uploaded bytes don't match sha256. —
attachment.quota_exceeded 429 true wait Too many pending uploads, or upload volume exceeded. — (with retryAfterMs)
attachment.blocked 403 false contact_admin An insecure server's content policy refused the file. —

The areas typing, read and presence have no codes of their own in v1; their endpoints use core.* codes (03).

17.2 Codes from other documents used here

  • 01: address.non_canonical (an address in mentions or replyTo.author fails 01 §7.5 checks 1 to 5, §4.4 rule 2).
  • 03: core.invalid_request, core.unauthenticated, core.token_expired, core.forbidden (with data.permission), core.not_found, core.unsupported_feature (webhooks turned off, §15.1), core.idempotency_conflict (reason mismatch or in_progress, §4.6), core.rate_limited, core.unavailable, core.internal.
  • 00 §4.11: security.account_required, security.device_not_enrolled, security.upgrade_required, security.context_secure_unsupported.
  • 04: crypto.malformed (secure blob shape, §14.6).
  • 09: channel.plaintext_rejected (plaintext body in a secure channel, or in any channel during a server upgrade, §4.7; 09 §15.3), channel.join_required, member.not_member, member.pending (§4.5 steps 4 and 5).
  • 10: moderation.timed_out, moderation.slow_mode, moderation.new_member_restricted, moderation.banned.
  • 12: dm.closed, dm.encryption_pending, dm.upgrade_in_progress, dm.not_participant.
  • 13: mls.commit_required, and the mls.* codes the outbox handles in §13.3.
  • 14: sealed.not_secure and sealed.required (wrong carrier, §4.7), sealed.header_mismatch (§4.3), sealed.kind_unsupported (§3.1), sealed.ref_invalid (target rules in secure carriers, §6), and the other codes of 14 §5.2.

How the outbox reacts to each of them is in §13.3.

17.3 Rate limits

Servers answer excess with 429 core.rate_limited (03). RECOMMENDED defaults, per account per context unless stated:

Action Default
Entries of kind message and edit 10 per 10 s
Entries of kind reaction and delete 20 per 10 s
typing: true 1 per 3 s (excess silently ignored, §10.2)
PUT /read 2 per s
PUT /v1/me/presence 10 per min per session
Upload creation 30 per min per account per server
Webhook execution 30 per min per webhook

18. Registry additions

For 03's registries and 02's ServerMetadata:

  • Limits: maxMessageBytes (default 16,384, floor 8,192) and maxAttachmentBytes (default 26,214,400, floor 8,388,608).
  • Feature: webhooks (optional; insecure channels only).
  • Event types: as registered in §8.1: message.created (durable, timeline item), message.edited, message.deleted, message.purged, reaction.added, reaction.removed (durable, context stream); read.updated (durable, me stream); typing.started, typing.stopped, presence.updated, presence.snapshot (ephemeral).
  • Path (listed in 00 §7.3): /v1/me/read-states, owner 11.
  • Error codes: the codes of §17.1.
  • Bearer tokens: webhook tokens (whk_…) are Bearer tokens accepted only on the webhook execution endpoint.
  • AccountVault settings (08 §8.6.4): mention_hints (already listed by 08; boolean, default true, §4.4) and typing_indicators (new; boolean, default true, §10.3).
  • Cryptographic labels: none. File keys are random, not derived.

19. Test vectors

19.1 Size measurement (JCS)

Input content object (TV-1), sent with any formatting:

{ "text": "Hello", "replyTo": null, "attachments": [] }

JCS serialization: {"attachments":[],"replyTo":null,"text":"Hello"}. Measured size: 48 bytes.

Input content object (TV-2):

{
  "text": "Hi <@bob@b.com>, see **this** — café ☕",
  "mentions": ["bob@b.com"],
  "mentionAll": false,
  "replyTo": { "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6", "author": "alice@a.com", "ping": true },
  "attachments": []
}

JCS serialization (one line):

{"attachments":[],"mentionAll":false,"mentions":["bob@b.com"],"replyTo":{"author":"alice@a.com","mid":"01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6","ping":true},"text":"Hi <@bob@b.com>, see **this** — café ☕"}

Measured size: 207 bytes. SHA-256 of these bytes (for checking an implementation's serializer): 3710c3b13734850cc486cf7c84cc82ac39c3ae0596eadbb7d18e1ae8cc882b5d. The same object pretty-printed with two-space indentation and \u escapes for non-ASCII is 267 bytes, but its measured size is still 207. text is 38 Unicode scalar values and 43 bytes of UTF-8.

19.2 Secure plaintext padding (14 §4.5)

The padded plaintext is the content JSON followed by spaces (0x20) up to the next multiple of 256 bytes.

Input Content JSON length Spaces added Padded plaintext length Decoded ct length
TV-1 (JCS form) 48 208 256 272
TV-2 (JCS form) 207 49 256 272
ReactionContent {"target":"01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6","key":"👍"} 62 194 256 272
DeleteContent {"target":"01938f36-0000-7a00-8b00-000000000001"} 49 207 256 272
A content object of 256 bytes 256 0 256 272
A content object of 257 bytes 257 255 512 528

Server bound on the decoded ct (roundUp256(maxMessageBytes) + 16, §3.8):

maxMessageBytes roundUp256 Largest accepted decoded ct Client-side limit on the content JSON
8,192 (floor) 8,192 8,208 8,192
10,000 10,240 10,256 10,000
16,384 (default) 16,384 16,400 16,384

With maxMessageBytes = 10,000, a client may send a 9,990-byte content JSON padded to 10,240 bytes, and the server accepts its 10,256-byte ct; a 10,001-byte content JSON is refused by the client before sealing.

19.3 mid grammar

Input Valid? Why
01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6 Yes
01938F30-1B2C-7D4E-8F90-A1B2C3D4E5F6 No Uppercase
01938f30-1b2c-4d4e-8f90-a1b2c3d4e5f6 No Version 4, not 7
01938f30-1b2c-7d4e-cf90-a1b2c3d4e5f6 No Variant c
01938f301b2c7d4e8f90a1b2c3d4e5f6 No No hyphens

The 16-byte binary form of the first is hex 01938f301b2c7d4e8f90a1b2c3d4e5f6.

19.4 Mention tokens

Input text (the context is on b.com):

Hey <@bob@b.com> and <@carol@c.com>, `<@dan@d.com>` is code. <@everyone> see <#lobby@b.com>. <@Bob@B.com> \<@erin@e.com>
Token text Result
<@bob@b.com> User mention bob@b.com
<@carol@c.com> User mention carol@c.com (rendered with its domain, because it differs from b.com)
`<@dan@d.com>` Literal (inside a code span)
<@everyone> Everyone token
<#lobby@b.com> Channel reference
<@Bob@B.com> Literal (not canonical)
\<@erin@e.com> Literal (escaped)

So mentions MUST be ["bob@b.com", "carol@c.com"] in any order, and mentionAll MUST be true.

19.5 Visibility (§7.5)

Secure channel. Carol joins at seq 120, leaves at 300 and rejoins at 900 (09 §17.3 case B). Her visibility ranges are [[900, null]]: her earlier membership isn't served again (D-007).

seq Entry Served to Carol? Why
100 sealed message.created No Before her current membership.
150 sealed message.created (A) No In her earlier membership, which isn't served again. Her devices keep the copy they stored and show it above K6.
400 sealed message.created No While she was left.
950 sealed message.created Yes In [900, null].
960 sealed message.edited of A Reduced payload {"withheld": true} (§8.3) In range, but the target isn't visible (§7.5 rule 3).

A page GET …/messages?before=1000 for Carol carries "ranges": [[900, null]], "grants": [] and "withheldBeforeSeq": 900.

Dan, who holds share_history and can read that period, then shares [100, 160] with Carol (14). Her pages now carry "grants": [[100, 160]]: the sealed items at 100 and 150 and their attachments are served to her again, so A is visible and the edit at 960 is now served in full (§7.5 rule 3); a plaintext or membership event inside that interval isn't.

Insecure channel, same events for Erin (09 §17.3 case E): her ranges are [[1, null]] after the rejoin, so every entry above is served to her.

Dave, who has never been a member, joins a secure channel at seq 1000; the external commit that adds his first leaf is sequenced at 1003. His visibleFromSeq is 1000, so a sealed message at 1001 is served to him, but his device holds no key for its epoch; his client folds it into K6 (20 §5). A sealed message at 1004 is readable.

19.6 Changes feed

Events in a context, in order: 200 message.created (A), 201 message.created (B), 202 reaction.added on A, 203 message.edited on B, 204 message.deleted of A.

Request Items (by updatedSeq)
changedAfter=199 B (updatedSeq 203, edited), A (updatedSeq 204, tombstone)
changedAfter=202 B (203), A (204, tombstone)
changedAfter=203 A (204, tombstone)
changedAfter=204 none; hasMore: false

19.7 Effective presence

Sessions on this server Chosen Effective
None for the last 45 s online offline
Socket closed 10 s ago, none open online online (within OFFLINE_GRACE)
Two, one idle online online
Two, both idle online idle
One, not idle dnd dnd
One, not idle invisible offline

19.8 Attachment blob sizes (SVF1, 04 §10.3 and §10.7)

File size (bytes) Framed Lf Bucket P Segments n Blob size 43 + P + 16n
1 9 4,096 1 4,155
65,536 65,544 73,728 2 73,803
1,048,576 1,048,584 1,179,648 18 1,179,979
26,214,400 (25 MiB) 26,214,408 27,262,976 416 27,269,675

With the default maxAttachmentBytes, a server MUST accept blobBytes 27,269,675 in a secure context and MUST refuse 27,269,676 with 413 attachment.too_large. In an insecure context it accepts blobBytes 26,214,400 and refuses 26,214,401. A secure blobBytes of 4,154, or of 4,156, is refused with 400 crypto.malformed (no SVF1 blob has that length). A secure blobBytes of 131,163 is refused with 400 crypto.malformed (last segment too short: n = 3 and the last segment is 16 bytes, although P = 131,072 is a value of pad()).

20. Security considerations

Insecure contexts. The hosting server reads, stores, alters and can forge every message, edit, reaction, attachment, typing signal, read position and presence update in its insecure contexts (00 §5.1). The protocol protects them only against third parties, through TLS and session tokens. Servers MAY scan insecure attachments; users are told by the open lock (00 §4.12.6) that the server can read.

Metadata in secure contexts. Encryption hides content, not structure. In a secure context the hosting server sees, for every entry: the sender's account and device, the time, the kind, the padded plaintext size, and for operations the target, which reveals which message was edited, reacted to or deleted, and by whom; it also sees whether a reaction was added or removed (§3.1), but not its value, because every reaction plaintext is padded to the same 256 bytes (§3.8). It sees how many blobs belong to which message and their padded sizes, but not which are thumbnails, since secure uploads all use purpose file (§14.2); a small blob next to a larger one still hints at an image or video with a preview. It sees the mention hints (unless the sender turned them off), mentionAll, typing, read positions and presence. Padding (§3.8, 04 §10.3) blurs sizes but doesn't hide them. Document 22 has the full exposure table; this list is this document's contribution to it.

Mention hints (D-063). A hint tells the server who is mentioned, and since reply pings travel as mentions, who replied to whom when they pinged. The leak is limited to people the sender chose to notify, and each user can stop sending hints (§4.4), at the cost of mention notifications for offline recipients. A malicious sender can put addresses in the hint that the encrypted content doesn't mention, to cause notifications; receivers suppress those after decrypting (§4.4) and rate limits bound the volume. A sender can't make @everyone effective without the mention_everyone permission, because the server records the validated mentionAll as false and receivers honour <@everyone> only when the validated value is true (§4.4).

Targets are signed. The target of a secure operation travels in cleartext (target) so the server can act on it, but it is also the ref member of the SealedMessage, which is part of the signed SealedHeader and of the AEAD associated data (14 §4.4). The server checks that the two agree (§4.3), and receivers check that the decrypted target equals ref (§3.9). A server can therefore neither reattach an edit or reaction to another message nor forge one, without the signature failing. The cleartext attachmentIds aren't signed, so receivers check them against the encrypted references (§3.9): a mismatch only makes a file unavailable, never shows the wrong file.

Edits and deletes don't erase what members received. In a secure context the server deletes the ciphertext of the original and of earlier edits when it accepts an edit (§6.2), so nobody who loads the message later, including a member's own new device or someone it is later shared with (D-007), can read an earlier version. But members' devices that already decrypted the original may still hold it, and their key archives hold the epoch keys (08); honest clients replace it with the edit and delete the old plaintext (§5.5). A delete likewise removes ciphertext from the server, not from devices. User-facing copy MUST NOT promise more than "deleted for everyone in the app". The server keeps the signature digest of what it deleted (14 §5.7), which reveals no content. In insecure contexts, the server may have retained earlier versions under 10's moderation rules.

Operations on messages from before someone joined. An edit or reaction made today on a message from before a newcomer joined a secure context is encrypted under today's epoch, so the newcomer's keys could decrypt it. The server delivers such entries to the newcomer only as reduced payloads (§7.5 rule 3, §8.3), but this part of D-007 is enforced by the server, not by cryptography (22 RR-26). An edit's content is a full replacement (§3.7.1), so an edit of an old message carries the old message's new text, not just a change.

Manual history sharing. A VisibilityGrant makes the server serve sealed items a member couldn't otherwise get, but the keys come only from the sharer's HistoryShare, which the server can't read (14). A grant never covers plaintext, so pre-upgrade plaintext is never re-exposed through it.

Retention is server-enforced deletion. It doesn't bind other members' devices, and in secure contexts nothing cryptographic forces a client to forget a decrypted message. Clients say so (§12.5).

Attachments. Every blob has its own random key (§14.3), so revealing a file key in a report opens exactly one file (D-040). SVF1 commits to its key (04 §10.4), and the signed sha256 in the AttachmentRef binds the file's exact content to the sender's signature; receivers and moderators MUST check both. Capability download URLs are bearer secrets: they are short-lived (10 min), unguessable and limited to one blob, and never contain a session token. Every blob, whichever origin serves it, carries nosniff, a sandbox CSP and Content-Disposition: attachment, so an uploaded HTML or SVG file can't run script on that origin (§14.4). Clients strip photo location data by default (§14.3) because a single shared photo can reveal where someone lives.

Link handling. Masked links are not part of the formatting subset, remote resources are never loaded because of message text, and secure contexts never fetch link previews automatically (§3.3), so a message can't silently reveal a reader's IP address or what they read to a third party.

Webhooks. A webhook token lets anyone who holds it post in its channel, so servers store only a hash, admins can rotate it at once, and executions are rate-limited. A webhook name could imitate a person; the mandatory "Webhook" badge, the ban on @ in names and the absence of an address prevent it from passing as an account. Webhooks can't exist in secure contexts (D-061) and stop permanently when a channel is upgraded.

Presence. Presence is per server and never federated, so a server learns nothing about the user's activity on other servers beyond what the user's own client tells it. The price is that "online" only means "connected to this server" (§11.1). A custom status, however, is copied to every server the client uses and is visible there to everyone who shares a community or conversation with the user; the status picker says so. invisible hides presence from other users, not from the server.

Outbox. Queued secure messages are plaintext on the device until sent; they are protected like other local message data and erased at sign-out and on revocation (§13.1). Content composed under a closed lock is never sent as plaintext without a user action, and a client never trusts a hosting server's word alone that a secure conversation has become insecure (§4.7).

Denial of service. Entry rate limits, per-user reaction caps, upload quotas, the pending-upload limit and the typing throttle bound what one account can make the server store and fan out. Servers apply the limits per account and per IP address (03).

21. Open questions

  1. Read receipts in DMs. v1 has none (§9.3): read positions are private to the account. Should 1:1 DMs and group DMs show "Seen" to the other participants, as many messaging apps do? Recommendation: no for v1. It adds metadata exposure and social pressure, and can be added later as an opt-in without breaking the protocol.

  2. Webhook tokens in URLs. 03 forbids tokens in URLs, so a webhook needs an Authorization header. Some popular services can only call a bare URL, which means admins would need a bridge. Should webhooks be an exception, with the token in the path? Recommendation: keep the header-only rule in v1 for consistency and because URLs leak into logs; reconsider if adoption suffers.

  3. Disappearing messages in DMs. Retention exists only for channels in v1 (§12.1). Should DMs and group DMs get a per-conversation retention ("disappearing messages")? Recommendation: defer until after v1; when added, any participant may set it and every participant sees a timeline line naming who changed it.

22. References

22.1 Normative

  • RFC 2119, RFC 8174 — requirement key words
  • RFC 3339 — date and time on the Internet
  • RFC 4648 — base16, base32 and base64 encodings (base64url)
  • RFC 5234 — ABNF
  • RFC 6838 — media type specifications
  • RFC 7493 — I-JSON
  • RFC 8259 — JSON
  • RFC 8785 — JSON Canonicalization Scheme (JCS)
  • RFC 9110 — HTTP semantics (methods, status codes, range requests)
  • RFC 9457 — problem details for HTTP APIs
  • RFC 9562 — UUIDs (UUIDv7)
  • CommonMark Spec, version 0.31.2
  • GitHub Flavored Markdown Spec, version 0.29-gfm (strikethrough and extended autolinks only)
  • Unicode Technical Standard #51 — Unicode emoji (possible_emoji expression; RGI emoji sequences)
  • Unicode Standard Annex #29 — text segmentation (extended grapheme clusters)
  • W3C Content Security Policy Level 3 (sandbox directive); WHATWG Fetch (X-Content-Type-Options, CORS, Cross-Origin-Resource-Policy)
  • 00-overview.md — architecture, security model and conventions (§4, §5.4, §7)
  • 03-transport.md — envelope, streams, event classes (D4, D7, D8), timeline pages (headSeq), subscriptions, resume, errors, collections, idempotency, rate limits
  • 04-crypto-conventions.md — SVF1 attachment encryption, padding buckets and svf1Size (§10), crypto.malformed
  • 08-device-setup-recovery.md — AccountVault settings records (mention_hints, typing_indicators)
  • 09-communities-channels.md — Channel, Membership, visibility ranges, visibleFromSeq in ChannelMember, retentionDays, upgradeSeq, channel.plaintext_rejected
  • 14-secure-content-history.md — SealedMessage (ctx, gen, ref), plaintext padding, ingress checks, visibleFromSeq, HistoryShare and VisibilityGrant, tombstone fields
  • 10-roles-moderation.md — permissions (send_messages, add_reactions, attach_files, mention_everyone, manage_messages, manage_channels), moderator deletion, timeouts, slow mode
  • 12-direct-messages.md — DM access, states and codes, joinedSeq, successors, message requests
  • 13-mls-profile.md — content freeze and mls.commit_required
  • 19-notifications-push.md — notify, notification settings and records

22.2 Informative

  • RFC 8030, RFC 8291 — Web Push (how 19 delivers the triggers of §16)
  • RFC 9420 — MLS; RFC 9605 — SFrame
  • RFC 5116 — AEAD interface (AES-GCM and the absence of key commitment)
  • Unicode UAX #15 — normalization forms (NFC)
  • CIPA/JEITA Exif specification — location metadata in images
  • 01-addressing.md — canonical addresses and display names
  • 05-accounts-auth.md — bot accounts
  • 07-identity.md — the kind claim used for bot badges; IdentityState (§4.7)
  • 08-device-setup-recovery.md — key archive
  • 20-client-requirements.md — user-facing copy
  • 22-security-considerations.md — whole-system metadata exposure table
  • spec/DECISIONS.md — decision log