CLEMA protocol

Account Standing

What an account may not do, as the service's staff decided, and how large a file it may send. Every client of the service keeps to it — over CLEMA, through a transport or the Bot API — and a client reads it to show its person what is barred before they try.

{"id":"1","type":"account.get"}
{
  "id": "1",
  "type": "account.get",
  "ok": true,
  "data": {
    "restrictions": [
      {"kind": "links", "until": "2026-10-28T15:00:00Z", "reason": "Spam"}
    ],
    "limits": {"file_size": 15728640, "transfer_size": 104857600}
  }
}

limits are how large a file the account may send, in bytes: file_size for a stored file sent in a message and transfer_size for a direct transfer — the server's own, 15 MiB and 100 MiB by default, unless staff gave the account others. A client says a file is too large before it starts to send it, and may offer a larger one directly instead.

restrictions are those in force, each of one kind, until until or, without it, until staff lift it, for the reason they gave. What each kind refuses, with restricted naming the restriction:

Kind Refuses
banned Everything: the account's sessions end (session.revoked with reason banned, after account.updated says so), auth.code for its number is refused — with when the ban ends, not why: whoever asks has not shown the number is theirs — and it signs in through no transport. A banned bot is answered restricted by the Bot API and hears nothing: what comes for it waits. The bots of a banned account are accounts of their own, and go on
send message.send, message.forward, message.edit, transfer.create, and file.create: a file is kept to be sent
files A file message other than a voice message, sent or forwarded, and transfer.create; file.create too where voice bars the rest
voice A voice message, sent or forwarded
links A link in a message's text or a button, sent, forwarded or edited into it, and in a group's title or description
avatar Setting the account's picture, or a group's; taking one away is left
profile profile.update, a custom status set with presence.set, and a group's title or description changed with conversation.update; clearing a status, or hiding, is left
create_groups conversation.create of a group
create_channels conversation.create of a channel
bots Making bots and managing them with the system bot
transports Signing in through a transport: its sessions end, and its clients are told the account is suspended once they give the right password
{
  "id": "7",
  "type": "message.send",
  "ok": false,
  "error": {
    "code": "restricted",
    "message": "The account may not send links until 2026-10-28T15:00:00Z: Spam",
    "restriction": {"kind": "links", "until": "2026-10-28T15:00:00Z", "reason": "Spam"}
  }
}

A restriction past its until counts for nothing, so a client stops showing it then without being told. Any other change reaches every connection of the account as account.updated, with the body account.get answers, and the account hears of it from Mandarin: what it may no longer do, for how long and why, and when a restriction is lifted. Like transport.updated, account.updated belongs to no stream and carries no seq: a client calls account.get after authenticating.