Appearance
Messaging
All routes are under /v1, need a signed-in user (Authorization: Bearer), and answer { data, meta } or RFC 9457 problems. "Device" routes also need the session to be bound to a device (MESSAGING_DEVICE_REQUIRED). Clients use the Signal protocol (X3DH/PQXDH + Double Ratchet; sender keys in groups). The server stores public keys, ciphertext envelopes and metadata only: it can never read a message, so content search happens on the device.
Reactions are stored as plain emoji (max 32 chars). They show who reacted with what, which the server already knows from the interaction itself. Storing them this way lets the server keep one reaction per person, count reactions for 1,024-member groups without fanning ciphertext out to every device, and show them on devices added later.
Poll option labels are ciphertext sealed by the client. Votes are plain option indexes, so the server can count them.
Keys
| Method | Path | Body / query | Response | Errors |
|---|---|---|---|---|
| PUT | /messaging/keys/devices/me | registrationId, identityKey, signedPreKey{keyId,publicKey,signature}, kyberLastResortPreKey?, preKeys[]≤100, kyberPreKeys[]≤100 | {ec, kyber} stock | MESSAGING_PREKEY_LIMIT, VALIDATION_FAILED |
| PUT | /messaging/keys/devices/me/signed-prekey | signedPreKey, kyberLastResortPreKey? | ok | MESSAGING_DEVICE_KEYS_MISSING |
| POST | /messaging/keys/devices/me/prekeys | preKeys[], kyberPreKeys[] | {ec, kyber} (201) | MESSAGING_PREKEY_LIMIT |
| GET | /messaging/keys/devices/me/prekeys/count | – | {ec, kyber} | MESSAGING_DEVICE_KEYS_MISSING |
| GET | /messaging/keys/users/:userId/devices | – | [{deviceId, registrationId, identityKey, identityKeyChangedAt}] | MESSAGING_BLOCKED |
| POST | /messaging/keys/users/:userId/bundles | deviceIds?[] | [Bundle]: one one-time EC and Kyber prekey claimed atomically per device, falling back to the last-resort Kyber key | MESSAGING_BLOCKED, MESSAGING_DEVICE_KEYS_MISSING, RATE_LIMITED |
A new identity key drops the device's old prekeys and emits keys:changed to everyone who shares a chat with that person. Low stock (fewer than 20) emits keys:low to the device.
Settings and presence
| Method | Path | Body / query | Response |
|---|---|---|---|
| GET | /messaging/settings | – | whoCanMessage, whoCanCall, whoCanAddToGroups (each everyone/followers/mutuals/nobody), readReceiptsEnabled, typingIndicatorsEnabled, lastSeenVisibility, onlineVisibility (each everyone/contacts/nobody), defaultDisappearingSeconds |
| PATCH | /messaging/settings | any subset of the above | settings |
| GET | /messaging/presence?userIds=a,b | ≤100 ids | [{userId, isOnline|null, lastSeenAt|null}]. null means hidden. Visibility is reciprocal |
People outside a user's whoCanMessage audience start a message request, shown in the requests folder. A user set to nobody refuses with MESSAGING_CHAT_DISABLED. A chat the user has already accepted stays open under any setting except nobody.
Conversations
| Method | Path | Body / query | Response | Errors |
|---|---|---|---|---|
| GET | /messaging/conversations | folder=all|unread|groups|archived|requests, cursor, limit | page of ConversationView. Pinned chats lead the first all page | – |
| GET | /messaging/conversations/search | q, limit≤50 | [ConversationView] matching a group title, or a member's name or handle | – |
| POST | /messaging/conversations/direct | {userId} | ConversationView (201 new, 200 existing) | MESSAGING_SELF_CHAT, MESSAGING_BLOCKED, MESSAGING_CHAT_DISABLED, MESSAGING_RECIPIENT_NOT_FOUND |
| POST | /messaging/conversations/groups | title, description?, memberUserIds[], settings?, disappearingSeconds? | {conversation, refusedUserIds} (201) | – |
| GET | /messaging/conversations/:id | – | ConversationView | MESSAGING_NOT_MEMBER |
| PATCH | /messaging/conversations/:id | title?, description?, settings?{onlyAdminsSend, onlyAdminsEditInfo, onlyAdminsAddMembers, joinApprovalRequired} | ConversationView | MESSAGING_PERMISSION_DENIED, MESSAGING_DIRECT_IMMUTABLE |
| PUT | /messaging/conversations/:id/disappearing | {seconds: 5..7776000|null} | ConversationView | MESSAGING_PERMISSION_DENIED |
| PATCH | /messaging/conversations/:id/state | pinned?, archived?, mutedUntil?, markedUnread? | ConversationView | MESSAGING_CHAT_PIN_LIMIT (3) |
| POST | /messaging/conversations/:id/clear | {keepStarred=true} | ConversationView | – |
| POST | /messaging/conversations/:id/request | {decision: accept|decline|block} | ok | – |
| GET | /messaging/conversations/:id/members | cursor, limit | page of {userId, role, joinMethod, addedByUserId, joinedAt} | – |
| POST | /messaging/conversations/:id/members | {userIds[]≤256} | {addedUserIds, alreadyMemberUserIds, refusedUserIds} | MESSAGING_MEMBER_LIMIT (1024), MESSAGING_PERMISSION_DENIED |
| DELETE | /messaging/conversations/:id/members/:userId | – | ok (removes, or leaves if it's you) | MESSAGING_PERMISSION_DENIED |
| PUT | /messaging/conversations/:id/members/:userId/role | {role} | ok (owner transfers ownership) | MESSAGING_PERMISSION_DENIED |
| POST | /messaging/conversations/:id/leave | – | ok (the longest-serving admin inherits ownership) | – |
| GET | /messaging/conversations/:id/invites/primary | – | the group's main InviteView (created on first request; no expiry or use limit) | MESSAGING_PERMISSION_DENIED |
| POST | /messaging/conversations/:id/invites/primary/rotate | – | new main InviteView; the old code stops working immediately | MESSAGING_PERMISSION_DENIED |
| POST | /messaging/conversations/:id/invites/reset | – | every link is revoked and a fresh main InviteView is returned | MESSAGING_PERMISSION_DENIED |
| POST | /messaging/conversations/:id/invites | extra link: expiresInSeconds? (default 7 d, null = no expiry), maxUses?, requiresApproval? (null = use the group's setting) | InviteView (201) | MESSAGING_PERMISSION_DENIED |
| GET | /messaging/conversations/:id/invites | – | [InviteView] | – |
| DELETE | /messaging/conversations/:id/invites/:inviteId | – | ok | MESSAGING_INVITE_INVALID |
| GET | /messaging/invites/:code | guest-safe, no sign-in needed | {conversationId (members only), title, description, avatarUrl, memberCount, requiresApproval, isMember (null for guests), joinUrl}; never the member list | MESSAGING_INVITE_INVALID, MESSAGING_INVITE_EXPIRED (both suggest asking an admin for a new link) |
| POST | /messaging/invites/:code/join | sign-in required: a guest gets UNAUTHENTICATED with a sign_in action whose deep link returns them to the invite | {status: joined} or {status: requested, requestId} | MESSAGING_ALREADY_MEMBER, MESSAGING_JOIN_REQUEST_PENDING, MESSAGING_MEMBER_LIMIT |
| GET | /messaging/conversations/:id/join-requests | – | [JoinRequestView] | admins only |
| POST | /messaging/conversations/:id/join-requests/:requestId/approve | /reject | – | JoinRequestView | MESSAGING_JOIN_REQUEST_NOT_FOUND |
| DELETE | /messaging/join-requests/:requestId | – | ok (cancel your own) | – |
Messages
| Method | Path | Body / query | Response | Errors |
|---|---|---|---|---|
| POST | /messaging/messages (device) | SendMessage (below) | 201 {status: sent, message}, or 409 {status: device_mismatch, missing/extra/duplicatedDeviceIds} / {status: sender_key_missing, deviceIds} | MESSAGING_NOT_MEMBER, MESSAGING_PERMISSION_DENIED, MESSAGING_BLOCKED, MESSAGING_REQUEST_DECLINED, MESSAGING_CHAT_DISABLED, MESSAGING_ATTACHMENT_INVALID |
| PATCH | /messaging/messages/:id (device) | envelopes, sharedCiphertext?, senderKeyDistributionId?, hasLink? | same as send | MESSAGING_EDIT_WINDOW_CLOSED (15 min), MESSAGING_NOT_EDITABLE |
| DELETE | /messaging/messages/:id?scope=me|everyone | – | ok. everyone leaves a tombstone (sender, or a group admin, within 60 h) | MESSAGING_DELETE_WINDOW_CLOSED, MESSAGING_PERMISSION_DENIED |
| GET | /messaging/conversations/:id/messages | cursor, limit | page of MessageMeta (no content), newest first | – |
| GET | /messaging/conversations/:id/shared | category=media|files|audio|links|polls, cursor, limit | page of MessageMeta | – |
| GET | /messaging/conversations/:id/pins | – | [{messageId, pinnedByUserId, pinnedAt, expiresAt}] | – |
| POST | /messaging/conversations/:id/seen | {upToMessageId} | {updated} | – |
| GET | /messaging/devices/me/envelopes (device) | cursor, limit≤500 | page of Delivery: the offline queue | – |
| POST | /messaging/devices/me/envelopes/ack (device) | {messageIds[]≤500} | {updated}. Deletes the ciphertext and marks the messages delivered | – |
| POST | /messaging/sender-keys (device) | {conversationId, distributionId, envelopes[{deviceId,type,ciphertext}]} | {missingDeviceIds} (201) | MESSAGING_DEVICE_MISMATCH |
| GET | /messaging/devices/me/sender-keys (device) | – | pending sender-key distributions | – |
| POST | /messaging/devices/me/sender-keys/ack (device) | {ids[]} | ok | – |
| POST | /messaging/messages/:id/played | – | ok (voice notes and media) | – |
| GET | /messaging/messages/:id/receipts | – | [{userId, status, deliveredAt, seenAt, playedAt}] (sender only) | MESSAGING_PERMISSION_DENIED |
| PUT | /messaging/messages/:id/reaction | {emoji|null} | ok | – |
| PUT / DELETE | /messaging/messages/:id/star | – | ok | – |
| GET | /messaging/starred | cursor, limit | page of MessageMeta | – |
| PUT | /messaging/messages/:id/pin | {durationSeconds: 86400|604800|2592000|null} | ok | MESSAGING_PIN_LIMIT (3) |
| DELETE | /messaging/messages/:id/pin | – | ok | – |
| GET | /messaging/messages/:id/poll | – | PollView | – |
| PUT | /messaging/messages/:id/poll/vote | {optionIndexes[]} (empty clears your vote) | PollView | MESSAGING_POLL_CLOSED, MESSAGING_POLL_INVALID |
| POST | /messaging/messages/:id/poll/close | – | PollView (sender only) | – |
SendMessage fields:
conversationId, andclientMessageId(the idempotency key, per device).kind: one oftext,image,video,audio,voice_note,file,song_share,moment_reply,poll,contact,location.envelopes[{deviceId, type: prekey|whisper|sender_key, ciphertext?}]: one envelope for every device of every member, plus the sender's other devices.sharedCiphertextandsenderKeyDistributionId: required whensender_keyenvelopes are used.- Optional:
replyToMessageId,forwardOfMessageId,hasLink,mentionedUserIds,mentionsEveryone,momentId(required formoment_reply),attachmentIds, andpoll{options[{labelCiphertext}] 2..12, allowsMultiple, closesAt?}.
Attachments and search backups
| Method | Path | Body | Response | Errors |
|---|---|---|---|---|
| POST | /messaging/attachments | conversationId, mediaKind, contentType, byteSize, ciphertextSha256 | {id, uploadUrl, uploadExpiresAt} (201). PUT the encrypted blob to uploadUrl | MESSAGING_ATTACHMENT_INVALID (too large) |
| POST | /messaging/attachments/:id/complete | – | AttachmentView | MESSAGING_ATTACHMENT_INVALID (size mismatch) |
| GET | /messaging/attachments/:id/download | – | {url, byteSize, ciphertextSha256, expiresAt} | MESSAGING_ATTACHMENT_NOT_FOUND |
| PUT | /messaging/search-backups/me (device) | byteSize, ciphertextSha256, indexVersion | {backup, uploadUrl} | – |
| POST | /messaging/search-backups/me/complete (device) | – | BackupView | MESSAGING_BACKUP_NOT_FOUND |
| GET | /messaging/search-backups | – | [BackupView] for every device of yours | – |
| GET | /messaging/search-backups/:id/download | – | {url, backup} | MESSAGING_BACKUP_NOT_FOUND |
| DELETE | /messaging/search-backups/me (device) | – | ok | – |
Socket namespace /chat
Every command is acknowledged with {ok, data} or {ok:false, error:{code, message}}.
| Command | Payload | Ack |
|---|---|---|
message:send | SendMessage | SendResult |
message:edit | {messageId, edit} | SendResult |
message:delete | {messageIds[], scope} | ok |
message:delivered | {messageIds[]} | {updated} |
message:seen | {conversationId, upToMessageId} | {updated} |
message:played | {messageId} | ok |
message:react | {messageId, emoji|null} | ok |
typing:start / typing:stop | {conversationId, mode?: text|audio} | ok (never stored) |
envelope:sync | {cursor?, limit?} | {items: Delivery[], nextCursor, hasMore} |
senderkey:distribute | as REST | {missingDeviceIds} |
senderkey:ack | {ids[]} | ok |
presence:ping | {} (every 30–60 s) | ok |
presence:get | {userIds[]} | [Presence] |
| Emit | Payload | To |
|---|---|---|
message:new / message:edited | Delivery (with this device's ciphertext) | each device room |
message:deleted | {conversationId, messageId, deletedAt} | members |
message:status | {conversationId, messageId, userId, status, at} | sender |
message:reacted | {conversationId, messageId, userId, emoji|null, at} | members |
message:pinned / message:unpinned | {conversationId, messageId, byUserId?, expiresAt?} | members |
poll:voted | {conversationId, messageId, userId, optionIndexes} | members |
typing:started / typing:stopped | {conversationId, userId, mode?} | other members |
conversation:updated | {conversationId, change} | members |
chat:state | {conversationId, pinnedAt, archivedAt, mutedUntil, isMarkedUnread, clearedThroughMessageId, lastReadMessageId, requestState} | your own devices |
join-request:created | {conversationId, requestId, userId} | group admins |
senderkey:received | {id, conversationId, distributionId, senderUserId, senderDeviceId, type, ciphertext} | device |
senderkey:rotate | {conversationId} | members (after someone leaves) |
keys:low | {ecRemaining, kyberRemaining} | device |
keys:changed | {userId, deviceId} | everyone sharing a chat |
Offline devices get a push with no content: "Plemuz / New message", collapsed per chat. It is skipped for muted chats unless the person was mentioned. Undelivered envelopes are dropped after MESSAGING_ENVELOPE_RETENTION_DAYS (default 30).
By profile
POST /messaging/conversations/direct takes { profileId } or { handle } as well as { userId }; group create takes memberProfileIds, and adding members takes profileIds. Names for member IDs come from GET /people?userIds=.
Members by profile
POST /messaging/conversations/direct takes { userId }, { profileId } or { handle }. Group create takes memberProfileIds, and POST .../members takes profileIds beside userIds. Unknown profiles answer PROFILE_NOT_FOUND.