This page walks through the protocol one request at a time, as a bot would use it: find the server for a domain, read its metadata, authenticate with a bot token, join a channel, post a message, page the history, and then watch the same channel on the event WebSocket. Each step shows the exact request, a response, and the rules that matter at that point, with links to the specification for the full text.

The tour uses an insecure channel and an insecure bot, because that path needs no keys. Secure channels use the same endpoints with a different message body (see Posting in a secure channel).

Note

The examples are illustrative. They follow the specification's own examples, and every member name, status code and rule is taken from it, but the server is imaginary. These values are placeholders that a real server will give you differently: the base URL https://chat.sloppyvoice.com/server, the bot token, the invite code, every ctx, mid, did, inc and envelope id, every seq and headSeq, every timestamp, and the community, channel and account names. Where a response is shortened, the text says so.

What you need

  • dig (or any tool that shows DNS TXT records).
  • curl and jq.
  • websocat, or any WebSocket client that lets you set the Sec-WebSocket-Protocol header and type text messages.
  • A way to make UUIDv7 values. uuidgen --time-v7 from a recent util-linux prints one in the lowercase form the protocol requires.
  • A bot token for a bot account on the server you are testing, and an invite to that server's community whose creator holds manage_bots (09 §4.4).

A bot token is created by the bot's owner, a local user account that holds manage_bots, with POST /v1/bots from a signed-in client that has authenticated freshly. The token appears only in that response; the server can't show it again (05 §15.2). Accounts and sign-in covers bot creation and user sign-in.

Set two shell variables. You will fill in the first one in the next three steps.

BASE=https://chat.sloppyvoice.com/server
export SV_TOKEN='svb_QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl8'

Find the server

An address such as weatherbot@sloppyvoice.com names an account on whichever server the domain sloppyvoice.com delegates to. The delegation is a DNS TXT record at _sloppyv. followed by the domain, never at the bare domain, so that it can coexist with a CNAME and with SPF and verification records (02 §3.1).

dig TXT _sloppyv.sloppyvoice.com
;; ANSWER SECTION:
_sloppyv.sloppyvoice.com. 3600	IN	TXT	"v=sv1 url=https://chat.sloppyvoice.com/server"

How to read the answer (02 §3.2, §3.4):

  • The record text is all the character-strings of one record joined with nothing between them. dig shows a long record as several quoted strings; join them before parsing.
  • Split the text at white space. A record whose first token isn't v=sv1 (compared case-insensitively) is foreign and ignored, so SPF records and future v=sv2 records don't get in the way.
  • A valid sv1 record has exactly one url= parameter, no repeated parameter names, and at most 1,024 octets of text. Other parameters are ignored.
  • Several sv1 records that all name the same base URL are fine. A malformed sv1 record, or two that name different base URLs, is discovery.record_invalid, and the .well-known fallback is not tried, because the operator clearly meant to publish a record.
  • No record at all (NXDOMAIN, NODATA or only foreign records) sends you to the fallback in the next section.

The url value is the server's base URL. Normalize it before you store or compare it: lowercase the scheme and host, drop a :443 port and one trailing /, and reject anything with a query, fragment, userinfo or IP-address host (02 §3.3). Every comparison of base URLs in the protocol uses the normalized form, so https://Chat.sloppyvoice.com:443/server/ and https://chat.sloppyvoice.com/server are the same server.

The smallest TTL in the answer, including any CNAME in the chain, sets how long you may cache the delegation, clamped to 300 s to 86,400 s (02 §3.5, §13.1).

The resolver also records how strongly the delegation is authenticated, its evidence level (02 §9.1). The levels are tested in order and dnssec comes first, so a DNSSEC-validated answer would be dnssec. Without DNSSEC, the base URL's host chat.sloppyvoice.com shares the registrable domain sloppyvoice.com with the queried domain, so the evidence is same-site. Evidence matters for pinning and federation, not for this tour; Discovery explains it.

Note

Browsers can't send TXT queries. A web client asks its home server with GET /v1/resolve and then checks the metadata itself. It falls back to DNS-over-HTTPS only when the home server gives no usable answer, never after a discovery.* error or a 429 from it, because DoH would bypass the home server's pins (02 §5.4).

The .well-known fallback

A domain owner who can't publish a TXT record can serve a two-member JSON document at the domain's own HTTPS origin instead, with Access-Control-Allow-Origin: * so that web clients on the DoH path can read it (02 §4.1, §4.2):

curl -sS https://sloppyvoice.com/.well-known/sloppyv
{ "v": "sv1", "url": "https://chat.sloppyvoice.com/server" }

The record takes precedence. A resolver fetches this document in exactly three cases (02 §4.3):

  1. there is no discovery record (the document's url becomes the delegation; if the document is absent too, the result is discovery.not_found);
  2. the DNS lookup failed temporarily (the document's answer is cached for at most 300 s);
  3. a valid record would otherwise have only dns-only evidence (servers MUST check; native clients SHOULD for their home server at sign-in); if the document names a different base URL, the result is discovery.delegation_conflict.

In this tour the record exists and is same-site, so a real resolver wouldn't fetch the document at all. The fetch follows at most 3 redirects, all HTTPS, and allows 5 s to connect and 10 s in total. Two outcomes are easy to confuse (02 §4.1, §4.2):

  • A document whose v isn't "sv1", a 404 or 410, or a fourth redirect counts as absent, as if there were no document.
  • A 200 body that isn't a JSON object, lacks a member, has an invalid url or exceeds 4,096 octets is invalid, which in cases 1 and 2 gives discovery.record_invalid.

Read ServerMetadata

The base URL serves one unversioned, unauthenticated document, GET /meta. It is unversioned so that a client of any protocol version can learn which versions the server speaks (02 §7.1).

curl -sS -i "$BASE/meta"

Don't add -L: servers MUST NOT redirect /meta, and a consumer MUST NOT follow a redirect, because the base URL is the server's identity (02 §7.1).

HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: max-age=3600
Access-Control-Allow-Origin: *

The body is a ServerMetadata object. This is the specification's example from 02 §7.5, shortened: keys, keyChain, contact, software, the required endpoints.push member, the third (staff) login provider and the terms and privacy links are left out. A real document always has keys, keyChain and endpoints.push (02 §7.2, §7.3.1).

{
  "canonicalDomain": "sloppyvoice.com",
  "domains": ["sloppyvoice.com", "chat.sloppyvoice.com"],
  "name": "Sloppy Voice",
  "description": "The original Sloppy Voice community. Everyone welcome.",
  "icon": "https://chat.sloppyvoice.com/server/static/icon-256.png",
  "secure": false,
  "securedAt": null,
  "versions": ["1.0"],
  "minClient": "1.0",
  "features": ["voice-dc/1", "video-dc/1", "sfu-rtp/1", "webhooks"],
  "endpoints": {
    "api": "https://chat.sloppyvoice.com/server",
    "relayUrl": "https://relay.sloppyvoice.com/r1"
  },
  "auth": {
    "providers": [
      { "id": "google", "name": "Google", "type": "google" },
      { "id": "github", "name": "GitHub", "type": "github" }
    ],
    "registration": "open"
  },
  "limits": {
    "maxRequestBytes": 1048576,
    "maxEventBytes": 1048576,
    "maxMessageBytes": 16384,
    "maxAttachmentBytes": 26214400,
    "maxSecureLeaves": 1000,
    "maxGroupDmParticipants": 25,
    "maxDmRequestBytes": 65536
  },
  "links": {
    "join": "https://sloppyvoice.com/j{/local}{?invite}",
    "web": "https://app.sloppyvoice.com/"
  },
  "updatedAt": "2026-12-04T09:00:00.000Z"
}

Resolution isn't finished until the metadata passes these checks. The first three are part of validating the document (02 §7.4); the last two are steps 8 and 9 of the resolution algorithm, which run after it (02 §5.2). The full validation list also covers member types, keys and keyChain.

  1. endpoints.api equals the base URL you fetched from, after normalization. Otherwise the result is discovery.metadata_invalid; this stops one server's metadata from being served for another.
  2. versions contains a version whose major number you implement. This tour speaks 1.x. If every listed version is newer than yours, show "update required" (core.unsupported_version); otherwise the server is too old for you (discovery.version_unsupported). Separately, if you implement only versions below minClient, show "update required" for this server (03 §12.4).
  3. secure is true exactly when securedAt isn't null.
  4. The queried domain is in domains. The record is the domain owner's consent and the domain list is the server's; a domain is bound to a server only when both agree (02 §8.1). Otherwise the result is discovery.domain_not_served.
  5. The canonical domain checks out. Here canonicalDomain equals the queried domain, so the check passes. If you had typed the alias chat.sloppyvoice.com, you would resolve sloppyvoice.com as well and require the same base URL, otherwise discovery.canonical_mismatch; from then on you show the canonical domain only (02 §5.3, §5.7).

What the rest of the tour uses from this document:

  • limits. Send nothing larger than an advertised limit, and assume the limit's floor when it is missing (02 §7.3.3). The real /meta lists every registered limit; the specification's example shows only seven.
  • features. Behaviour depends only on versions, features and limits, never on software (02 §7.3.6).
  • secure: false. This is an insecure server, so its channels can be insecure and an insecure bot can post in them.

Cache the metadata for its max-age, clamped to 300 s to 86,400 s, and revalidate with If-None-Match when the server sent an ETag (02 §13.1). A client also reads /meta before its first WebSocket connection to a server (03 §5.1), which you have now done.

Authenticate as the bot

Every endpoint path is appended directly to the base URL, which has no trailing slash: $BASE/v1/me is https://chat.sloppyvoice.com/server/v1/me (03 §2.1). Bots authenticate with the Bot scheme (03 §3.1, 05 §15.4):

curl -sS -i "$BASE/v1/me" -H "Authorization: Bot $SV_TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
Access-Control-Allow-Origin: *
{
  "account": {
    "address": "weatherbot@sloppyvoice.com", "name": "Weather Bot", "kind": "bot",
    "inc": "UFFSU1RVVldYWVpbXF1eXw", "state": "active",
    "security": "insecure", "igen": 0, "about": "Posts the forecast at 7am.", "avatar": null,
    "profileVersion": 1, "createdAt": "2026-12-04T11:00:00.000Z",
    "owner": "saxonjones@sloppyvoice.com"
  },
  "device": {
    "did": "k9Qy0bW1yNc8sK2pT5uXgA", "name": "Bot token 1", "platform": "bot",
    "clientSoftware": "unknown", "state": "active", "enrolled": false, "sharedComputer": false,
    "provider": null, "authAt": null, "createdAt": "2026-12-04T11:00:00.000Z",
    "lastSeenAt": "2026-12-04T18:29:31.000Z", "expiresAt": null, "current": true,
    "tokenHint": "dXl8", "tokenRotatedAt": "2026-12-04T11:00:00.000Z"
  }
}

GET /v1/me returns the Account and the DeviceRecord of the session (05 §11.5). For a bot, each token is one device record with platform: "bot", so did identifies this token (05 §15.1), and the top-level authAt that user sessions carry is absent (05 §11.5). state must be active for the bot to use communities and messages; an upgrade_required bot is on a secure server and must register an identity first (05 §11.4).

Rules for the token, all from 03 §3.2 and 05 §15.4:

  • Use Bot, not Bearer. A svb_ token sent with Bearer is refused with core.unauthenticated.
  • Send it only to the bot's home server, at the base URL where it was issued. At any other server a bot gets a HomeAssertion with its token and uses a Bearer remote-session token there, as users do (Federation).
  • Never put it in a URL, a query string or a log. On the WebSocket it travels inside session.hello instead of the handshake URL.
  • Treat it as opaque apart from its prefix. Bot tokens don't expire unless the owner set expiresAt, and they have no refresh token.

A failed authentication is 401 with a WWW-Authenticate header naming the accepted schemes (03 §3.3). For a bot, retrying is pointless, so it stops and reports to its operator:

  • auth.session_revoked, with data.reason such as bot_token_revoked or bot_token_expired, means the token's device was revoked. The server answers this code for at least 30 days after the revocation, then MAY answer core.unauthenticated (05 §7.5, §12.3).
  • core.unauthenticated means the token is unknown: for example an old token after a rotation's grace period ended (05 §15.4), or a svb_ token sent as Bearer.
  • account.suspended (403) means the bot, or its owner, is suspended; a bot is suspended for as long as its owner is (05 §11.8).

Every response to an authenticated request carries Cache-Control: no-store, and every /v1/ response carries Access-Control-Allow-Origin: *, because no endpoint accepts cookies or other ambient credentials (03 §2.3, §4).

Join the community

Every server is one community, named by its canonical domain (09 §3.1). Its settings are public:

curl -sS "$BASE/v1/community" | jq '{name, joinPolicy, requireRulesAcceptance, rulesVersion, defaultChannel}'
{
  "name": "Sloppy Voice",
  "joinPolicy": "open",
  "requireRulesAcceptance": true,
  "rulesVersion": 2,
  "defaultChannel": "ch:01938a11-2b3c-7d4e-8f90-112233445566"
}

Local user accounts are community members by default while localAccountsAreMembers is true, but bots never are: a bot becomes a member only with the approval of someone who holds manage_bots, so that a bot entering a community is a deliberate act (09 §4.4). The usual way is an invite whose creator holds manage_bots at the moment the bot uses it. Join with POST /v1/community/join, and because requireRulesAcceptance is true, include the rulesVersion you accepted:

curl -sS -X POST "$BASE/v1/community/join" \
  -H "Authorization: Bot $SV_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"invite":"7kq2-m9xp-4hrt","acceptRules":2}'
{
  "member": {
    "addr": "weatherbot@sloppyvoice.com", "name": "Weather Bot", "kind": "bot",
    "inc": "UFFSU1RVVldYWVpbXF1eXw", "local": true, "accountSecurity": "insecure",
    "state": "active", "reason": null, "via": "invite",
    "requestedAt": null, "joinedAt": "2026-12-04T18:29:40.118Z",
    "rulesAcceptedVersion": 2, "roles": [], "version": 1,
    "updatedAt": "2026-12-04T18:29:40.118Z"
  },
  "community": { "domain": "sloppyvoice.com", "name": "Sloppy Voice", "secure": false, "version": 57 },
  "openChannel": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "inviteIgnored": null
}

(community is shortened here; the server returns the full Community object.)

What can happen instead (09 §4.3, §4.4, §9.2):

  • 202 with the same shape and state: "pending": the bot had no invite from a manage_bots holder, under the policy open or request, or under invite with a valid invite from someone else. It waits until a holder of both manage_bots and manage_invites approves it.
  • 403 community.rules_acceptance_required: acceptRules was missing or out of date. data carries the current rulesVersion and rulesText; resend with the new version. This check applies to requests that will become pending too.
  • 403 community.invite_required or 403 community.closed: the policy is invite and there was no valid invite, or the policy is closed.

Joining is idempotent. A second join by an active member returns 200 with the existing record and doesn't use up the invite.

List channels

curl -sS "$BASE/v1/channels" -H "Authorization: Bot $SV_TOKEN"
{
  "items": [
    {
      "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
      "address": "publiclobby@sloppyvoice.com",
      "name": "Public Lobby",
      "reservedAddresses": [],
      "kind": "voice",
      "security": "insecure",
      "securedAt": null,
      "upgradeSeq": null,
      "preUpgradeHistory": null,
      "retentionDays": null,
      "topic": "Say hello",
      "categoryId": "01938a10-55aa-7c3d-8e9f-0a1b2c3d4e5f",
      "position": 0,
      "memberCount": 312,
      "membership": null,
      "version": 18,
      "createdAt": "2026-11-01T09:00:00.000Z",
      "updatedAt": "2026-11-20T14:03:12.000Z",
      "createdBy": "saxonjones@sloppyvoice.com"
    }
  ],
  "categories": [
    { "id": "01938a10-55aa-7c3d-8e9f-0a1b2c3d4e5f", "name": "Lobby", "position": 0, "version": 1,
      "createdAt": "2026-11-01T09:00:00.000Z", "updatedAt": "2026-11-01T09:00:00.000Z" }
  ],
  "nextCursor": null
}

GET /v1/channels returns every channel the caller can view, as Channel objects, and is never paginated; its size is bounded by maxChannels (09 §6.6). Notes on the members you need now (09 §6.1, §6.2):

  • ctx is the channel's context reference, ch: followed by a UUIDv7. It is the identifier you use in every timeline path and on the WebSocket. Order inside a channel always uses seq, never this or any other ID (00 §7.6).
  • kind is text or voice. Both have a timeline, so you can post in a voice channel; only voice channels have a call.
  • security is insecure here. A client treats an unknown value as unavailable: it doesn't post, call or show a lock.
  • membership is null because the bot hasn't opened the channel yet.

A channel the caller can't see answers 404 core.not_found everywhere, exactly like a channel that doesn't exist, so that nothing about it leaks (09 §6.4).

Join a channel

Community membership, together with view_channel, lets the bot see channels. Posting, reading the timeline and subscribing to a channel's events also need channel membership (09 §9.3 step H8, §14.1), which a client takes silently the first time the person opens a channel (09 §4.5). A bot does the same with POST /v1/channels/{id}/join and an empty JSON object:

CTX='ch:01938a11-2b3c-7d4e-8f90-112233445566'
curl -sS -X POST "$BASE/v1/channels/$CTX/join" \
  -H "Authorization: Bot $SV_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{}'
{
  "member": {
    "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
    "addr": "weatherbot@sloppyvoice.com", "name": "Weather Bot", "kind": "bot",
    "inc": "UFFSU1RVVldYWVpbXF1eXw", "accountSecurity": "insecure",
    "state": "active", "reason": null,
    "joinedAt": "2026-12-04T18:29:50.412Z", "joinSeq": 4191, "visibleFromSeq": null,
    "visibleRanges": [[1, null]],
    "version": 1, "updatedAt": "2026-12-04T18:29:50.412Z"
  },
  "channel": { "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "name": "Public Lobby",
               "membership": { "state": "active", "visibleFromSeq": null }, "version": 18 }
}

(channel is shortened here; the server returns the full Channel object.)

  • {id} accepts the bare UUIDv7 or the full ch: reference, with the colon plain or percent-encoded as %3A; servers accept all forms (09 §2, 03 §2.6).
  • The join is idempotent. It sequences a member.joined event on the channel's stream at joinSeq, which you will see as a timeline item below.
  • visibleRanges of [[1, null]] means the bot may read the channel's whole stored history, because in an insecure channel a join covers everything from seq 1 (09 §7.2). In a secure channel it would start at joinSeq instead: nobody, bots included, is served sealed content from before their own join (09 §7.4).

Without this step, posting fails with 403 channel.join_required, and a client that sees that code joins silently and retries (09 §9.5).

Post a message

Every timeline write, in both security modes, goes to one endpoint, POST /v1/contexts/{ctx}/messages, with a PostEntry body (11 §4.1, §4.2). The client generates the message ID, mid, as a UUIDv7:

MID=$(uuidgen --time-v7)
echo "$MID"
01a24252-1440-7d4e-9f10-2b3c4d5e6f70

Write the body to a file so that a retry sends the same request:

cat > post.json <<EOF
{"mid":"$MID","content":{"text":"Good morning. Rain until noon, then clearing.","replyTo":null,"attachments":[]}}
EOF

curl -sS -i -X POST "$BASE/v1/contexts/$CTX/messages" \
  -H "Authorization: Bot $SV_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-binary @post.json
HTTP/1.1 201 Created
Content-Type: application/json
Cache-Control: no-store
Access-Control-Allow-Origin: *

{ "mid": "01a24252-1440-7d4e-9f10-2b3c4d5e6f70", "kind": "message", "seq": 4192, "createdAt": "2026-12-04T18:30:05.388Z" }

The response is an EntryAck: the seq the hosting server assigned and its timestamp (11 §4.6).

What the body must contain:

  • mid: a lowercase, hyphenated UUIDv7. An uppercase or non-v7 value is refused with 400 core.invalid_request (11 §2.4). The server MUST NOT check its embedded time, because an outbox may send a message days after it was written.
  • kind: absent here, which means message. edit, reaction and delete use the same endpoint with a target (11 §3.1, §4.2).
  • content: a MessageContent object, because the channel is insecure. text is required and holds at most 4,000 Unicode scalar values of the SV-Markdown subset; it may be empty only when attachments isn't. The whole object, measured as its JCS (RFC 8785) serialization, must fit in maxMessageBytes, or the server answers 413 message.too_large (11 §3.2, §3.8).
  • Nothing about the sender. The server takes the address and device from the session, never from the body (00 §7.4).

To mention someone, put a token such as <@saxonjones@sloppyvoice.com> in text and the same canonical address in mentions; the set of tokens outside code must equal mentions, or the server refuses the content with message.invalid_content (11 §3.4). The bot also needs the send_messages permission in the channel (11 §4.5, Roles and moderation).

Retrying is safe

The mid is the idempotency key, so the outbox can resend after any failure (11 §4.6). Send the same request again:

curl -sS -X POST "$BASE/v1/contexts/$CTX/messages" \
  -H "Authorization: Bot $SV_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-binary @post.json
{ "mid": "01a24252-1440-7d4e-9f10-2b3c4d5e6f70", "kind": "message", "seq": 4192, "createdAt": "2026-12-04T18:30:05.388Z" }

Same status, same EntryAck, and no second message. The rules:

  • The fingerprint of an entry is its sender account (address and incarnation), kind and target, not the body bytes. A resend whose content differs still returns the stored EntryAck, which is what lets a secure client re-seal a queued message under a newer epoch with the same mid.
  • Reusing the mid with a different kind or target is 409 core.idempotency_conflict with reason: "mismatch". A resend that arrives while the first request is still being processed is the same code with reason: "in_progress", retryable: true and a retryAfterMs of at least 500.
  • The server remembers every accepted mid for at least 30 days, even after the message is deleted.
  • This endpoint ignores Idempotency-Key; the mid does that job.
  • A mid is reserved only when a post with it succeeds. A post refused before it changed anything, for example with channel.join_required, reserves nothing, so you join and resend with the same mid (03 §14.1 rule 5).

Idempotency runs before the access and permission checks, so a resend whose first response was lost always gets the stored EntryAck, even if the bot has since been timed out (11 §4.5).

Retry automatically only after a network error, a timeout, or a problem with retryable: true. The message outbox waits 1, 2, 4, 8, 16, 30 and 60 s, then every 60 s, each with ±20 % jitter and never sooner than retryAfterMs, and sends one request at a time per context, in order (03 §2.7, 11 §13.4).

Posting in a secure channel

Secure contexts only

In a secure channel the body carries sealed, a SealedMessage whose plaintext is the same content object padded to a multiple of 256 bytes, instead of content. Next to it travel only the cleartext members the server needs: kind, target, attachmentIds and the mention hint mentions and mentionAll (11 §4.2, §4.3). A plaintext body there is refused with 409 channel.plaintext_rejected. An insecure bot holds no keys and can't join a secure channel at all (security.account_required); a secure bot needs an identity, an enrolled device and MLS group membership first. See Secure accounts and MLS and sealed messages.

Page the history

GET /v1/contexts/{ctx}/messages with no paging parameter returns the newest timeline items (11 §7.1):

curl -sS "$BASE/v1/contexts/$CTX/messages?limit=2" -H "Authorization: Bot $SV_TOKEN"
{
  "items": [
    { "type": "event", "seq": 4191, "t": "member.joined", "ts": "2026-12-04T18:29:50.412Z",
      "d": { "scope": "channel",
             "member": { "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
                         "addr": "weatherbot@sloppyvoice.com", "name": "Weather Bot", "kind": "bot",
                         "inc": "UFFSU1RVVldYWVpbXF1eXw", "state": "active", "reason": null,
                         "joinedAt": "2026-12-04T18:29:50.412Z", "joinSeq": 4191, "visibleFromSeq": null,
                         "version": 1, "updatedAt": "2026-12-04T18:29:50.412Z" } } },
    { "type": "message", "seq": 4192, "mid": "01a24252-1440-7d4e-9f10-2b3c4d5e6f70",
      "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "carrier": "plain",
      "sender": { "addr": "weatherbot@sloppyvoice.com", "name": "Weather Bot", "did": "k9Qy0bW1yNc8sK2pT5uXgA", "kind": "bot" },
      "createdAt": "2026-12-04T18:30:05.388Z",
      "content": { "text": "Good morning. Rain until noon, then clearing.", "replyTo": null, "attachments": [] },
      "mentionAll": false, "editedAt": null, "deleted": null, "reactions": [], "updatedSeq": 4192 }
  ],
  "hasMore": true,
  "headSeq": 4192,
  "ranges": [[1, null]],
  "grants": [],
  "withheldBeforeSeq": null,
  "purgedThroughSeq": 0
}

The response is a MessagePage. Items are root messages (Message objects, type: "message") and system items that other documents register, such as membership lines (type: "event", carrying the event's t, ts and payload). Edits, reactions and deletes don't add items; they change a Message object and raise its updatedSeq.

To page backwards, pass the first item's seq as before:

curl -sS "$BASE/v1/contexts/$CTX/messages?before=4191&limit=2" -H "Authorization: Bot $SV_TOKEN"
{
  "items": [
    { "type": "message", "seq": 4188, "mid": "01a2423f-4a10-7c3d-8e9f-0a1b2c3d4e51",
      "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "carrier": "plain",
      "sender": { "addr": "alice@a.com", "name": "Alice", "did": "q2bS9xVg3m0yJpQe1vT0Aw", "kind": "user" },
      "createdAt": "2026-12-04T18:09:33.840Z", "content": { "text": "who's on tonight?" },
      "mentionAll": false, "editedAt": null, "deleted": null, "reactions": [], "updatedSeq": 4188 },
    { "type": "message", "seq": 4190, "mid": "01a24240-4c20-7a8b-9c0d-1e2f30415263",
      "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "carrier": "plain",
      "sender": { "addr": "saxonjones@sloppyvoice.com", "name": "Saxon Jones", "did": "oKGio6SlpqeoqaqrrK2urw", "kind": "user" },
      "createdAt": "2026-12-04T18:10:39.901Z", "content": { "text": "Board games at 8." },
      "mentionAll": false, "editedAt": null, "deleted": null, "reactions": [], "updatedSeq": 4190 }
  ],
  "hasMore": true,
  "headSeq": 4192,
  "ranges": [[1, null]],
  "grants": [],
  "withheldBeforeSeq": null,
  "purgedThroughSeq": 0
}

Paging rules (03 §13.1, 11 §7.1):

  • items are always in ascending seq order, whichever direction you asked for. (The changedAfter changes feed is the one exception: it is ordered by updatedSeq.) Page backwards with before = items[0].seq and forwards with after = the last item's seq.
  • seq values aren't contiguous. The stream also holds events that aren't timeline items (4189 above, for example, could be a reaction), and items you may not see are left out.
  • limit is 1 to 100, default 50. before, after, around and changedAfter are mutually exclusive; combining them is 400 core.invalid_request.
  • hasMore: false with before means there is nothing older that you can see. A page also proves that no other visible item exists in the interval it covers, so a client can track covered intervals and fill holes with after= requests.
  • Ignore an item whose type or t you don't know, but count its seq as covered.
  • headSeq is the stream's head when the page was read. A seq learned over HTTP never advances your WebSocket position, because jumping ahead would skip the events in between (03 §2.8).

Open the event socket

Commands go over HTTPS. Events come back over one WebSocket per client session per server, at the base URL with https replaced by wss and /v1/events appended (03 §5.1). The client MUST offer the subprotocol sloppyv.v1; a server refuses a handshake that offers no subprotocol it supports, and a client closes a socket that came up without the subprotocol it offered.

websocat --protocol sloppyv.v1 wss://chat.sloppyvoice.com/server/v1/events

A bot may hold 1 event WebSocket per device, that is per token, at a time (05 §15.7). Two processes that share one token replace each other's socket (close code 4010, below), so give each process its own token.

The handshake carries no credentials and the URL carries no query string. Authentication is the first message, session.hello, because browsers can't set headers on a WebSocket handshake and tokens never go in URLs (03 §5.4). Send it within 10 s, or the server closes the socket with 4008.

websocat sends each line you type as one text message. Every message in either direction is one JSON Envelope (03 §6.1):

Member Meaning
v Envelope version, 1.
t Type, <area>.<name>, or error.
id UUIDv7 of this envelope. The client generates its own.
re On replies only: the id being answered.
ctx On events: the stream, a context reference, me or community.
seq On durable events only: the position in that stream.
ts Server timestamp. Clients may omit it; servers ignore it.
d The payload, {} when empty.

Type this session.hello as one line, with your own token and a fresh UUIDv7 as id:

{"v":1,"t":"session.hello","id":"01a24252-eaa0-7000-8000-000000000001","d":{"token":"svb_QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl8","client":"quick-tour/1.0","features":[],"subscribe":["ch:01938a11-2b3c-7d4e-8f90-112233445566","community"]}}

The members:

  • token: the bot token as is. The svb_ prefix tells the server it is a bot token; there is no scheme member. Outside the bot's home server, this would be a remote-session token.
  • client: product and version, 1 to 128 printable ASCII characters, for diagnostics only.
  • features: required, and may be empty. Media features are optional for bot clients (03 §12.2).
  • subscribe: streams to follow at level full from their current head, with no replay. The bot's own me stream is always subscribed. The channel stream is open only to active channel members, which is why you joined the channel first (09 §14.1).

A reconnecting client uses resume instead of subscribe, with the last seq it processed per stream, and the server replays what it missed (03 §5.4, §7.4). A client with a visible user interface also sends foreground: true; a bot has none and leaves it out.

Read session.ready

{
  "v": 1,
  "t": "session.ready",
  "id": "01a24252-eb6c-73e1-9d1e-5f2a8c7d9e01",
  "re": "01a24252-eaa0-7000-8000-000000000001",
  "ts": "2026-12-04T18:31:00.204Z",
  "d": {
    "conn": "01a24252-eb6c-72a4-bb1c-9f00aa55e7c2",
    "account": "weatherbot@sloppyvoice.com",
    "did": "k9Qy0bW1yNc8sK2pT5uXgA",
    "server": "sloppyvoice.com",
    "protocol": "1.0",
    "features": [],
    "pingIntervalMs": 30000,
    "idleTimeoutMs": 75000,
    "authExpiresAt": null,
    "subscriptions": [
      { "stream": "me", "level": "full", "status": "ok", "headSeq": 2 },
      { "stream": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "level": "full", "status": "ok", "headSeq": 4192 },
      { "stream": "community", "level": "full", "status": "ok", "headSeq": 9121 }
    ]
  }
}

session.ready answers the hello (re is the hello's id), and the server sends nothing but error and session.closing before it (03 §5.5). What to take from it:

  • account, did and server confirm who the socket belongs to.
  • features is the effective feature set: the intersection of the server's metadata features and yours. Neither side may use a feature outside it, so with an empty list the server sends this bot nothing that needs a media feature (03 §12.2).
  • authExpiresAt is null because this bot token doesn't expire. For a user session it is the access token's expiry, and the client extends it in-band with session.reauth after each refresh (03 §5.13).
  • subscriptions holds one SubscriptionResult per stream. For a fresh subscription, your position P in that stream is its headSeq: 4192 for the channel, the seq of the bot's own message. A refused stream has status: "refused" and a problem object; a context you aren't allowed to know about is refused with core.not_found, never core.forbidden (03 §5.6).

Keep the socket alive

The server sends session.ping every 30 s, and closes a socket from which it has heard nothing for 75 s (03 §5.9). Answer each ping at once with a session.pong whose re is the ping's id:

{ "v": 1, "t": "session.ping", "id": "01a24253-5fd0-7111-a222-333344445557", "ts": "2026-12-04T18:31:30.000Z", "d": {} }
{"v":1,"t":"session.pong","id":"01a24253-6000-7000-8000-000000000002","re":"01a24253-5fd0-7111-a222-333344445557","d":{}}

By hand, that means typing a pong within 75 s of your last message. A program does it automatically, and also treats 75 s without any message from the server as a dead connection and reconnects.

Apart from session.* messages, the socket is server-to-client only. Anything else a client sends is answered with an error envelope (session.unsupported_message) and ignored (03 §6.2).

Watch a message arrive

Leave the socket open and post a second message from another terminal, exactly as before, with a new mid. The socket receives a message.created envelope:

{
  "v": 1,
  "t": "message.created",
  "id": "01a24253-1297-7b3e-9d1e-5f2a8c7d9e02",
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "seq": 4193,
  "ts": "2026-12-04T18:31:10.231Z",
  "d": {
    "mid": "01a24253-11b0-7a2b-8c3d-4e5f60718293",
    "carrier": "plain",
    "sender": { "addr": "weatherbot@sloppyvoice.com", "name": "Weather Bot", "did": "k9Qy0bW1yNc8sK2pT5uXgA", "kind": "bot" },
    "createdAt": "2026-12-04T18:31:10.231Z",
    "content": { "text": "Update: the rain has stopped.", "replyTo": null, "attachments": [] },
    "mentionAll": false,
    "editedAt": null,
    "deleted": null,
    "reactions": [],
    "updatedSeq": 4193
  }
}

The payload is the Message object without ctx and seq, which the envelope carries (11 §8.1). It is a durable event: it has a seq, it will be replayed after a reconnect, and its id and ts are the same in every delivery (03 §7.2).

Process durable events per stream against your position P (03 §7.3):

  • seq = P + 1: apply it, then set P to its seq. Here 4193 follows 4192.
  • seq ≤ P: a duplicate; ignore it.
  • seq > P + 1: a gap, which an honest server never causes. Don't apply it, drop further events of that stream, and send session.subscribe with resume set to P for that stream. The repair is complete when its SubscriptionResult arrives in session.subscribed; the replay follows.
  • An unknown event type: ignore the payload but still advance P.
  • A payload with "withheld": true: advance P and do nothing else. A server sends this form when you may not see an event, so that every subscriber still receives every seq. Some owners add a member that names the affected object, such as 11's target (03 §7.2 D4a, 11 §8.3).

The sender receives its own message.created too, and the HTTP response and the event can arrive in either order. Reconcile them by mid: a message.created for a mid you already hold changes nothing except replacing the pending outbox item (11 §7.6, 03 §2.8).

Ephemeral events such as typing.started carry no seq, are never replayed and never change P.

When the socket closes

Before a deliberate close, the server sends session.closing with a reason, then a close code (03 §5.10). The ones you are most likely to meet:

Close code reason What to do
4001 unauthenticated The token is invalid, expired or revoked. A bot stops and reports.
4008 hello_timeout, idle_timeout No hello within 10 s, or nothing from you for 75 s. Reconnect at once, then with backoff.
4010 replaced A newer socket of the same session took over; newest wins. Reconnect silently once only if you know no other copy of the bot is running with this token; otherwise don't reconnect automatically (03 §5.12).
1012 server_shutdown Reconnect after retryAfterMs, or after a random 1 to 10 s if none was given.

To reconnect, wait a random delay between 0 and min(30 s, 1 s × 2^n) for retry n, then send a hello whose resume lists P for every stream you followed (03 §5.11). If a gap is too large to replay, the server answers with session.resync_required, and you refetch the newest page over HTTP (03 §7.5). Event WebSocket covers these cases in full.

When something fails

Every HTTP error from a conforming server is an RFC 9457 problem object with Content-Type: application/problem+json, and WebSocket errors carry the same object in d (03 §10.1). For example, posting before joining the channel:

HTTP/1.1 403 Forbidden
Content-Type: application/problem+json
Cache-Control: no-store
Access-Control-Allow-Origin: *

{
  "type": "urn:sloppyv:error:channel.join_required",
  "code": "channel.join_required",
  "title": "Join the channel first",
  "status": 403,
  "retryable": false,
  "userAction": "none"
}

Branch on code, never on title or detail, which are for people. For a code you don't know, retryable and retryAfterMs decide automatic retries and userAction decides what a user sees (03 §10.3). A 4xx or 5xx without a problem body comes from a proxy; treat 502, 503 and 504 as core.unavailable.

Errors you can meet on this tour:

Code Status Cause in this tour
core.unauthenticated 401 Missing or unknown bot token (for example after a rotation's grace period), or a svb_ token sent as Bearer.
auth.session_revoked 401 The token's device was revoked; data.reason says why.
member.not_member 403 The bot isn't a community member yet. data carries joinPolicy and requireRulesAcceptance.
member.pending 403 The bot's join request is waiting for approval (retryable: true, userAction: wait).
channel.join_required 403 Posting or reading before POST /v1/channels/{id}/join.
core.not_found 404 Unknown channel, or one the bot can't see.
core.invalid_request 400 Malformed JSON, an uppercase mid, limit out of range. data.errors points at each problem.
core.idempotency_conflict 409 A reused mid with a different kind or target, or a resend while the first is in progress.
message.too_large 413 The JCS size of content is over maxMessageBytes.
core.rate_limited 429 Too fast. Wait at least retryAfterMs (or Retry-After seconds) before retrying.

Rate limits are per session, per IP address and per federation peer (03 §15). Bots also get limits of their own, applied per bot account across all its tokens: by default 50 requests per second (burst 100), and 5 posted messages per second per context and 30 per second in total (05 §15.7). Separately, 11 recommends 10 entries of kind message or edit per 10 s per account per context (11 §17.3). The specification doesn't say which of these two message defaults a server applies to a bot, and servers may change both, so rely on the 429 response and the RateLimit headers rather than on a fixed number.

Where to go next