CLEMA protocol

Field Limits

Values exceeding these limits are rejected with invalid_format.

Field Limit
operation_id 128 characters
Reaction 32 characters
phone E.164: + followed by 8–15 digits
Confirmation code Digits only, code_length of them
app_hash 11 characters of the Base64 alphabet
language BCP 47 tag, at most 35 characters
Push token 1–4096 characters
Address book changes 500 entries per request, add and remove together
Address book entry name 64 characters, single line
Address book size 5000 entries per device
Message text 4096 characters
Draft text 12288 characters
Mentions per text message or draft 32
Smileys per text message or draft 100
Installed smiley packs 100
File name 255 characters, no path separators
File size 1 byte–1 TiB
File content_type Valid media type, at most 255 bytes, or empty
nick, first_name, last_name 64 characters, single line
about 1024 characters
birthday YYYY-MM-DD, --MM-DD without the year, or empty
gender male, female or empty
Custom status emoji One emoji: up to 16 characters, none of them a letter, blank or control character
Custom status text 64 characters after trimming, single line
Custom status until A moment in the future
Search query 2–64 characters
History limit 1–100 messages (default: 50)
Conversation title 1–100 characters after trimming
Conversation description 1000 characters
Initial member_ids At most 100 entries
Invitation expires_in 60 seconds–30 days (default: 7 days, none when permanent)
Invitation max_uses 1–100 (default: 1 when addressed, none when shareable)
Invitation name 5–32 Latin letters, digits and underscores; a letter first, no underscore last; shareable invitations only
Moderation reason 500 characters
Ban/restriction duration At most one year
Conversation slow_mode_seconds 0–86400 seconds

A single WebSocket message may not exceed 64 KB by default; the limit is configurable server-side.

Characters are Unicode code points. A text longer than a message holds is the client's to send as several messages, in order, each its own operation. Clients cut it alike, as a person would: at a blank line, else at a line break, else after a sentence, else at a space, looking only in the second half of what fits so that no message comes out much shorter than it could be, and where it stops fitting only when there is nowhere else; the blanks a cut falls on go with it, a mention is never cut, and a reply goes with the first message.