Chat API reference

Every REST endpoint of the in-app chat API, plus the WebSocket operations, events, webhooks, limits and error codes the SDKs are built on.

Base URL https://api-videosdk.titliapp.com. The REST endpoints on this page (/v1/chat/*) are your server API: they use your project API key as HTTP Basic auth (key_id:key_secret), exactly like the video API; the scope is that key's project. An app does not need them: with your App Key (Quick mode) the SDK talks to the WebSocket and to the two app routes in the Client API. New here? Start with the chat quickstart.

Set in your dashboard vs. set in code

SettingWhere
App Key, its bindings (package name, bundle ID, website, signing certificate) and Quick-mode capsDashboard: Console → Projects → Quick mode
Chat push credentials (FCM, APNs), profanity filter and word list, recall window, webhook eventsDashboard: Console → Chat
Chat plan (Free, Pay as you go)Dashboard: Console → Chat
Chat token lifetimeCode: Quick mode handles it for you; with server tokens, ttl_seconds (60 to 604800 seconds)
Live-room slow mode and freezeCode: your server (PATCH /v1/chat/rooms/{room_id})
Who the user is (user id, display name)Code: init / setUser in the app

Which routes are server-only, and why

Everything an app user does in chat (open a conversation, send, read, react, recall their own message, join a room, push registration, call invites) runs over the WebSocket with a chat token, and in Quick mode the SDK gets that token with your App Key (POST /v1/chat/client/tokens) and saves the user's own profile (PUT /v1/chat/client/users/{user_id}). The routes below are for your server, and some of them can only ever be called from a server:

  • Bans (POST /v1/chat/users/{user_id}/ban) and user erase (DELETE /v1/chat/users/{user_id}): they act on another person, so they must never be reachable with a key that ships inside an app.
  • Server-side conversations and messages (create, list, send, add or remove members, moderation recall): they act as any user you name and skip the checks an app user gets (block lists, admin roles, the recall window).
  • Room settings and host messages (PATCH /v1/chat/rooms/{room_id}, POST /v1/chat/rooms/{room_id}/messages): they control a whole room and skip slow mode and rate limits.
  • Usage (GET /v1/chat/usage): it shows your plan, MAU and charges, which are account data.

The App Key is publishable, so it can only reach the app routes. Keep the API key secret on your server for everything here.

Errors are {"error":{"code","message"}} with the HTTP status listed under Errors; 429 answers add retry_after_ms and a Retry-After header. JSON bodies need Content-Type: application/json. The server API allows 20 requests per second per API key (burst 40). In each table below, "required (in the path)" means the value is part of the URL; every other parameter of a GET goes in the query string and of a POST, PUT or PATCH in the JSON body.

Tokens and users

POST/v1/chat/tokens

Mints a chat token for one of your users (production hardening; Quick mode apps use the Client API instead). Answers 201 and creates or updates the profile.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
user_idstringrequired–1 to 128 characters: A-Z a-z 0-9 _ . : @ -Your own id for the person the token is for. The call also creates or updates the profile.u_42
namestringoptionalunchanged (none for a new user)up to 80 charactersDisplay name shown to other users.Asha
avatar_urlstringoptionalunchanged (none for a new user)up to 500 charactersLink to the profile picture.https://cdn.example.com/a.jpg
customobjectoptionalunchanged ({} for a new user)a JSON objectYour own data on the profile (for example a role or a level). Replaces the stored object when sent.{"level":3}
ttl_secondsintegeroptional360060 to 604800 (7 days)How long the token works. When it expires the SDK asks for a new one and reconnects.3600
FieldTypeWhat it means
tokenstringThe chat token. The app passes it to connect().
user_idstringThe user it is for.
expires_atstringISO time it stops working.
ws_urlstringThe WebSocket address.
api_urlstringThe API address (for uploads).
PUT/v1/chat/users/{user_id}

Creates or updates a user profile. Fields you leave out stay as they are.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
user_idstringrequired (in the path)–1 to 128 characters: A-Z a-z 0-9 _ . : @ -Your own id for the person.u_42
namestringoptionalunchanged (none for a new user)up to 80 charactersDisplay name shown to other users.Asha
avatar_urlstringoptionalunchanged (none for a new user)up to 500 charactersLink to the profile picture.https://cdn.example.com/a.jpg
customobjectoptionalunchanged ({} for a new user)a JSON objectYour own data on the profile (for example a role or a level). Replaces the stored object when sent.{"level":3}
FieldTypeWhat it means
idstringThe user id.
namestring or nullDisplay name.
avatar_urlstring or nullProfile picture link.
customobjectYour own data ({} when none).
GET/v1/chat/users/{user_id}

One user, with ban and last-seen details. 404 not_found when the user never connected or was made.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
user_idstringrequired (in the path)–1 to 128 characters: A-Z a-z 0-9 _ . : @ -Your own id for the person.u_42
FieldTypeWhat it means
idstringThe user id.
namestring or nullDisplay name.
avatar_urlstring or nullProfile picture link.
customobjectYour own data ({} when none).
banned_untilstring or nullISO time a ban ends; null when not banned.
last_seen_atstring or nullISO time the user was last connected.
created_atstringISO time the profile was made.
POST/v1/chat/users/{user_id}/ban

Server-only. Bans a user until a time, or lifts the ban. A banned user is refused at the next connection (close code 4003, reason banned); a connection that is already open stays until it reconnects, at the latest when its token expires.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
user_idstringrequired (in the path)–1 to 128 characters: A-Z a-z 0-9 _ . : @ -Your own id for the person.u_42
untilstring or nulloptionalnull (lifts the ban)an ISO date and time, or nullBan the user until this time. Leave it out or send null to lift a ban.2026-12-31T00:00:00Z
FieldTypeWhat it means
user_idstringThe user.
banned_untilstring or nullThe ban end; null when lifted.
DELETE/v1/chat/users/{user_id}

Server-only. Erases a user (privacy request): profile, devices, blocks and group memberships; the user's messages are recalled.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
user_idstringrequired (in the path)–1 to 128 characters: A-Z a-z 0-9 _ . : @ -Your own id for the person.u_42
FieldTypeWhat it means
deletedbooleanAlways true.

Conversations and messages

Server-only. These act on behalf of one of your users, named in each request.

POST/v1/chat/conversations

Makes a direct chat or a group. Answers 201 and the conversation as the acting user sees it.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
typestringoptionalgroupdirect or group (anything else makes a group)What to make. A direct chat between the same two people is made once and returned again after that.direct
created_bystringrequired–1 to 128 characters: A-Z a-z 0-9 _ . : @ -The user acting: the creator, who becomes the group owner. You may send as_user instead.u_42
as_userstringoptional (instead of created_by)–1 to 128 characters: A-Z a-z 0-9 _ . : @ -Another name for created_by.u_42
user_idstringrequired for direct–1 to 128 characters: A-Z a-z 0-9 _ . : @ -; not the creatorThe other person in a direct chat.u_99
namestringoptional–up to 100 charactersGroup name.Weekend plans
membersarray of stringsoptionalthe creator onlyuser ids; the group size limit of your planGroup members. The creator is added for you.["u_99","u_7"]
avatar_urlstringoptional–up to 500 charactersGroup picture link.https://cdn.example.com/g.jpg
customobjectoptional{}a JSON object up to 2 KBYour own data on the group.{"topic":"trip"}
FieldTypeWhat it means
idstringConversation id: d_… direct, g_… group.
typestringdirect or group.
namestring or nullGroup name; for a direct chat, the other person's name or id.
avatar_urlstring or nullGroup picture, or the other person's.
customobjectYour own data on the group.
member_countintegerNumber of members.
membersarray of stringsMember ids (groups up to 100 members; both people in a direct chat).
last_seqintegerThe seq of the newest message.
last_messageobject or nullThe newest message (same fields as a message).
last_message_atstring or nullISO time of the newest message.
read_seqintegerThe acting user's read position.
unread_countintegerlast_seq − read_seq for the acting user.
mutedbooleanWhether the acting user muted it.
rolestringThe acting user's role: owner, admin or member.
peerobjectDirect chats only: { id, name, avatar_url, custom } of the other person.
peer_read_seqintegerDirect chats only: how far the other person has read.
peer_delivered_seqintegerDirect chats only: how far messages reached the other person.
slow_mode_sintegerSlow mode in seconds (0 = off).
frozenbooleanWhether the conversation is frozen.
created_atstringISO time it was made.
updated_atstringISO time of the last change.
GET/v1/chat/conversations

One user's inbox with unread counts, newest first.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
user_idstringrequired (query)–1 to 128 characters: A-Z a-z 0-9 _ . : @ -Whose inbox to list.u_42
limitintegeroptional (query)301 to 100Conversations per page.50
beforestringoptional (query)–the next value of the previous pageCursor for the next (older) page.MjAyNi0xMS0yOVQxMDowMDowMC4wMDBafGdfNWYw
FieldTypeWhat it means
itemsarrayConversations (fields as below), newest activity first. Rooms are not listed.
nextstring or nullCursor for the next page; null on the last page.
items[].idstringConversation id: d_… direct, g_… group.
items[].typestringdirect or group.
items[].namestring or nullGroup name; for a direct chat, the other person's name or id.
items[].avatar_urlstring or nullGroup picture, or the other person's.
items[].customobjectYour own data on the group.
items[].member_countintegerNumber of members.
items[].membersarray of stringsMember ids (groups up to 100 members; both people in a direct chat).
items[].last_seqintegerThe seq of the newest message.
items[].last_messageobject or nullThe newest message (same fields as a message).
items[].last_message_atstring or nullISO time of the newest message.
items[].read_seqintegerThe acting user's read position.
items[].unread_countintegerlast_seq − read_seq for the acting user.
items[].mutedbooleanWhether the acting user muted it.
items[].rolestringThe acting user's role: owner, admin or member.
items[].peerobjectDirect chats only: { id, name, avatar_url, custom } of the other person.
items[].peer_read_seqintegerDirect chats only: how far the other person has read.
items[].peer_delivered_seqintegerDirect chats only: how far messages reached the other person.
items[].slow_mode_sintegerSlow mode in seconds (0 = off).
items[].frozenbooleanWhether the conversation is frozen.
items[].created_atstringISO time it was made.
items[].updated_atstringISO time of the last change.
GET/v1/chat/conversations/{cid}/messages

A page of history, as one member sees it.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
cidstringrequired (in the path)–up to 120 characters; d_… (direct) or g_… (group)The conversation id, as returned when the conversation was made.g_5f0c2a9e41b7d3c8a6e1f204
user_idstringrequired (query)–1 to 128 characters: A-Z a-z 0-9 _ . : @ -; a memberThe member reading the history (their cleared and hidden messages are left out).u_42
before_seqintegeroptional (query)–a positive seqOlder page: messages before this seq.120
after_seqintegeroptional (query)–0 or more; wins over before_seqCatch up: messages after this seq, oldest first.98
limitintegeroptional (query)301 to 100Messages per page.50
FieldTypeWhat it means
itemsarrayMessages in ascending seq (fields as below).
has_morebooleanTrue when there are more in that direction.
items[].idstringMessage id (UUID).
items[].cidstringConversation id (r_<room_id> for a room).
items[].seqintegerGap-free position in the conversation, from 1. Sort by this.
items[].client_idstring or nullYour idempotency key, if sent.
items[].senderstringSender user id.
items[].sender_namestringSender display name, when known.
items[].typestringMessage type.
items[].textstring or nullText after the profanity filter; null once recalled.
items[].mentionsarray of stringsMentioned user ids.
items[].reply_tointeger or nullThe seq it replies to.
items[].attachmentobject or nullThe file, with a signed url valid for 7 days (store the key).
items[].customobject or nullYour own data.
items[].reactionsobjectEmoji to the user ids who reacted.
items[].edited_atstring or nullISO time of the last edit.
items[].recalledbooleanTrue once recalled (text, custom and reactions are cleared).
items[].created_atstringISO time it was sent.
items[].updated_atstringISO time of the last change.
POST/v1/chat/conversations/{cid}/messages

Sends as a member (for example a bot, or a migration) or a system message. Answers 201 and the message. Fan-out and push work as for app sends; server sends skip block checks and the freeze, and system messages are not pushed.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
cidstringrequired (in the path)–up to 120 characters; d_… (direct) or g_… (group)The conversation id, as returned when the conversation was made.g_5f0c2a9e41b7d3c8a6e1f204
senderstringrequired–1 to 128 characters: A-Z a-z 0-9 _ . : @ -; a memberThe member the message is sent as (for example a bot member). You may send as_user instead.bot_1
as_userstringoptional (instead of sender)–1 to 128 characters: A-Z a-z 0-9 _ . : @ -Another name for sender.bot_1
typestringoptionaltexttext, image, file, voice, custom, systemThe kind of message. system is server only and needs custom (or text, wrapped as { text }).text
textstringrequired for text–up to 4,000 charactersThe message text. The project profanity filter masks or blocks it.Welcome!
customobjectrequired for custom–a JSON object up to 8 KBYour own data: a gift, a card, a poll, an order.{"kind":"gift","id":"rose"}
attachmentobjectrequired for image, file, voice–{ key } from an upload, or { url } (https, up to 1,000 characters); optional name, mime, size, width, height, duration_ms, waveform (up to 64 values 0–100)The file of a media message. Images need an image type and voice messages an audio type.{"key":"p_1/ab12.jpg","width":800,"height":600}
mentionsarray of stringsoptionalthe @user names found in the textup to 50 user idsUsers mentioned in the message.["u_99"]
reply_tointegeroptional–a positive seqThe seq of the message this one replies to.41
client_idstringoptional–up to 64 charactersYour idempotency key: the same value in the same conversation within 24 hours returns the stored message with duplicate: true.c-7f3a
FieldTypeWhat it means
idstringMessage id (UUID).
cidstringConversation id (r_<room_id> for a room).
seqintegerGap-free position in the conversation, from 1. Sort by this.
client_idstring or nullYour idempotency key, if sent.
senderstringSender user id.
sender_namestringSender display name, when known.
typestringMessage type.
textstring or nullText after the profanity filter; null once recalled.
mentionsarray of stringsMentioned user ids.
reply_tointeger or nullThe seq it replies to.
attachmentobject or nullThe file, with a signed url valid for 7 days (store the key).
customobject or nullYour own data.
reactionsobjectEmoji to the user ids who reacted.
edited_atstring or nullISO time of the last edit.
recalledbooleanTrue once recalled (text, custom and reactions are cleared).
created_atstringISO time it was sent.
updated_atstringISO time of the last change.
duplicatebooleanOnly on a repeated client_id: the stored message is returned.
POST/v1/chat/conversations/{cid}/members

Adds people to a group. Answers the updated conversation.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
cidstringrequired (in the path)–up to 120 characters; d_… (direct) or g_… (group)The conversation id, as returned when the conversation was made.g_5f0c2a9e41b7d3c8a6e1f204
as_userstringrequired–1 to 128 characters: A-Z a-z 0-9 _ . : @ -; a memberThe member acting. From your server any member may add people.u_42
user_idsarray of stringsrequired–1 to 100 user ids; the group size limit of your planPeople to add. New members do not see older history.["u_7","u_8"]
FieldTypeWhat it means
idstringConversation id: d_… direct, g_… group.
typestringdirect or group.
namestring or nullGroup name; for a direct chat, the other person's name or id.
avatar_urlstring or nullGroup picture, or the other person's.
customobjectYour own data on the group.
member_countintegerNumber of members.
membersarray of stringsMember ids (groups up to 100 members; both people in a direct chat).
last_seqintegerThe seq of the newest message.
last_messageobject or nullThe newest message (same fields as a message).
last_message_atstring or nullISO time of the newest message.
read_seqintegerThe acting user's read position.
unread_countintegerlast_seq − read_seq for the acting user.
mutedbooleanWhether the acting user muted it.
rolestringThe acting user's role: owner, admin or member.
peerobjectDirect chats only: { id, name, avatar_url, custom } of the other person.
peer_read_seqintegerDirect chats only: how far the other person has read.
peer_delivered_seqintegerDirect chats only: how far messages reached the other person.
slow_mode_sintegerSlow mode in seconds (0 = off).
frozenbooleanWhether the conversation is frozen.
created_atstringISO time it was made.
updated_atstringISO time of the last change.
POST/v1/chat/conversations/{cid}/members/remove

Removes people from a group. Answers the updated conversation.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
cidstringrequired (in the path)–up to 120 characters; d_… (direct) or g_… (group)The conversation id, as returned when the conversation was made.g_5f0c2a9e41b7d3c8a6e1f204
as_userstringrequired–1 to 128 characters: A-Z a-z 0-9 _ . : @ -; a memberThe member acting. If the owner removes themself, the oldest member becomes owner.u_42
user_idsarray of stringsrequired–at least 1 user idPeople to remove.["u_8"]
FieldTypeWhat it means
idstringConversation id: d_… direct, g_… group.
typestringdirect or group.
namestring or nullGroup name; for a direct chat, the other person's name or id.
avatar_urlstring or nullGroup picture, or the other person's.
customobjectYour own data on the group.
member_countintegerNumber of members.
membersarray of stringsMember ids (groups up to 100 members; both people in a direct chat).
last_seqintegerThe seq of the newest message.
last_messageobject or nullThe newest message (same fields as a message).
last_message_atstring or nullISO time of the newest message.
read_seqintegerThe acting user's read position.
unread_countintegerlast_seq − read_seq for the acting user.
mutedbooleanWhether the acting user muted it.
rolestringThe acting user's role: owner, admin or member.
peerobjectDirect chats only: { id, name, avatar_url, custom } of the other person.
peer_read_seqintegerDirect chats only: how far the other person has read.
peer_delivered_seqintegerDirect chats only: how far messages reached the other person.
slow_mode_sintegerSlow mode in seconds (0 = off).
frozenbooleanWhether the conversation is frozen.
created_atstringISO time it was made.
updated_atstringISO time of the last change.
POST/v1/chat/conversations/{cid}/messages/{seq}/recall

Moderation recall of a message of any age. Answers the recalled message.

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
cidstringrequired (in the path)–up to 120 characters; d_… (direct) or g_… (group)The conversation id, as returned when the conversation was made.g_5f0c2a9e41b7d3c8a6e1f204
seqintegerrequired (in the path)–a positive integerThe message to recall. Any age: the recall window applies to app users only.42
as_userstringoptionalthe oldest member1 to 128 characters: A-Z a-z 0-9 _ . : @ -; a memberThe member shown as the one who recalled it (use an admin or bot member).mod_1
FieldTypeWhat it means
idstringMessage id (UUID).
cidstringConversation id (r_<room_id> for a room).
seqintegerGap-free position in the conversation, from 1. Sort by this.
client_idstring or nullYour idempotency key, if sent.
senderstringSender user id.
sender_namestringSender display name, when known.
typestringMessage type.
textstring or nullText after the profanity filter; null once recalled.
mentionsarray of stringsMentioned user ids.
reply_tointeger or nullThe seq it replies to.
attachmentobject or nullThe file, with a signed url valid for 7 days (store the key).
customobject or nullYour own data.
reactionsobjectEmoji to the user ids who reacted.
edited_atstring or nullISO time of the last edit.
recalledbooleanTrue once recalled (text, custom and reactions are cleared).
created_atstringISO time it was sent.
updated_atstringISO time of the last change.

Live rooms

Server-only. Rooms need no creation: the first join or server call makes the room.

PATCH/v1/chat/rooms/{room_id}

Sets slow mode or freezes the room. Everyone in the room receives a notice event with code: "room_settings".

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
room_idstringrequired (in the path)–1 to 96 characters: A-Z a-z 0-9 _ . : -Your own id for the live room. Rooms need no creation: the first join or server call makes it.live_123
slow_mode_sintegeroptionalunchanged (0 for a new room)0 to 3600One message per user every this many seconds. 0 turns slow mode off.10
frozenbooleanoptionalunchanged (false for a new room)true or falseA frozen room takes no messages from app users.false
FieldTypeWhat it means
room_idstringThe room.
slow_mode_sintegerSlow mode now in force.
frozenbooleanWhether the room is frozen now.
POST/v1/chat/rooms/{room_id}/messages

A host or system message; it skips slow mode, freeze and the per-user room rate. Answers 201 and the message (room messages are kept only as the last 50 for late joiners).

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
room_idstringrequired (in the path)–1 to 96 characters: A-Z a-z 0-9 _ . : -Your own id for the live room. Rooms need no creation: the first join or server call makes it.live_123
senderstringoptionalsystem1 to 128 characters: A-Z a-z 0-9 _ . : @ -Who the message is from (a host id, or system).host_1
sender_namestringoptional–any textThe name shown with it.Host
typestringoptionaltexttext, image, file, voice, custom, systemThe kind of message. system is server only.text
textstringrequired for text–up to 4,000 charactersThe message text. The project profanity filter masks or blocks it.Welcome!
customobjectrequired for custom–a JSON object up to 8 KBYour own data: a gift, a card, a poll, an order.{"kind":"gift","id":"rose"}
attachmentobjectrequired for image, file, voice–{ key } from an upload, or { url } (https, up to 1,000 characters); optional name, mime, size, width, height, duration_ms, waveform (up to 64 values 0–100)The file of a media message. Images need an image type and voice messages an audio type.{"key":"p_1/ab12.jpg","width":800,"height":600}
mentionsarray of stringsoptionalthe @user names found in the textup to 50 user idsUsers mentioned in the message.["u_99"]
reply_tointegeroptional–a positive seqThe seq of the message this one replies to.41
client_idstringoptional–up to 64 charactersYour idempotency key: the same value in the same room within 10 minutes is refused as a duplicate.c-7f3a
FieldTypeWhat it means
idstringMessage id (UUID).
cidstringConversation id (r_<room_id> for a room).
seqintegerGap-free position in the conversation, from 1. Sort by this.
client_idstring or nullYour idempotency key, if sent.
senderstringSender user id.
sender_namestringSender display name, when known.
typestringMessage type.
textstring or nullText after the profanity filter; null once recalled.
mentionsarray of stringsMentioned user ids.
reply_tointeger or nullThe seq it replies to.
attachmentobject or nullThe file, with a signed url valid for 7 days (store the key).
customobject or nullYour own data.
reactionsobjectEmoji to the user ids who reacted.
edited_atstring or nullISO time of the last edit.
recalledbooleanTrue once recalled (text, custom and reactions are cleared).
created_atstringISO time it was sent.
updated_atstringISO time of the last change.

Usage

GET/v1/chat/usage

Server-only. The current calendar month (UTC).

ParameterTypeRequiredDefaultAllowed valuesWhat it meansExample
No parameters.
FieldTypeWhat it means
monthstringThe calendar month (UTC), YYYY-MM.
enabledbooleanWhether chat is on for the account.
planobject or nullYour plan: id, name, free_mau, hard_mau_cap, tiers (from_mau, price_per_1k), max_pcc, max_messages_month, max_storage_mb, retention_days, max_group_members, max_upload_mb, billing.
switchesobject or nullWhich chat features are on (for example media, rooms, webhooks).
currencystringINR or USD.
mauintegerMonthly active users so far.
billable_mauintegerMAU above the free ones.
estimated_chargenumberThe month's charge so far, in the currency.
charged_so_farnumberWhat has already been debited.
messagesintegerMessages this month.
room_messagesintegerLive-room messages this month.
peak_connectionsintegerHighest concurrent connections.
storage_bytesintegerMedia stored now.
dailyarrayPer day: day, messages, room_messages, media_bytes, peak_connections.

End-user upload

POST/chat/v1/upload?cid=<cid>&name=<file name>

Headers: Authorization: Bearer <chat token> and Content-Type: <mime>; raw body (not multipart). Both query parameters are optional. Returns 201 { key, url, mime, size, name }. The size limit comes from your plan: Free 10 MB, Pay as you go 25 MB, Scale 50 MB. Content is checked, so an executable renamed to .png is refused. url is a signed link valid for 7 days, and messages get fresh links every time they are returned, so store the key. The SDKs call this for you, in Quick mode too.

Allowed types: images (JPEG, PNG, WebP, GIF, HEIC), audio (AAC, M4A, MP4, MPEG, Ogg, WebM, WAV), video (MP4, WebM, QuickTime), PDF, zip, text and office documents.

WebSocket

Connect to wss://api-videosdk.titliapp.com/chat/ws?token=<token>. All frames are JSON text, up to 64 KB. The SDKs do this for you; this section is for reference.

wire format
// request (rid is your own counter, echoed in the reply)
{ "op": "msg.send", "rid": 17, "cid": "d_9f...", "client_id": "c-uuid", "type": "text", "text": "hi" }
// reply
{ "op": "ack", "rid": 17, "ok": true, "data": { } }
{ "op": "ack", "rid": 17, "ok": false, "error": { "code": "rate_limited", "message": "...", "retry_after_ms": 800 } }
// server push
{ "op": "event", "type": "message.new", "data": { } }

The server sends hello after auth ({ protocol, session_id, user, server_time, heartbeat_ms, limits, features }); the client pings every heartbeat_ms (25 seconds) and a connection that sends nothing for twice that plus 5 seconds is dropped. Every request with a rid gets exactly one ack.

Close codeReasonWhat the client does
4001Token invalid or expired, or no auth within 10 secondsGet a new token (tokenProvider) and reconnect
4003chat_disabled, project_disabled, banned, cap_reached (Free plan MAU cap), payment_required (new user, empty balance)Do not retry; show the reason
4008The client is not reading (too slow)Reconnect with backoff
4029More than 10 connections for this user, or the plan's concurrent-connection capReconnect with backoff
1001Server restartReconnect at once

Operations

OperationRequest fieldsReply
conv.listlimit (≤ 100), before{ items, next }
conv.directuser_idConversation (created if missing)
conv.getcidConversation
conv.createname, members, avatar_url, custom (always a group; the caller becomes owner)Conversation
conv.update, conv.members.add, conv.members.removecid and the change: name, avatar_url, custom, or user_ids (admin or owner; groups only)Conversation
conv.readcid, seq{ read_seq, unread_count }
conv.mutecid, muted{ muted }
conv.leavecid (groups only){}
msg.sendcid, client_id (optional idempotency key), type, text, attachment, custom, mentions, reply_toMessage
msg.listcid, before_seq or after_seq, limit (≤ 100, default 30){ items, has_more }, ascending seq
msg.editcid, seq, text (sender; text messages)Message
msg.recallcid, seq (sender; within the recall window)Message
msg.reactcid, seq, emoji, add (up to 20 different emoji per message)Message
msg.deletecid, seqs (≤ 100; hides for me only){}
msg.deliveredcid, seq{}
msg.searchcid, q (2–100 characters), limit (≤ 50, default 20){ items }, newest first
msg.reportcid, seq, reason (≤ 500 characters){ report_id }
typingcid, on{}
presence.subscribe, presence.unsubscribeuser_ids (≤ 200 per call, 1,000 per connection){ users: { id: { online, last_seen_at } } }, or {}
user.block, user.unblockuser_id{}
user.blocks{ user_ids }
user.updatename, avatar_url, customUser
room.joinroom_id (up to 10 rooms per connection){ conversation, recent, member_count }
room.leaveroom_id{}
push.registerplatform (fcm or apns), token{}
push.unregistertoken{}
call.inviteinvitees (1–16), timeout_s (5–120, default 30), data (≤ 2 KB){ invitation_id, expires_at }
call.accept, call.reject, call.cancelinvitation_id (plus data on accept, reason on reject){}

Room messages use msg.send with cid: "r_<room_id>" after room.join.

Events

EventData
message.newMessage (also sent to the sender's other devices)
message.updatedMessage (edit, recall, reaction)
conversation.updatedConversation without the per-user fields (new group, rename, members changed)
conversation.removed{ cid } (you were removed or you left)
receipt{ cid, user_id, read_seq, delivered_seq }
typing{ cid, user_id, on }
presence{ user_id, online, last_seen_at }
room.members{ room_id, member_count }, at most every 5 seconds
call.invite{ invitation_id, inviter, inviter_name, invitees, data, expires_at }
call.accepted, call.rejected, call.cancelled, call.timeout{ invitation_id, user_id } plus data (accepted) or reason (rejected)
notice{ code: "room_settings", room_id, slow_mode_s, frozen } after your server changes a room

Ordering, receipts and unread

  • Every message has a per-conversation seq: gap-free, starting at 1, assigned by the server. Sort by seq, never by time.
  • Sends are idempotent by client_id, so a retried message is never duplicated.
  • Ticks: read if peer_read_seq ≥ seq, else delivered if peer_delivered_seq ≥ seq, else sent.
  • unread_count = last_seq − read_seq. Rooms have no unread count, and room messages are kept only for late joiners (the last 50).

Webhooks

Enable chat events per project in Console → Chat → Settings. They go to the project's webhook URL with the same signature and retry policy as call events (Titli-Signature: t=<ts>,v1=<hmac>).

EventPayload
chat.message.sent{ conversation_id, conversation_type, message }
chat.message.recalled{ conversation_id, seq, by }
chat.report.created{ report_id, conversation_id, seq, reporter, reported_user, reason }

Push payload

push payload
// a message
{ "titli_chat": "1", "kind": "message", "cid": "d_9f...", "seq": "42", "sender": "u_1",
  "title": "Asha", "body": "Hello!" }
// a call invite
{ "titli_chat": "1", "kind": "call_invite", "invitation_id": "inv_4c1e...", "sender": "u_1",
  "cid": "d_9f...", "title": "Asha", "body": "Incoming video call" }

All values are strings. body is the text preview (up to 100 characters), a media label, or "New message" when previews are off for the project. On FCM a message push also has a notification block and a call invite is data-only (your app shows the ringing). On APNs both are normal alert pushes; VoIP (PushKit) pushes are not sent, and the call push does not carry the invite data.

Limits

LimitDefault
Text message4,000 characters
Requests per connection30 per second (burst 60)
Sends per connection10 per second (burst 20)
Live-room messages per user5 per 10 seconds (project setting)
Slow mode0–3,600 seconds per room
Connections per user10
Rooms per connection10
Presence watched per connection1,000 users (200 per call)
Call invite1–16 invitees, timeout 5–120 seconds
Server API20 requests per second per API key (burst 40)
Custom data on a message8 KB
Typing indicatorsGroups up to 100 members
Group size, upload size, historyBy plan: see pricing

Errors

The same codes arrive over the WebSocket in a failed ack ({ "ok": false, "error": { code, message } }).

HTTPCodeWhat it meansWhat to do
400invalid_request, invalid_jsonA field is missing or malformed; the message says whichFix the request. Send Content-Type: application/json
400message_too_longText over 4,000 charactersShorten or split
400unsupported_media_typeUpload type not allowed, or the bytes do not match the typeSend an allowed type
401unauthorized, invalid_api_key, key_revoked, key_expiredNo or wrong API key; for upload, an invalid or expired chat tokenUse a current key; mint a fresh token
402payment_requiredA new MAU beyond the free tier while the prepaid balance is emptyRecharge; existing users are not affected
403chat_disabledChat is not on for the accountConsole → Chat → Turn on chat
403forbiddenNot a group admin, a frozen room, or a switched-off featureSee the message
403blockedOne of the two users blocked the otherShow it; do not retry
403ip_not_allowed, project_disabled, vendor_suspended, vendor_closedKey or account restriction, as on the video APIConsole, or contact support
404not_found, not_memberUnknown user or message; or the acting user is not in that conversationUse a member as sender, as_user or user_id
409recall_window_passedApp-side recall after the project's recall windowRecall from your server instead
413payload_too_largeUpload over the plan limitCompress, or upgrade
422profanity_blockedThe project filter is in block mode and the text hit itTell the user; nothing was stored
429rate_limited, slow_modeToo fastWait retry_after_ms, then retry
429cap_reachedA plan cap: monthly messages, group size, storage, MAU on the Free planUpgrade, or wait for the next month
500internal_errorOur sideRetry with backoff
Start free