Messaging Contract
This document describes the backend contract for conversations, messages, threads, and attachments.
Product Terms #
workspaceis the product-level term.Conversationis the messaging container used for channels, DMs, and group chats.MessageThreadis an optional thread opened from a timeline message.
Conversation Types #
Channel: stable shared conversation inside a server/workspace, public or private.Direct: 1:1 conversation between two users.Group: multi-user private conversation.
Channel Visibility And Membership #
- Public channels (
isPrivate = false) are readable by every workspace member, joined or not (except guests, see Roles And Moderation below). Joining (joinChannel) adds aconversation_memberrow; joined channels are what the sidebar lists (channels(filter: { joinedOnly: true })), all public channels appear in browse (channelswith the default filter). Posting does not require joining. - Private channels (
isPrivate = true) are readable, listable, searchable and subscribable by their members only. A workspace member outside one getsNOT_FOUNDon every read and write — neverFORBIDDEN— so the response does not reveal that the channel exists. This holds for workspace owners and moderators too. - Privacy is chosen at creation (
createConversation(input: { isChannel: true, isPrivate: true })) and cannot be changed later in either direction.isPrivateon a DM or group is rejected withVALIDATION. - The creator of any channel is its first member. A private channel's initial members are added
by the client with
addConversationMembersright after creation. addConversationMembers(invite): the caller must be a member of the channel or group (for a public channel: join first,FORBIDDENotherwise); targets must be workspace members; existing members are skipped. In the direct space it also takesremoteMembers(principal id and relays), resolved ascreateConversationresolves them;userIdsmay then be left out. Every member of a group there adds people, guests included. A plaintext group of the direct space takes nobody from another server (VALIDATION, "conversations with people on other servers are encrypted"), and an encrypted one only people with a device set up for encryption. Not valid for DMs. In the server's default workspace, which every account joins, only an Owner or Moderator, or the creator of a private channel, adds people to a channel (FORBIDDENotherwise), and one call names at most 50 people (VALIDATION). A group holds at most 100 members, plaintext or encrypted (VALIDATION).- A channel's topic (
updateConversationTopic) is changed by an Owner or Moderator, or by the creator of a private channel; anyone else getsFORBIDDEN. In a DM or group any member changes it. Anyone who may write pins a message; a message someone else pinned in a channel is unpinned by an Owner, a Moderator or a private channel's creator (FORBIDDENotherwise). leaveConversation: channels and groups, not DMs. Leaving a public channel you never joined is a no-op. Leaving a private channel as its last member is allowed; it then stays invisible to everyone, and only an Owner/Moderator can archive it, by id (from the audit log).removeConversationMember: Owner/Moderator may remove anyone (also from a private channel they are not in); everyone else only themselves. When an Owner or Moderator removes someone else from a channel, the removal is recorded with who removed them and when.conversationMemberRemovals(serverId, conversationId, limit)lists a channel's latest removals, newest first (limit50 by default, at most 100), to anyone who can read the channel, with the errors ofconversation; a group or DM answers an empty list. Clients show each as a line in the channel ("Bob was removed by Alice") and read the list again onMemberRemovedFromConversation, which reaches the channel's members and the removed person; other readers see a new line the next time they open the channel. Leaving, removing oneself, declining an invitation, a kick or a ban, and removals from groups are not recorded. A removal stays listed after either account is deleted, named as the deleted account. Listed inserverInfo.capabilitiesasconversation_member_removals.- DMs and groups are unchanged: non-members get
FORBIDDEN. - Mentions (
<@user>) are stored and notified (UserMentioned) only for users who can read the conversation: any workspace member but a guest for a public channel, members otherwise. A message mentions at most 50 distinct users; later<@user>tokens stay plain text, are not stored and notify nobody. An edit replaces the message's mentions. - Realtime: events of a private channel, DM or group reach only its members; public-channel
events reach the whole workspace. The visibility fields on
WorkspaceEvent(is_private,member_user_ids, andconversation_typewhere it was not already serialized) are server-side only and never serialized, so the WebSocket JSON is unchanged. - Existing workspace members became members of every existing channel when the
m20261005_005743_add_channel_privacy_and_archivemigration ran, so the joined list did not start empty. A user who joins the workspace later (invite acceptance, join by invite, owner adding them, server creation — all throughutil::add_workspace_member) is joined to every public, unarchived channel at that moment; private and archived channels are not joined. - Unread counts (
unreadCounts) andmarkAllAsReadcover only conversations the user is a member of: joined public channels, private channels, DMs and groups. A public channel the user can read but has not joined carries no unread badge; after joining, messages count from the join time. - Each entry of
unreadCountshasunreadAfter: messages sent after this time count as unread. It is the read marker, or the join time for someone who has not read the conversation. - The read marker only moves forward, with one exception:
markAsUnread(orchat.mark_as_unread) moves it to just before a message, so that the message and every later one count as unread. The message has to be a root message of the conversation that is not deleted and that the caller can read: a thread reply isVALIDATION, because replies do not count as unread, and a deleted message, a message of another conversation and an unknown id are allNOT_FOUND. Marking something unread never makes anything less unread: a marker already before the message stays, and someone with no marker yet stays unread from their join time, unless the message is older than that, which writes a marker just before it. An encrypted conversation works the same way: the marker and the times are not encrypted.
Who May Start A DM #
A first DM from someone arrives directly, as a request the recipient accepts, ignores, blocks or
reports (dmRequests, see "The request inbox" in docs/relay.md), or not at all. Three layers
decide, and each may only tighten the one above it:
| Layer | Set by | People outside the recipient's workspaces | Fellow members of a workspace |
|---|---|---|---|
| Server | The operator: RIM_DM_INBOUND, RIM_DM_OUTBOUND, RIM_DM_PARTNERS (read-only in serverInfo.dmInbound, dmOutbound, dmPartners) |
Inbound OPEN, REQUESTS (default), PARTNERS (people on the listed servers and on this one) or NONE; outbound ALLOWED (default), PARTNERS or NONE |
Not the server's matter |
| Workspace | Its Owner: setWorkspaceDmPolicy (Server.dmOutsideFloor, Server.dmMemberDefault) |
A floor for its members: NONE (default, no floor), REQUESTS or CLOSED |
A default: DIRECT (default) or REQUESTS |
| Person | Each user: setMyDmSettings, setMyWorkspaceDmSetting (read in myDmSettings) |
REQUESTS (default) or NONE, within the floors |
Per workspace DIRECT or REQUESTS, either way |
- A fellow member shares a workspace hosted here with the recipient. Their DM is delivered
when they are an Owner or Moderator of one shared workspace, when they are a contact, or when
the recipient's choice (else the workspace's default) for one shared workspace is
DIRECT; otherwise it is a request. - Anyone else. From another server,
RIM_DM_INBOUNDmust admit their server or the DM is refused, contacts included:PARTNERSadmits the listed servers,NONEnone. Then a contact's DM is delivered. Otherwise the strictest of the operator's floor (NONErefuses strangers on this server too), the floors of the recipient's workspaces and the recipient's choice decides between a request and a refusal.OPENsets no floor; with the choices a person has today it works asREQUESTS. - A contact is someone the recipient added (
addContact), accepted, or messaged first: creating a DM records the other person as the creator's contact, so their DM back is never a request. A user holds at most 1,000 contacts:addContactfor someone new past that answersVALIDATION("a user holds at most 1000 contacts; remove one first"), and a DM records no further contact for its creator. - Who the sender knows. The sender's own limits on DMs to strangers, the daily invites to people on other servers and a new account's probation (below), skip only people the sender knows: a contact who lists the sender as a contact too (only people on this server have a list here), or someone either of the two accepted a DM request from on this server (an invite delivered directly from a contact is recorded as accepted). A contact the sender added on their own, or that a DM they started recorded, counts as a stranger. These limits are the sender's; the recipient's request inbox still applies its own rules.
- Outbound. A DM with someone on another server needs
RIM_DM_OUTBOUNDto admit their relay:createConversationwithremoteMembersanswersFORBIDDEN("this server starts no direct messages with that server") otherwise, before their relay is asked anything, and so do key package claims for their devices. WithNONEnothing of the direct space reaches another server; withPARTNERSit goes to the listed servers only. A conversation that invites someone on another server the sender does not know counts against the sender's daily invites (RIM_RELAY_DM_REQUESTS_PER_DAY, 20): past them it answersRATE_LIMITEDwithretryAfterSeconds. - Profile card. An account with a principal id and no profile card starts no conversation in
the direct space, and no workspace DM, with a user here who has a principal id:
createConversationandaddConversationMembersanswerVALIDATION("publish a profile card before starting a conversation with someone here"). The invite that takes such a conversation through the recipient's DM settings, blocks and request limits carries the creator's card. The app publishes the card right after signup and, when that fails, from Settings. Reopening an existing DM is not refused. - Conversations per day. A user starts at most 50 new conversations a day in the direct
space, DMs and groups alike: past them
createConversationanswersVALIDATION("you can start at most 50 new conversations a day; try again in N hours"). Reopening an existing DM is not counted. The count is kept in memory on each node. - Probation. During
RIM_PROBATION_HOURSa new account starts no DM with a stranger, in the direct space or in a workspace: someone it does not know (above) who is in none of its workspaces here, the account without a key included:VALIDATIONsaying when it can (docs/api.md). The server's default workspace does not count, since every new account joins it, so a DM in it meets probation like one in the direct space; any other workspace does. The instance operator is never on probation. - Refused here. A DM in the direct space that a recipient here refuses answers
FORBIDDENwhen it is started (createConversation,addConversationMembers), and so does one whose recipient blocked the sender or whose sender the operator blocked. An invite to a group someone was added to comes from whoever added them, so their blocks and settings judge that person. A refused DM from another server is answered as for a block, so its server stops addressing the recipient. - Request limits. A conversation that would file a DM request with someone here meets the
request inbox's limits when it is started (
createConversation,addConversationMembers, in the direct space, for a workspace's DMs and for the default workspace's groups):FORBIDDEN("their request inbox is full") while the recipient holds 100 pending requests, andRATE_LIMITEDwithretryAfterSeconds(until the sender's oldest request of the last 24 hours leaves the window) once the sender would file more thanRIM_RELAY_DM_REQUESTS_PER_DAY(20) requests in 24 hours on this server; a group counts each request it files. A DM delivered directly (from a contact, an Owner or Moderator, or a member the recipient takes DMs from directly) files no request and meets no limit, and reopening an existing DM files none. A conversation the request inbox still refuses for a recipient here is kept from them as an ignored request is, with no notification. - Workspace DMs. In a workspace hosted here, a DM a member whose relay is this server takes
as a request is held in their request inbox like a DM from outside: until they accept it, it stays out of their
inboxConversationsandworkspaceEvents, and its notifications and unread counts out of theirs; meanwhile they may read it but post, react and type nothing in it (docs/relay.md, "The request inbox"). Like the request inbox it needs server-to-server traffic to be on; without it workspace DMs arrive directly. - The default workspace's groups. In the server's default workspace, which every account
joins, a group is started and grown like a DM with each newcomer:
createConversationandaddConversationMembers(GraphQL or thechat.create_groupandchat.invite_to_conversationcommands) are refused as that DM would be, by a newcomer's DM settings, the request limits and probation, and a newcomer who takes it as a request holds it in their request inbox until they accept it. One call names at most 50 people and a plaintext group holds at most 50 members (VALIDATION); an encrypted group keeps its own cap. Groups of other workspaces are unchanged: their members are added by someone already in them. - The sender's view.
Conversation.dmRequestPendingis true for a DM whose other member, on this server, has not yet accepted it as a request; false once they did or when it was no request, null for groups and channels. - The settings.
setMyDmSettings(outside: REQUESTS)under a floor that refuses DMs from outside answersVALIDATIONnaming it;myDmSettings.effectiveOutsidesays what applies andoutsideFloorFromwhere a refusing floor comes from (OPERATOR, orWORKSPACEwith its id and name).setWorkspaceDmPolicyis the Owner's alone (FORBIDDENfor anyone else);setMyWorkspaceDmSettingneeds membership of the workspace (NOT_FOUND).Server.dmOutsideFloorandServer.dmMemberDefaultare null in the direct space. A person whose relay is another server sets their choices there; both personal mutations are refused through the forward path.
Archived Channels #
- Owner/Moderator archive and unarchive channels (
setConversationArchived); other roles getFORBIDDEN. Only channels can be archived (VALIDATIONotherwise). An archived channel does not count againstRIM_LIMIT_CHANNELS_PER_WORKSPACE; unarchiving one past the cap isVALIDATION. A workspace holds at most five times that cap in channels, archived ones included, and creating one past it isVALIDATION; channels cannot be deleted, so archiving frees no room toward it. - An archived conversation is read-only: sending, replying, editing, deleting and forwarding into
it, reactions, pins, topic edits, threads, attachments, typing, joining and inviting fail with
CONVERSATION_ARCHIVED. Leaving and removing members still work. - Archived channels are hidden from
channelsunlessincludeArchived: true, and stay readable and searchable by whoever could read them before.
Roles And Moderation #
Roles #
| Role | Meaning |
|---|---|
OWNER |
Everything. One per workspace; the role cannot be granted (setMemberRole with OWNER is VALIDATION). |
MODERATOR |
Moderation (kick, ban, timeout, delete any message, slow mode, posting permissions, reports) and channel management (archive, remove members). Changes roles only between MEMBER and GUEST. Posts in every channel they can write in, whatever its posting policy. |
MEMBER |
The default. Reads and writes wherever they are a member (public channels without joining) where the channel's posting policy lets them, creates channels and groups, joins public channels, invites people into conversations. In the server's default workspace only the Owner and Moderators create channels (FORBIDDEN). |
GUEST |
Restricted. Reads and writes only in conversations they were explicitly added to. |
A bot (bots.md) is a GUEST whose role cannot change: setMemberRole on it is VALIDATION. It is
in the channels an Owner or Moderator added it to, and only those: addConversationMembers naming a
bot is FORBIDDEN for anyone else. A direct message, a group or an encrypted conversation with a bot
is VALIDATION ("A bot can only be in a channel").
- Migration: before the member role existed every new member was created as
guest, so "guest" meant an ordinary member. Them20261005_024730_add_member_rolemigration addsmemberto theserver_member_roleenum and turns every existingguestintomember; the column default is nowmember. - New members get
MEMBERon every join path (invite acceptance, join by invite, owner-added). Invites carry a role (CreateInviteInput.role,MEMBERby default,GUESTfor a guest link; any other value isVALIDATION). Workspace invites (createInvite) stay owner-only. ServerMember.memberRoleis the enumServerMemberRoleGql(it was a string); the field name is unchanged.ServerMember.timeoutUntilis set while the member is timed out.setMemberRole(serverId, userId, role): the Owner may setMODERATOR,MEMBERorGUESTon anyone but themselves; a Moderator may move aMEMBERtoGUESTand back; everyone else getsFORBIDDEN. Changing your own role isVALIDATION. EmitsMemberRoleChanged.
Workspace invites #
createInviteis owner-only (FORBIDDENfor everyone else).expiresAtdefaults to seven days from now and must be in the future and at most 30 days away, elseVALIDATION; the same bounds as instance invites.maxUsesdefaults to 1 and is capped byRIM_LIMIT_INVITE_MAX_USESwhen the operator sets it. The token is returned once and never shown again.recipientEmailemails the link to that address, and nothing more: the invite is not bound to it, and whoever holds the link can use it. One user creates at mostRIM_LIMIT_INVITES_PER_USER_PER_DAYinvites (default 50, 0 turns it off) and sends at most as many invite emails in 24 hours; past either acreateInviteisVALIDATIONand creates nothing.workspaceInvites(serverId, dir, cursor, limit)lists the workspace's invites for its Owner (FORBIDDENfor everyone else): every invite, revoked, expired and used-up ones included, orderedcreatedAt DESC, id DESCwith the standard cursor rules (dirdefaults toAFTER, towards older invites;limitdefaults to 50, at most 100). EachWorkspaceInvitehas its role,useCount,maxUses,expiresAt,createdAt,createdBy,revokedAtandstate:REVOKEDwhen revoked, elseEXPIREDonceexpiresAthas passed, elseUSED_UPonceuseCountreachedmaxUses, elseACTIVE. Neither the token nor its hash is listed.revokeInvite(inviteId)ends an invite: it admits nobody from then on, and members who joined with it stay. Owner-only: another member of the invite's workspace getsFORBIDDEN; an unknown invite, or one of a workspace the caller is not a member of, isNOT_FOUND. Revoking a revoked invite answers it unchanged. The revocation is audit-logged (workspace_invite_revoked), as the creation is (workspace_invite_created).- An invite stored without an expiry, by a server from before invites had to expire, keeps admitting until it is used up or revoked.
- Redeeming an invite (
joinServerByInvite,signupWithKey, a join through another server) checks the revocation, the expiry and the uses in the same update that counts the use. A revoked, expired or used-up invite isFORBIDDENforjoinServerByInvite; a signup getsINVALID_TOKENfor a revoked or used-up invite andEXPIRED_TOKENfor an expired one.
Public join link and join requests #
A workspace can have one permanent public link, <server>/join/<token>, to put on a website, a
README or a social profile. It lets existing accounts join the workspace, or ask to join it:
accounts of this server, and, unless the Owner turns that off, accounts of other servers through
their own server. It is a different thing from a workspace invite:
| Workspace invite | Public link | |
|---|---|---|
| Expiry, uses | at most 30 days, RIM_LIMIT_INVITE_MAX_USES |
none; it works until turned off or replaced |
| Creates an account | yes: it stands in for the proof-of-work and the per-address signup limit | never, and no setting changes that |
| Token shown | once, by createInvite |
to the Owner at any time (publicJoinLink) |
| Join requests | no | REQUESTS mode |
Why it never creates accounts. A workspace invite is a signup token: it skips the
proof-of-work and the per-address signup limit, and on an invite-only server it is what opens
registration. A permanent, unlimited link posted on a public page would let anyone, scripts
included, create accounts on the server for free. So the link only admits accounts that already
exist; someone without one signs up the server's normal way (proof-of-work, an instance invite,
open registration) and then opens the link again. signupWithKey refuses a link token as
INVALID_TOKEN, as it does any unknown token.
joinByPublicLink is for accounts this server holds; an account of another server joins through
its own server, which presents it here (below), and nothing about that creates an account
either: the host holds the person as a remote user, as for any member from elsewhere.
The link. A token rim_pjl_ followed by 16 random bytes in base64url (22 characters).
/join/<token> carries invite tokens too; the prefix tells the kinds apart (rim_pjl_ a public
link, rim_inv_ a workspace invite, rim_iinv_ an instance invite) and lets secret scanners
recognise a link. It adds no guessable structure to the random part. Lookups go by the SHA-256
of the whole string; a copy of the token is sealed under the server's link key (RIM_LINK_KEY_FILE, default
<RIM_DATA_DIR>/link-key.json), so the Owner can read the link again and a database dump alone
yields no working link. Neither the direct space nor the server's default workspace has a link:
everyone joins the default workspace anyway.
The Owner's settings (only the Owner; FORBIDDEN for everyone else, Moderators included;
VALIDATION for the direct space and the server's default workspace):
publicJoinLink(serverId):enabled(off by default),mode(DIRECTorREQUESTS),role(MEMBER, the default, orGUEST),allowRemote(whether accounts of other servers may join or ask to join through the link; on by default),enabledAt,issuedAt,issuedBy, thetokenandurl,joinsLastDayandjoinsLastWeek(joins through the link, directly or by an accepted request) andopenRequests. A workspace that never had a link answers withenabledfalse and a null token.updatePublicJoinLink(input)changes any ofenabled,mode,role,allowRemote; a role other thanMEMBERorGUESTisVALIDATION. Turning the link on the first time issues its token. Turning it off makes every lookup answerNOT_FOUND; turning it on again brings the same link back.reissuePublicJoinLink(serverId)issues a new token; the old one stops working at once. The settings stay.
Looking a link up. publicJoinLinkPreview(token) needs no sign-in. A valid, switched-on link
answers the workspace's serverId, name and mode and, as viewer, where the caller stands:
SIGNED_OUT, NOT_MEMBER, MEMBER, BANNED or REQUEST_OPEN (with joinRequestId). Every
other token (unknown, switched off, replaced, its workspace deleted) answers NOT_FOUND with the
message "not found", on the same path: a lookup by the token's hash each time. Workspaces have no
icon, so the preview carries none.
Misses are rate limited per address. Each failed lookup or join by an invalid link counts
against the client address; at 20 within ten minutes, every link lookup and join from that address
answers RATE_LIMITED (with retryAfterSeconds) for an hour, valid links included. Successful
lookups, and refusals of a valid link (banned, full, already a member), do not count. Each miss is
logged with the address in the normal log, not the audit trail. The counts are in memory, per
server process.
Joining. joinByPublicLink(token, message), signed in. In one transaction it checks that the
link is valid, the caller is not a member (CONFLICT), not banned (FORBIDDEN, "you are banned
from this workspace") and that the workspace has room under RIM_LIMIT_MEMBERS_PER_WORKSPACE
(VALIDATION). RIM_LIMIT_WORKSPACES_PER_USER counts workspaces a person owns, and a link never
makes anyone an owner, so it does not refuse a join, as it does not refuse an invite.
DIRECT: the caller joins with the link's role and, as a Member, every public channel, as an invite join does.MemberJoinedcarries"source": "public_link". The answer is{outcome: JOINED, serverId};messageis ignored.REQUESTS: the caller files a join request; the answer is{outcome: REQUESTED, serverId, joinRequest}.
Accounts from other servers. Someone whose account is on another server pastes the link into
their own app ("Add workspace"), which reads this server from the URL and joins through the
remote-join path of docs/specs/server-to-server-v1.md ("Joining"): their server, the relay,
asks this one for a join challenge with the link token (remoteJoinChallenge(…, publicLinkToken)), the app signs a login proof and a delegation, and joinRemoteWorkspace with
publicLinkToken presents them. This server runs the same checks as joinByPublicLink through
the same code, and the same modes, with these differences:
allowRemoteoff answersFORBIDDEN("this workspace's public link does not admit accounts from other servers"), at the challenge and at the join; it is a refusal of a valid link and does not count as a miss. Accounts of this server still join.- Misses count against the relay's server id rather than an IP address: the relay's signature proves its id, and its address is shared by all its users. The 20 misses in ten minutes cut that relay off from link lookups here for an hour; client addresses are not affected.
- A server the operator blocked (
rim-server peer block <serverId>,docs/relay.md, "Blocking a peer") gets403 peer_not_allowedfor every request, the challenge included, before the link is looked up: its people do not join through any link here, whateverallowRemotesays. DIRECT: the person joins with the link's role and public channels, withMemberJoined"source": "public_link", the join count and the audit row, and their relay subscribes as for any remote join.REQUESTS: a join request is filed for the person as for a local one (the same message, limits, expiry, decline wait, ban cancellation), recording the relay that filed it. The moderators see it injoinRequests; itsuseris the person as held here (a remote user,r_…). Accepting adds them with the link's role, as an invite join does. The decision (JoinRequestDecidedwithaccepted,declinedorcancelled) travels to that relay as a host event on the person'su:stream; their app, toldaccepted, completes the join as a current member (joinRemoteWorkspacewithout a token) to subscribe. The person cannot withdraw the request from their own server; it expires after 30 days.myJoinRequestslists the requests filed on the server answering it, so a person's requests at other servers are not in their own server's list; their app knows them from theREQUESTEDanswer and learns the decision from the relay item.- An account of this server presented by a relay elsewhere is refused (
VALIDATION): it joins through the link here directly.
Join requests.
- One open request per person and workspace (
CONFLICTfor a second); a person holds at most 20 open requests across workspaces (VALIDATION). The message is trimmed, at most 500 characters (VALIDATION); an empty one is null. - A request expires 30 days after it was filed. Expiry is read, not scheduled: an open request
past
expiresAtis no longer listed or counted, cannot be accepted, declined or withdrawn (CONFLICT), reads asEXPIRED, and is marked expired when the person asks again. joinRequests(serverId, dir, cursor, limit)lists the open requests for the Owner and the Moderators (FORBIDDENfor everyone else), newest first (createdAt DESC, id DESC, standard cursors,limit50 by default and at most 100).myJoinRequestslists the caller's own open requests.acceptJoinRequest(serverId, requestId)(Owner or Moderator) runs the checks of a direct join and adds the person with the link's current role; the request need not be valid through the link any more (it may have been turned off or replaced since). A person who joined another way since asking (an invite, say) is left as they are: the request is closed as accepted, withJoinRequestDecidedbut no secondMemberJoined, join count or join audit row.declineJoinRequestcloses it; the person may ask the same workspace again 24 hours after the decline (VALIDATIONnaming the hours left before that). A request of another workspace isNOT_FOUND; one no longer open isCONFLICT.withdrawJoinRequest(requestId): the person takes their open request back (NOT_FOUNDfor anyone else's); they may ask again at once.- A ban cancels the person's open requests in that workspace, and the purge of a deleted account deletes its requests. A banned person cannot file one.
JoinRequest:id,serverId,workspaceName,userId,user,message,status(OPEN,ACCEPTED,DECLINED,WITHDRAWN,CANCELLED,EXPIRED),createdAt,expiresAt,decidedAt,decidedById.
Guest restrictions (enforced in the services) #
- Creating a channel or a group, joining a channel, inviting into a conversation
(
addConversationMembers) outside the direct space and creating workspace invites:FORBIDDEN. Guests may open DMs. - A public channel the guest has not been added to behaves like a private channel:
NOT_FOUNDon every read and write, absent fromchannels(a guest's channel list is always the joined list, whateverjoinedOnlysays), and fromsearchMessages, and its realtime events do not reach the guest. serverMembersfor a guest lists only themselves and the members of conversations they share;ServerMemberlookups of anyone else areNOT_FOUND. The directory eventsMemberJoined,MemberLeftandMemberRoleChangedreach a guest only when they are about the guest.- Guests are not auto-joined to public channels when they join the workspace.
- Inside a conversation they belong to, a guest can do everything a member can.
Kick, ban, timeout #
Who may target whom (kick, ban, timeout, clear timeout, deleting a person's messages): the actor
must be Owner or Moderator; nobody can target the Owner; a Moderator cannot target another
Moderator; nobody targets themselves (VALIDATION). Otherwise FORBIDDEN. A person who is no
longer a member may be targeted by the Owner or any Moderator (a ban, deleting their messages).
kickMember: removes the member from the workspace and from every conversation of it, deletes their macros and pipelines there, emitsMemberLeft. They can re-join with a new invite.leaveWorkspace: a member's own way out, removed as by a kick (MemberLeftcauseleft); not for the Owner, the direct space or the default workspace (docs/api.md, "Leaving or renaming a workspace").banMember(reason, expiresAt): records a ban (server_ban), then removes the member like a kick. A user who is not a member can be banned pre-emptively. While a ban is active (noexpiresAt, orexpiresAtin the future) accepting an invite, joining by invite and being added by the owner fail withFORBIDDEN; the refused join consumes no invite use.unbanMemberdeletes the ban;serverBanslists active bans (Owner/Moderator). In the current default workspace, an unban also restores a local account as Member with public channels, in the same transaction; it does not restore private channels, workspace DMs, macros or pipelines. In other workspaces a new invite is needed. After a temporary ban expires, or for an older account,joinDefaultWorkspacelets a signed-in local account rejoin the default workspace without an invite; an active ban returnsFORBIDDENwith "you are banned from this workspace". Already joined accounts keep their role. Message authors exposebannedandbannedUntilin that message's workspace to its members.banReasonis null unless the viewer moderates that workspace. Expired and lifted bans report false with null end and reason.timeoutMember(until, reason):untilmust be in the future and at most 30 days ahead. While it lasts, every write fails withTIMED_OUT(extensionuntil, RFC 3339): sending, replying, editing, forwarding, reactions, pins, topic, attachments (REST upload: 403 withuntil), joining, inviting, creating conversations, andexecuteCommandof anyMutating(or stricter) command in that workspace. Reads continue, and a timed-out author may still delete their own messages over GraphQL. Expired timeouts are ignored;clearTimeoutends one early. Setting a timeout, and clearing one that is in force, emitsMemberTimeoutChanged(see Realtime events); its end sends nothing, and a client unlocks atuntil. The member reads the reason on their ownServerMember.timeoutReason, null on every other entry and for every other viewer.
Slow mode #
setSlowMode(serverId, conversationId, seconds): Owner/Moderator, channels only,0..=21600(0turns it off), not on archived channels. Shown asConversation.slowModeSeconds; changes emitConversationUpdated.- While it is on, a member's
sendMessage,replyToMessageor forward into the channel fails withRATE_LIMITED(extensionretryAfterSeconds, rounded up) if their previous message there is younger than the interval. Owner and Moderators are exempt. The check reads the author's lastsent_atin the conversation; no in-memory state.
Posting permissions #
setChannelPosting(serverId, conversationId, policy, allowsThreads): Owner/Moderator, channels only (a DM or group isVALIDATION), not on archived channels (CONVERSATION_ARCHIVED).policyisEVERYONE(the default) orMODERATORS(the workspace's Owner and Moderators);allowsThreads(defaulttruefor a new channel) says whether, underMODERATORS, everyone else may still react and reply in threads, and is ignored underEVERYONE. Shown asConversation.postingPolicyandConversation.postingAllowsThreads(DMs and groups are alwaysEVERYONE); changes emitConversationUpdated. Setting what is already set writes nothing. Also the commandchat.set_channel_posting.Under
MODERATORS, the Owner and Moderators do everything as before. Everyone else (members and guests alike) is refused withFORBIDDEN("only the owner and moderators can post in this channel") as follows:Action allowsThreads: trueallowsThreads: falsesendMessage(timeline replies withparentMessageIdincluded)refused refused forwardMessageinto the channelrefused refused replyToMessage(thread reply)allowed refused adding a reaction allowed refused removing one's own reaction allowed allowed pinMessage/unpinMessagerefused refused editing or deleting one's own messages allowed allowed reading, joining, leaving allowed allowed The check runs after the archive and timeout gates and before slow mode, in the services, so commands, macros, pipelines and requests forwarded from other servers meet it too. Uploading an attachment is not checked; the message that carries it is.
The default workspace's definition file sets it per channel (
docs/self-hosting.md).
Deleting messages #
deleteMessage: the author, or an Owner/Moderator of the workspace who can read the
conversation (a moderator outside a private channel gets NOT_FOUND, like any read). A
moderator delete writes an admin.delete_message audit row with the message id and author (no
text). MessageDeleted is unchanged.
deleteMemberMessages deletes one person's messages in the workspace's channels at once, for
the Owner or a Moderator under the targeting rules above; the person need not be a member any
more. It reaches timeline messages and thread replies in channels, never DMs, groups, the direct
space, encrypted messages or conversations, or archived channels. memberMessageCounts first
tells the caller how many it would reach, split into channels the caller reads (public channels
and private channels the caller is a member of) and private channels the caller is not in, as
numbers only: the names of those channels are not shown. includeUnjoinedPrivate decides
whether the latter are touched. since limits both to messages sent at or after it (null: all of
them). One call deletes at most 1,000 messages, newest first channel by channel, and answers
hasMore while matching messages remain; the client calls again until it is false. Each message
gets the same tombstone as deleteMessage: it reads as deleted, its unread notifications go,
and its pins, reactions, attachments, reports and flag stay hidden behind the deleted message. Each
channel gets one MessagesDeleted event instead of a MessageDeleted per message, and no
MESSAGE_DELETED pipeline runs for a bulk delete.
Flagged messages #
The server checks the messages it can read for sexual text art (drawings made of braille, block, box-drawing or ASCII characters), and flags those that score high.
- What is checked. A message of a workspace whose text the server stores: never an encrypted
message (the server cannot read it), never a message of the direct space (DMs and groups), and
only text that holds an art block. The art block is the longest run of text art lines in the
message (the first when two are equally long). A line is text art when it has at least 8
non-whitespace characters and fewer than half of them are letters or digits; blank lines and
short lines of symbols (fewer than 8 characters, like
||) stay inside a run, and a line of mostly letters or digits ends it. A run counts when it has at least 6 non-blank lines and at least 120 non-whitespace characters. Code, logs and prose are mostly letters and are not checked; a picture inside a longer message is found and the words around it are ignored. - When. After the message is stored, whatever stored it:
sendMessage, a command, a forward, or a request forwarded from another server. Sending never waits for the check. An edit is checked again. - How. Only the art block is sent to the image check service the operator runs next to the
server (
docs/self-hosting.md, "Content check"), which scores how sexual it looks from 0 to- At or above
RIM_TEXT_ART_CHECK_FLAG(0.60) the message is flagged.
- At or above
- What a flag does.
Message.flaggedis true; clients cover the message until the reader chooses to show it.MessageFlagChangedreaches the conversation's readers. The workspace's Owner and Moderators get an automatic report (see "Reports"), and the instance operators an abuse report (docs/operations/relay-public.md). Nothing is refused or deleted. A message that was flagged once keeps its first flag time until the flag is cleared. - Clearing.
clearMessageFlag(serverId, conversationId, messageId): Owner/Moderator (FORBIDDENotherwise;NOT_FOUNDfor a conversation outside the workspace or a message outside the conversation). It answerstrue, and clearing a message that is not flagged succeeds too. An edit that is no longer text art, or scores below the threshold, clears the flag as well. Clearing leaves the reports as they are. - Fail open. When the service is unavailable, slow or busy, the message stays unflagged and
the server logs a warning; it is not checked again until it is edited.
text_art_checkinRIM_FEATURES_DISABLED, or no image check service, turns the check off. - A deleted message reads as not flagged.
Reports #
reportMessage(serverId, conversationId, messageId, reason): any member who can read the message, once per message (CONFLICTon a second report); deleted messages cannot be reported. Allowed while timed out.messageReports(serverId, status, dir, cursor, limit): Owner/Moderator, ordered newest first ((createdAt, id)descending;AFTERwalks toward older reports) with the standard cursor contract (docs/pagination.md). Moderators see every report of the workspace, but the reported message's current text and author (messageText,messageAuthorId) are included only when the moderator can read the conversation (messageReadable); for a private channel they are not in, only the ids and the reporter's reason are shown.resolveReport(serverId, reportId, outcome: RESOLVED | DISMISSED): Owner/Moderator; a report that is no longer open isCONFLICT.- The automatic text art check (see "Flagged messages") files a report when it flags a message:
at most one per message, beside any member's reports, with a null
reporterUserId,automatic: trueand the reasonautomatic text art check: sexual 0.80(the score, two decimals). Moderators list and resolve it like any other. - The direct space has no Owner or Moderator: everyone there is a guest. Its reports (of DMs and
groups) go to the instance operators instead (
docs/api.md, "Instance moderation"):messageReports,messageReportandresolveReportwith the direct space's id (relayInfo.directSpaceId) answer an instance operator and refuse everyone else withFORBIDDEN, an app or bot acting for an operator too. An operator is no member of the conversations there, yet for a report of an unencrypted message sees that one message'smessageText,messageAuthorIdandmessageSentAt(never the rest of the conversation;messageReadablestays false), and for any report whose author is shown the author's principal id (messageAuthorPrincipalId, forinstanceBlockPrincipal). An encrypted message shows its author only through a verified report, as in a workspace.deleteMessagelets the operator delete a reported unencrypted message, or an encrypted one with a verified report, and no other message there. An operator gets nothing else there: no kick, ban, timeout, role change or slow mode.
Audit #
Every moderation action writes one command_audit_log row (initiator moderation) through one
shared helper, whether it came from GraphQL or a command: admin.set_member_role, admin.kick,
admin.ban, admin.unban, admin.timeout, admin.clear_timeout, chat.set_slow_mode,
chat.set_channel_posting, chat.report_message, admin.resolve_report,
admin.delete_message, admin.clear_message_flag (only when a flag was cleared),
admin.delete_member_messages (only when at least one message was deleted; with user_id,
since, include_unjoined_private, the deleted and channels counts, has_more,
was_member and complete, false when an error stopped the call part way). Arguments hold ids
and flags only, never reasons or message text. An action run as a command also gets the generic
command-execution row. Refused actions are not audited by the helper.
The public link writes rows with initiator public_link: public_link.enabled,
public_link.disabled, public_link.reissued and public_link.settings_changed (the Owner's
changes, with the mode, role and allow_remote), join_request.accepted and
join_request.declined (the moderator's decisions, with the request and the person), and
workspace.member_joined with "source": "public_link" for every join through the link (the
joiner's row, with the role and the accepted request's id). Never the token.
A member's own workspace actions write rows with initiator workspace: workspace.leave (with
the role they left) and workspace.rename (the Owner's; no name text).
The automatic text art check writes target: "audit" log lines, not rows: message.flagged
(message, conversation, workspace, author and score) and message.flag_cleared with
by = "check" when an edit clears a flag.
Realtime events #
Two new WorkspaceEvent variants (snake_case fields, like every other variant):
{"type": "MemberLeft", "workspace_id": "…", "user_id": "…"}— a member left, or was kicked or banned. Delivered to the workspace (guests: only about themselves), including the removed user, whose subscription then ends. Optionalcauseisleft,kick,ban,workspace_deletedoraccount_deleted; a temporary ban includesuntil(RFC 3339). For a kick or ban, only the removed user's own delivery includes the moderator's optionalreason. Other members receive no reason. The removed member may keep this explanation until they dismiss it.{"type": "MemberRoleChanged", "workspace_id": "…", "user_id": "…", "role": "member"}—roleisowner,moderator,memberorguest. Same visibility asMemberLeft. A subscriber whose own role changes to or fromguestgets the matching visibility from the next event on.{"type": "MemberTimeoutChanged", "workspace_id": "…", "user_id": "…", "until": "…"}— a moderator timed the member out untiluntil, or cleared the timeout early (untilnull). Same visibility asMemberLeft; only the timed-out member's own delivery includes the moderator'sreason. Listed inserverInfo.capabilitiesasmember_timeout_changed, withServerMember.timeoutReason.{"type": "WorkspaceUpdated", "workspace_id": "…", "name": "…"}: the workspace was renamed. Delivered to every member, guests included.{"type": "MessageFlagChanged", "workspace_id": "…", "conversation_id": "…", "message_id": "…", "flagged": true}: the automatic text art check flagged a message (true), or an Owner, a Moderator or a later check cleared its flag (false). Delivered to everyone who reads the conversation, like the message events: a private channel's to its members only.{"type": "ReadMarkerRewound", "workspace_id": "…", "conversation_id": "…", "user_id": "…"}:user_idmoved their read marker of the conversation back and it changed. Delivered to that person alone, on each of their clients. It carries no counts: a client readsunreadCountsagain. It is not recovered offline, so a client also readsunreadCountswhen it reconnects or opens the workspace. Listed inserverInfo.capabilitiesasread_marker.{"type": "MessagesDeleted", "workspace_id": "…", "conversation_id": "…", "conversation_type": "Channel", "message_ids": ["…"], "thread_ids": ["…"]}:deleteMemberMessagesdeleted these messages of one channel;thread_idsare the distinct threads of the deleted replies. Same visibility asMessageDeleted. A client marks the messages deleted and refreshes the counts of the threads named.
Join requests:
{"type": "MemberJoined", "workspace_id", "user_id", "username", "source": "public_link"}—sourceis present only for a join through the public link, directly or by an accepted request.{"type": "JoinRequestCreated", "workspace_id": "…", "request_id": "…", "user_id": "…"}— a person filed a request.{"type": "JoinRequestDecided", "workspace_id": "…", "request_id": "…", "user_id": "…", "outcome": "accepted"}—outcomeisaccepted,declined,withdrawnorcancelled(a ban).
Both reach the workspace's Owner and Moderators on their workspaceEvents(workspace)
subscription, and the person, who is not a member, on their subscription to their server's
direct space (workspaceEvents(relayInfo.directSpaceId), which a signed-in client keeps open):
workspace_id is still the workspace asked to join. On acceptance the person gets
JoinRequestDecided there and then subscribes to the workspace; MemberJoined goes to its
members as for any join.
A subscription that falls behind loses events, possibly any of these. Before it delivers another event it reads the subscriber's membership and role again: it ends when they are no longer a member (or the read fails), and otherwise goes on with the visibility of their current role.
Reactions #
toggleReaction(serverId, conversationId, messageId, emoji) adds the caller's reaction with
that emoji, or removes it when they already have it, and answers the message's reaction groups.
It needs write access to the conversation and a message that is not deleted.
emoji, trimmed, is 1 to 32 characters and is either a Unicode emoji (pictographs with the components that join, modify or tag them: zero-width joiner, variation selectors, skin tones, hair, keycaps, regional indicators, tags; digits,#and*alone are not one) or a custom emoji's:name:, the name made of letters, digits and underscores. A:name:that starts a new emoji on the message must name a custom emoji of the workspace while thecustom_emojifeature is enabled; with the feature off every new:name:is refused. Adding anything else answersVALIDATION. Removing checks only the length: a reaction the caller holds comes off whatever its text, so one stored before these rules stays removable.- A message carries at most 20 different emoji, and one user puts at most 10 reactions on one
message. Adding past either answers
VALIDATION; joining an emoji the message already has (under the per-user cap) and removing a reaction always work. Toggles on one message run one at a time (the message row is locked), so concurrent toggles cannot pass the caps. - Every toggle sends
ReactionsUpdatedto the conversation's members with all of the message's reaction groups, which the caps bound.
Notification Rules #
The server decides, once per message, who is told about it, and tells a message's author when
someone reacts to it.
For every recipient it stores a notification (the inbox, the bell badge and the email digest) and
sends that user a private NotificationDue event; clients only render what the server decided.
Sound and preview stay device-local client settings.
Settings #
- Per-conversation level (
setConversationNotificationLevel,Conversation.notificationLevel):ALL,MENTIONSorNONE; null inherits the workspace default.Conversation.effectiveNotificationLevelis what applies now:NONEwhile a timed mute is in effect, else the conversation level, else the workspace default. - Workspace settings (
myNotificationSettings,updateNotificationSettings), per user and workspace:defaultLevel(defaultALL; in the server's default workspace, which every account joins,MENTIONS, so a plain message there stores no notification per member unless they choseALL, here or for the conversation),keywords(at most 20, each 2 to 40 characters after trimming, stored lower-cased and deduplicated), a daily do-not-disturb windowdnd(start/endas"HH:MM"in an IANAtimezone; crosses midnight whenend < start;startmust differ fromend),digest(OFF,HOURLY,DAILY;docs/email.md), andreactions(defaulttrue: reactions to the user's messages notify them; null inupdateNotificationSettingskeeps the stored value). - Do-not-disturb pause (
setDoNotDisturb, commandnotifications.dnd): on until turned off, or until an instant (dndPaused,dndPausedUntil). It is separate from the daily window andupdateNotificationSettingsleaves it alone. - Mutes keep working:
muteConversationwithmutedUntilis a timedNONE(it clears aNONElevel so the mute really ends; another level stays); withoutmutedUntilit sets levelNONE.unmuteConversationclearsmutedUntiland aNONElevel.isMutedis true for a timed mute in effect or levelNONE;mutedConversationslists rows with levelNONEor anymutedUntil.
The decision, per member except the author #
- Candidates are the conversation's members (the list its events go to): a private channel never notifies a non-member, and a public-channel reader who has not joined is not notified. A timeout does not affect receiving.
- A timed mute in effect yields nothing.
- Effective level = conversation level, else workspace default.
NONEyields nothing, direct messages and mentions included. - Reason, strongest first:
direct(a Direct conversation),mention(<@user>naming the member, or@channel/@hereas a whole word; in the server's default workspace these two notify only from its Owner or a Moderator and are plain text from anyone else),keyword(a keyword as a whole word, case-insensitive, outside<@…>tokens),thread_reply(a reply in a thread whose root the member wrote or where they replied), elseall. MENTIONSadmits every reason butall;ALLadmits everything.- Inside the do-not-disturb window (in the user's timezone) or pause the notification is still
stored, but the event carries
quiet: trueso clients neither toast nor play a sound.
Reactions #
A reaction added to a message (toggleReaction that adds, not one that removes) tells its author,
with reason reaction:
- Never about their own reaction or a deleted message, and only while the author is still a member of the conversation.
- A timed mute in effect, effective level
NONE, or thereactionssetting off yields nothing.MENTIONSandALLadmit it. - Inside do-not-disturb it is stored and the event is
quiet, as for messages. - The author has at most one reaction notification per message. The first reaction inserts it;
each later one replaces its emoji and reactor, marks it unread and moves its
createdAtto now, so the entry surfaces again.NotificationDueis sent when the entry is new, was read, or was last surfaced more than 10 minutes ago; a reaction replacing an unread entry from the last 10 minutes updates it silently, so reacting and un-reacting in a loop cannot make the author's client toast. A notification the message already has for another reason (a mention, say) is left as it is, and no event is sent. - Best-effort, after the reaction commits: a failure is logged and never fails the reaction.
Digest emails list messages only: reaction notifications never trigger, nor appear in, a
digest. Reading the conversation (markAsRead) marks them read like any other notification of
its messages.
One message yields at most one notification per user (unique (user, message)). Notifications
are created after the message commits (sendMessage, replyToMessage, and forwards into the
target conversation) and best-effort: a failure is logged and never fails the send. Edits do not
notify again. Deleting a message deletes its unread notifications (read ones stay).
UserMentioned is still emitted for the mentions view.
Inbox #
myNotifications(serverId, unreadOnly, dir, cursor, limit): newest first (createdAt DESC, id DESC, standard cursors;AFTERgoes to older ones). Each item hasreason,createdAt,readAtand nestedconversation/message, which are null once the viewer can no longer read the conversation. AREACTIONitem also hasreactionEmojiandreactedBy(the latest reaction); both are null for every other reason.myUnreadNotificationCount(serverId);markNotificationsRead(serverId, ids | allBefore)(exactly one; returns how many changed; ids of other users are ignored).markAsReadon a conversation also marks its notifications for messages sent up toreadAtread, in the same transaction;markAllAsReadmarks every notification of the workspace read.markAsUnreadleaves notifications alone: one already read stays read.- Notifications older than 90 days are deleted hourly.
NotificationDue event #
{"type": "NotificationDue", "workspace_id": "…", "user_id": "…", "notification_id": "…",
"conversation_id": "…", "message_id": "…", "reason": "mention", "quiet": false}
reason is direct, mention, keyword, thread_reply, all or reaction. A reaction
event adds reaction_emoji and reaction_by (the reactor's user id); the two keys are absent
from every other event:
{"type": "NotificationDue", "workspace_id": "…", "user_id": "…", "notification_id": "…",
"conversation_id": "…", "message_id": "…", "reason": "reaction", "quiet": false,
"reaction_emoji": "👍", "reaction_by": "…"}
The event is delivered only to user_id (the server-side scope list is [user_id]), guests
included.
notificationEvents carries the same notifications as a typed object, with no other event, from
every workspace on this server at once, so a client can tell its person about workspaces it has
not opened with one subscription. It takes no workspace and checks no membership: the server
stores notifications only for members. A conversation in the viewer's request inbox, or one they
blocked, stays quiet as on workspaceEvents. A workspace hosted on another server is not on it:
those events reach the person through relayStream. A server with it lists notification_events
in serverInfo.capabilities.
Titles #
ChannelandGroupconversations may have an optionaltitle.- Empty or whitespace-only titles are normalized to
None. Directconversations cannot have titles.
Timeline And Threads #
- Every message belongs to a
conversation_id. - A timeline message has
thread_id = None. - A thread reply has
thread_id = Some(thread_id). - Creating a thread from a timeline message is optional.
- The root message remains in the main timeline after a thread is created.
- Replies inside the thread live only in the thread view; they do not appear in the main timeline listing.
Message.editedAtis when the text last changed (for an encrypted message, its envelope), null for a never-edited or deleted message, the valueMessageChange.editedAtcarries.MessageUpdatedevents carry it asmessage.edited_at. A server with it listsmessage_edited_atinserverInfo.capabilities.Message.postedViasays how a message was posted when not by the person's own client:AGENTfor a message anexecuteCommandcall with the initiatorAGENTposted (chat.post_messageorchat.reply_to_selected_message, directly or as a step of a macro the agent ran), null otherwise and for a deleted message. The message is still the person's and carries their name; a client shows a small mark next to it. The initiator is the client's word, so the mark is too: a client that does not say it is the agent posts unmarked. The mark stays when the message is edited.sendMessage, the bot API, pipelines and a forward post unmarked messages, and an encrypted message is never marked.NewMessageandMessageUpdatedevents carry it asmessage.posted_via("agent"or null), and the change feed'sMessageChange.messageaspostedVia. A server with it listsmessage_posted_viainserverInfo.capabilities.
Reply Semantics #
- Timeline replies use
parent_message_idand still stay in the main timeline. - Thread replies may point to:
- the root timeline message for the thread, or
- another message already inside the same thread.
- A message from another conversation or another thread is rejected as a reply parent.
thread_id vs root_thread_id #
thread_idNonefor main timeline messagesSome(thread_id)for thread replies
root_thread_idSome(thread_id)only for a timeline message that is the root of an existing threadNonefor ordinary timeline messagesNonefor thread replies
threadReplyCount- the number of replies in the thread a timeline message is the root of, deleted replies not
counted;
0once every reply is deleted nullwhereverroot_thread_idisNone: ordinary timeline messages and thread replies
- the number of replies in the thread a timeline message is the root of, deleted replies not
counted;
This lets clients render the timeline normally while also knowing whether a timeline message can open an existing thread.
Attachments #
- Sending a message takes no attachments; the author adds them to a message they already sent.
createAttachment(serverId, conversationId, messageId, filename, contentType, sizeBytes): only the message's author, at most 25 MB. The declared size is reserved against the workspace quota (RIM_MAX_WORKSPACE_STORAGE_BYTES), the attachment is stored as pending upload, the message'shas_attachmentsis set, and the answer is an upload ticket: the attachment id, an upload token, the size limit and an expiry. A ticket lasts 5 minutes, and one account holds at most 5 open tickets at once; a further call is refused until one is used or has expired.POST /api/files/upload(multipart:upload_token,attachment_idand one file) stores the bytes and marks the attachment uploaded; a file larger than declared is refused.finalizeAttachmentmarks an uploaded attachment ready.deleteAttachmentremoves it and refresheshas_attachments.- An upload still pending 5 minutes after it started is marked failed by the stale-attachment
cleanup job (
docs/operations/background-jobs.md). - Reading an attachment (
GET /api/attachments/{id}/download) needs workspace membership and read access to the conversation of its message. The attachments of a deleted message answer 404 at once, and the hourly cleanup job deletes their files, except those of a reported message, which stay for the report. - In an encrypted conversation the client uploads the encrypted blob:
createAttachmentthen requiresblobSha256, a fixed file name and type, and the upload is checked against the hash (docs/specs/e2ee-mls-v1.md, "Attachments"). - The
attachmentsinstance feature switches all of this off (docs/operations/features.md).
Pagination #
- Timeline messages:
ORDER BY sent_at DESC, id DESC - Thread messages:
ORDER BY sent_at DESC, id DESC - Inbox conversations:
ORDER BY last_activity_at DESC, id DESC - Channels:
ORDER BY created_at ASC, id ASC(filtered byChannelListFilter:joinedOnly,includeArchived; both default tofalse)
Cursor pagination uses overfetch (limit + 1) so next and prev reflect actual additional data, not page-size guesses.
Permalinks #
- A timeline message's permalink is
/workspaces/{server}/conversations/{conversation}/messages/{message}. - A thread reply's permalink is
/workspaces/{server}/conversations/{conversation}/threads/{thread}/messages/{message}. - The email digest links each message by its permalink.
Profile changes #
MemberProfileUpdated {workspace_id, user_id} announces a successful local profile update.
It carries no profile fields. Workspace members refetch their member directory; guests see
only their own event. In the local direct space the account's own sessions receive it and
refetch me. A client showing the changed account's own profile invalidates me too. It
uses the directory stream rules (w for members and the subject's u: stream for guests).
Profiles published by another server are unchanged by this event.
Ban changes #
MemberBanChanged {workspace_id, user_id} follows every successful ban and unban, including
pre-emptive bans. It carries no reason. It follows directory visibility and stream rules;
clients refetch workspace message-author ban status. Ban expiry is evaluated from until
and the next query, without a scheduled event.