livqenoDocs

API ReferenceChat

Chat API

Conversations, members, messages, reactions, receipts, presence, and attachments.

These endpoints manage conversations and messages. They're called from two places:

  • Your backend, with the project API key, to set things up: create a conversation, add members, make chat tokens, or post a system message ("Your order has shipped").
  • Your users' apps, with a chat token, through @livqeno/chat. Most live chat traffic (sending, typing, reactions) goes over the chat WebSocket instead; these REST endpoints are for things like loading history.

So chat endpoints accept two kinds of credential:

CredentialActs asCan do
Project API keyYour serverEverything, for any user in the project.
Chat tokenOne userOnly what the token allows. The request body can't add more.

The usual backend sequence:

  1. Create the conversation with POST /v1/chat/conversations. Send getOrCreate: true, so the second caller gets the same conversation back instead of a 409 RAVEN_CONFLICT.
  2. Add the user as a member with POST /v1/chat/conversations/{room}/members (or pass members when creating). A chat token only reaches conversations its user belongs to.
  3. Mint the token with POST /v1/chat/tokens. The response's pendingMembership lists every conversation in conversations the user is not a member of yet. The token is still valid, but those conversations answer 404 ROOM_NOT_FOUND until you add the membership. An empty list means the user is ready.

More: Chat authentication.

Endpoints

MethodPathCredential
POST/v1/chat/attachments/{attachmentId}/completeProject API key or chat token
GET/v1/chat/attachments/{attachmentId}/download-urlProject API key or chat token
GET/v1/chat/bansProject API key or chat token
POST/v1/chat/bansProject API key or chat token
DELETE/v1/chat/bans/{userId}Project API key or chat token
GET/v1/chat/conversationsProject API key or chat token
POST/v1/chat/conversationsProject API key or chat token
DELETE/v1/chat/conversations/{room}Project API key or chat token
GET/v1/chat/conversations/{room}Project API key or chat token
PATCH/v1/chat/conversations/{room}Project API key or chat token
POST/v1/chat/conversations/{room}/attachmentsProject API key or chat token
GET/v1/chat/conversations/{room}/bansProject API key or chat token
POST/v1/chat/conversations/{room}/bansProject API key or chat token
DELETE/v1/chat/conversations/{room}/bans/{userId}Project API key or chat token
GET/v1/chat/conversations/{room}/eventsProject API key or chat token
POST/v1/chat/conversations/{room}/leaveProject API key or chat token
GET/v1/chat/conversations/{room}/membersProject API key or chat token
POST/v1/chat/conversations/{room}/membersProject API key or chat token
DELETE/v1/chat/conversations/{room}/members/{userId}Project API key or chat token
GET/v1/chat/conversations/{room}/members/{userId}/last-seenProject API key or chat token
GET/v1/chat/conversations/{room}/messagesProject API key or chat token
POST/v1/chat/conversations/{room}/messagesProject API key or chat token
GET/v1/chat/conversations/{room}/mutesProject API key or chat token
POST/v1/chat/conversations/{room}/mutesProject API key or chat token
DELETE/v1/chat/conversations/{room}/mutes/{userId}Project API key or chat token
GET/v1/chat/conversations/{room}/pinsProject API key or chat token
GET/v1/chat/conversations/{room}/presenceProject API key or chat token
GET/v1/chat/conversations/{room}/read-receiptsProject API key or chat token
GET/v1/chat/conversations/{room}/read-stateProject API key or chat token
GET/v1/chat/conversations/{room}/searchProject API key or chat token
GET/v1/chat/conversations/{room}/typingProject API key or chat token
GET/v1/chat/flagsProject API key or chat token
PATCH/v1/chat/flags/{flagId}Project API key or chat token
GET/v1/chat/me/blocksProject API key or chat token
DELETE/v1/chat/me/blocks/{userId}Project API key or chat token
POST/v1/chat/me/blocks/{userId}Project API key or chat token
GET/v1/chat/me/conversationsProject API key or chat token
PATCH/v1/chat/me/conversations/{room}Project API key or chat token
GET/v1/chat/me/devicesProject API key or chat token
POST/v1/chat/me/devicesProject API key or chat token
DELETE/v1/chat/me/devices/{token}Project API key or chat token
DELETE/v1/chat/messages/{messageId}Project API key or chat token
GET/v1/chat/messages/{messageId}Project API key or chat token
PATCH/v1/chat/messages/{messageId}Project API key or chat token
POST/v1/chat/messages/{messageId}/flagsProject API key or chat token
DELETE/v1/chat/messages/{messageId}/pinProject API key or chat token
POST/v1/chat/messages/{messageId}/pinProject API key or chat token
POST/v1/chat/messages/{messageId}/reactionsProject API key or chat token
DELETE/v1/chat/messages/{messageId}/reactions/{emoji}Project API key or chat token
POST/v1/chat/messages/{messageId}/readProject API key or chat token
GET/v1/chat/messages/{messageId}/revisionsProject API key or chat token
GET/v1/chat/messages/{messageId}/threadProject API key or chat token
GET/v1/chat/mutesProject API key or chat token
POST/v1/chat/mutesProject API key or chat token
DELETE/v1/chat/mutes/{userId}Project API key or chat token
GET/v1/chat/searchProject API key or chat token
POST/v1/chat/tokensProject API key or chat token
DELETE/v1/chat/tokens/{tokenId}Project API key or chat token
GET/v1/chat/users/{userId}/blocksProject API key or chat token
DELETE/v1/chat/users/{userId}/blocks/{blockedId}Project API key or chat token
POST/v1/chat/users/{userId}/blocks/{blockedId}Project API key or chat token
DELETE/v1/chat/users/{userId}/dataProject API key or chat token
GET/v1/chat/users/{userId}/exportProject API key or chat token

POST/v1/chat/attachments/{attachmentId}/complete

Confirm the upload finished, making the attachment sendable

Credential Project API key or chat token

ParameterInTypeRequiredNotes
attachmentIdpathstringYes

GET/v1/chat/attachments/{attachmentId}/download-url

Short-lived signed download URL for an attachment you can see

Credential Project API key or chat token

ParameterInTypeRequiredNotes
attachmentIdpathstringYes

GET/v1/chat/bans

Active app-wide bans

Credential Project API key or chat token

No parameters.

POST/v1/chat/bans

Ban a user from every conversation in this environment

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdbodystringYes1–256 chars — Your user id for the person being banned or muted.
reasonbodystringNoShown to moderators, never to the user.
durationSecondsbodynumberNo1–∞ — Omit for a restriction that lasts until lifted.

DELETE/v1/chat/bans/{userId}

Lift an app-wide ban (idempotent)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes

GET/v1/chat/conversations

List the project's conversations

Credential Project API key or chat token

No parameters.

POST/v1/chat/conversations

Create a conversation, optionally attached to an RTC room

Credential Project API key or chat token

ParameterInTypeRequiredNotes
namebodystringYes1–128 chars, pattern-checked — Unique within the project. Doubles as a human-readable handle for chat.connect({ room }).
typebodyConversationTypeNoROOM · CHANNEL · DIRECT — Defaults to ROOM when roomId is set and to CHANNEL otherwise, but an explicit value here always wins —
roomIdbodystringNoAttach this conversation to an existing RTC room, giving that video call a chat panel.
retentionDaysbodynumberNo1–3650 — Overrides CHAT_RETENTION_DAYS for this conversation.
membersbodyConversationMemberDto[]Noarray — IMPORTANT: a conversation created with no members is unreadable and unwritable by every client chat
metadatabodyRecord<string, unknown>NoArbitrary developer-owned JSON. Size-capped like message metadata.
getOrCreatebodybooleanNoWhen true, a name collision returns the existing conversation instead of a 409 — including when two
modebodyConversationModeValueNobroadcast_audience is for very large, live audiences (a live stream's chat): viewers join with a viewer

DELETE/v1/chat/conversations/{room}

Hard-delete a conversation and everything in it

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

GET/v1/chat/conversations/{room}

Get one conversation by conv_ id, uuid, RTC room id, or name

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

PATCH/v1/chat/conversations/{room}

Rename, archive, or re-configure retention for a conversation

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
namebodystringNo1–128 chars, pattern-checked
statusbodyConversationStatusNoACTIVE · ARCHIVED
retentionDaysbodynumberNo1–3650
metadatabodyRecord<string, unknown>No

POST/v1/chat/conversations/{room}/attachments

Get a signed upload URL

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
filenamebodystringYes1–255 chars
mimeTypebodystringYes0–255 chars, pattern-checked
sizebodynumberYes1–1024 — Declared size in bytes, checked against STORAGE_MAX_ATTACHMENT_BYTES before a URL is issued.
uploaderIdbodystringNo0–128 chars — API-key callers only — ignored for browser chat tokens.
metadatabodyRecord<string, unknown>NoDeveloper-owned JSON, e.g. image dimensions.

GET/v1/chat/conversations/{room}/bans

Active bans in a conversation

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

POST/v1/chat/conversations/{room}/bans

Ban a user from a conversation

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
userIdbodystringYes1–256 chars — Your user id for the person being banned or muted.
reasonbodystringNoShown to moderators, never to the user.
durationSecondsbodynumberNo1–∞ — Omit for a restriction that lasts until lifted.

DELETE/v1/chat/conversations/{room}/bans/{userId}

Lift a conversation ban (idempotent)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
userIdpathstringYes

GET/v1/chat/conversations/{room}/events

Catch up on everything that happened after an eventSeq

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

POST/v1/chat/conversations/{room}/leave

Leave a conversation as the chat token's own user (soft — messages keep their author)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

GET/v1/chat/conversations/{room}/members

List active members

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

POST/v1/chat/conversations/{room}/members

Add or re-activate a member

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
userIdbodystringYes1–128 chars — Your own user identity string — Livqeno never owns end-user accounts.
rolebodyChatMemberRoleNoMEMBER · MODERATOR · ADMIN
metadatabodyRecord<string, unknown>No

DELETE/v1/chat/conversations/{room}/members/{userId}

Remove a member (soft — their messages keep a resolvable author)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
userIdpathstringYes

GET/v1/chat/conversations/{room}/members/{userId}/last-seen

When a member last disconnected from chat

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
userIdpathstringYes

GET/v1/chat/conversations/{room}/messages

Message history, newest first, cursor-paginated

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
limitquerynumberNo1–100
beforequerystringNo0–256 chars — Opaque cursor from a previous page's nextCursor — walks backwards into history. Cursor-based, not offset-based, so pages stay stable while new messages arrive.
afterquerystringNo0–256 chars — Opaque cursor that walks forward toward newer messages. This is how a client catches up on what it missed while disconnected.
afterSeqquerystringNopattern-checked — Phase 3: only messages with seq greater than this (a string of digits). Walks forward, like after, and is
beforeSeqquerystringNopattern-checked — Phase 3: only messages with seq less than this. Walks backwards, like before.
threadRootIdquerystringNo0–64 chars — Restrict to one thread, by the root message's public id.
senderIdquerystringNo0–128 chars — Restrict to one sender.
includeDeletedquerybooleanNoInclude soft-deleted messages as tombstones (no text). Useful for moderation views.

POST/v1/chat/conversations/{room}/messages

Send a message

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
textbodystringNoRequired for text messages. Length capped by CHAT_MAX_TEXT_LENGTH.
typebodystringNo"system" and "event" are server-only — a browser chat token cannot send them.
replyTobodystringNo0–64 chars — Public id of the message being replied to. Must be in the same conversation.
clientMessageIdbodystringNo0–128 chars — Idempotency key. Retrying a send with the same key returns the original message instead of creating a duplicate — which is what makes a reconnect-and-retry safe.
attachmentIdbodystringNo0–64 chars — Public id of an already-uploaded attachment (att_...).
metadatabodyRecord<string, unknown>NoDeveloper-owned JSON. Capped by CHAT_MAX_METADATA_BYTES.
senderIdbodystringNo0–128 chars — API-key callers only: the user this message is attributed to. Ignored for browser chat tokens, which always send as the token subject.
clientSentAtbodynumberNo0–∞ — Client send timestamp (epoch ms), used only for latency measurement. Never trusted as createdAt — the server stamps that.
mentionsbodystring[]No0–128 chars, array — User ids mentioned in this message (max 50). Stored and returned as mentions; mentioned members are

GET/v1/chat/conversations/{room}/mutes

Active mutes in a conversation

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

POST/v1/chat/conversations/{room}/mutes

Mute a user in a conversation

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
userIdbodystringYes1–256 chars — Your user id for the person being banned or muted.
reasonbodystringNoShown to moderators, never to the user.
durationSecondsbodynumberNo1–∞ — Omit for a restriction that lasts until lifted.

DELETE/v1/chat/conversations/{room}/mutes/{userId}

Lift a conversation mute (idempotent)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
userIdpathstringYes

GET/v1/chat/conversations/{room}/pins

Pinned messages, most recently pinned first

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

GET/v1/chat/conversations/{room}/presence

Who is present right now. Ephemeral — never read from Postgres.

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

GET/v1/chat/conversations/{room}/read-receipts

Every member's read position — what a "seen by" row is built from

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

GET/v1/chat/conversations/{room}/read-state

Your read position and unread count for this conversation

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

GET/v1/chat/conversations/{room}/search

Full-text search in one conversation (members only), newest match first

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
qquerystringYes1–256 chars — Words to match. Postgres full-text search, simple configuration.
limitquerynumberNo1–50
cursorquerystringNo0–256 chars — Opaque cursor from the previous page's nextCursor. Newest matches first.

GET/v1/chat/conversations/{room}/typing

Who is typing right now

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes

GET/v1/chat/flags

The review queue, newest first. Includes the reported message text.

Credential Project API key or chat token

ParameterInTypeRequiredNotes
statusquerystringNoOmit for every status.
limitquerynumberNo1–100
cursorquerystringNo0–128 chars — nextCursor from the previous page.

PATCH/v1/chat/flags/{flagId}

Resolve, dismiss or reopen a flag

Credential Project API key or chat token

ParameterInTypeRequiredNotes
flagIdpathstringYes
statusbodystringYes

GET/v1/chat/me/blocks

Users you have blocked

Credential Project API key or chat token

No parameters.

DELETE/v1/chat/me/blocks/{userId}

Unblock a user (idempotent)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes

POST/v1/chat/me/blocks/{userId}

Block a user: their messages, reactions, typing and presence stop reaching you

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes

GET/v1/chat/me/conversations

The calling user's inbox: their conversations, newest activity first

Credential Project API key or chat token

No parameters.

PATCH/v1/chat/me/conversations/{room}

Set your notification preference for one conversation

Credential Project API key or chat token

ParameterInTypeRequiredNotes
roompathstringYes
notificationsbody(typeof NOTIFICATION_LEVELS)[number]No
mutedbodybooleanNotrue behaves exactly like notifications: "none".

GET/v1/chat/me/devices

Your registered push devices

Credential Project API key or chat token

No parameters.

POST/v1/chat/me/devices

Register this device for push (upsert)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
providerbody(typeof PUSH_PROVIDERS)[number]Yes
tokenbodystringYes8–∞ chars — The APNs device token (hex) or FCM registration token.
platformbody(typeof PUSH_PLATFORMS)[number]Yes
appBundleIdbodystringNo0–255 chars — APNs topic override, when one Apple team ships several apps.

DELETE/v1/chat/me/devices/{token}

Unregister a device (idempotent)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
tokenpathstringYes

DELETE/v1/chat/messages/{messageId}

Soft-delete a message; emits message.deleted

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes

GET/v1/chat/messages/{messageId}

Get one message

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes

PATCH/v1/chat/messages/{messageId}

Edit a message — sets editedAt and returns edited: true

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes
textbodystringNo
metadatabodyRecord<string, unknown>No

POST/v1/chat/messages/{messageId}/flags

Report a message for review

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes
reasonbody(typeof FLAG_REASONS)[number]Yes
notebodystringNo
reporterIdbodystringNo0–256 chars — API key only: who is reporting. A chat token always reports as itself.

DELETE/v1/chat/messages/{messageId}/pin

Unpin a message (MODERATOR+ or API key). Broadcasts message.unpinned.

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes

POST/v1/chat/messages/{messageId}/pin

Pin a message (MODERATOR+ or API key). Broadcasts message.pinned.

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes

POST/v1/chat/messages/{messageId}/reactions

Add a reaction (idempotent per user+emoji)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes

DELETE/v1/chat/messages/{messageId}/reactions/{emoji}

Remove a reaction

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes
emojipathstringYes

POST/v1/chat/messages/{messageId}/read

Mark this message — and everything before it — as read

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes

GET/v1/chat/messages/{messageId}/revisions

Edit history: what this message said before each edit, newest first

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes

GET/v1/chat/messages/{messageId}/thread

This message's thread, oldest first: the root, then its replies

Credential Project API key or chat token

ParameterInTypeRequiredNotes
messageIdpathstringYes
limitquerynumberNo1–100
cursorquerystringNo0–128 chars — Opaque cursor from the previous page's nextCursor. Walks forward, oldest first.

GET/v1/chat/mutes

Active app-wide mutes

Credential Project API key or chat token

No parameters.

POST/v1/chat/mutes

Mute a user in every conversation in this environment

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdbodystringYes1–256 chars — Your user id for the person being banned or muted.
reasonbodystringNoShown to moderators, never to the user.
durationSecondsbodynumberNo1–∞ — Omit for a restriction that lasts until lifted.

DELETE/v1/chat/mutes/{userId}

Lift an app-wide mute (idempotent)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes

GET/v1/chat/search

Full-text search across the project environment (API key only)

Credential Project API key or chat token

No parameters.

POST/v1/chat/tokens

Mint a short-lived chat token for one of your users

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdbodystringYes1–128 chars, pattern-checked — The end user this token speaks for. Everything they send is attributed to this identity — the browser can never override it.
conversationsbodystring[]Noarray — Conversation references (conv_ id, uuid, or name) this token may touch. Omit to allow every conversation the user is a member of.
scopesbodystring[]Noarray — Narrows the token below what the user's role allows. Can only ever remove permissions — listing "chat:manage" here does not grant it.
ttlSecondsbodynumberNo60–21600 — Lifetime in seconds. Defaults to CHAT_TOKEN_DEFAULT_TTL_SECONDS, capped at CHAT_TOKEN_MAX_TTL_SECONDS. There is no non-expiring chat token.
audiencebodybooleanNoPhase 3: mint a broadcast_audience viewer token. Requires exactly one conversation in conversations, in

DELETE/v1/chat/tokens/{tokenId}

Revoke a minted chat token before it expires

Credential Project API key or chat token

ParameterInTypeRequiredNotes
tokenIdpathstringYes

GET/v1/chat/users/{userId}/blocks

Server-side: users this user has blocked

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes

DELETE/v1/chat/users/{userId}/blocks/{blockedId}

Server-side: remove a block (idempotent)

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes
blockedIdpathstringYes

POST/v1/chat/users/{userId}/blocks/{blockedId}

Server-side: make one user block another

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes
blockedIdpathstringYes

DELETE/v1/chat/users/{userId}/data

Erase a user's chat data

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes

GET/v1/chat/users/{userId}/export

Export a user's messages, memberships, reactions, blocks and devices as JSON

Credential Project API key or chat token

ParameterInTypeRequiredNotes
userIdpathstringYes

Next steps