Messaging
Conversations, messages, read receipts.
Direct conversations are deduplicated — creating a direct conversation with the same two participants returns the existing row instead of a new one. Participation is enforced on every read / write.
Source: apps/api/src/routes/client/messaging.ts.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /client/messaging/conversations | Create or return an existing direct conversation. |
| GET | /client/messaging/conversations | Caller's conversations with participant list. |
| POST | /client/messaging/conversations/:conversationId/messages | Send a message. |
| GET | /client/messaging/conversations/:conversationId/messages | Paginated message list. |
| POST | /client/messaging/conversations/:conversationId/read | Update last_read_at. |
POST /client/messaging/conversations
Direct conversations with one participant_ids entry are deduplicated.
Request (CreateConversationInput)
| Field | Type | Required | Default |
|---|---|---|---|
type | "direct" | "group" | no | "direct" |
name | string | no | null |
participant_ids | uuid[] | yes | — |
The caller is auto-added to participant_ids — no need to include yourself.
Response 201 (created) / 200 (existing direct)
Errors
500 CREATE_FAILED.
Try it:
/client/messaging/conversationscurl -X POST 'https://api.amba.dev/client/messaging/conversations'Curl:
GET /client/messaging/conversations
Caller's conversations, ordered by updated_at DESC, with a conversation_participants array that includes each participant's display info.
Query
| Param | Default |
|---|---|
limit | 20 |
offset | 0 |
Response 200
Try it:
/client/messaging/conversationscurl -X GET 'https://api.amba.dev/client/messaging/conversations'Curl:
POST /client/messaging/conversations/:conversationId/messages
Request (SendMessageInput)
| Field | Type | Required | Default |
|---|---|---|---|
body | string | yes | — |
message_type | string | no | "text" |
metadata | object | no | {} |
Response 201
Errors
403 NOT_A_PARTICIPANT.500 SEND_FAILED.
Try it:
/client/messaging/conversations/%7B%7BconversationId%7D%7D/messagescurl -X POST 'https://api.amba.dev/client/messaging/conversations/%7B%7BconversationId%7D%7D/messages'Curl:
GET /client/messaging/conversations/:conversationId/messages
Messages in the conversation with sender info, newest first.
Query
| Param | Default |
|---|---|
limit | 50 |
offset | 0 |
Response 200
Errors
403 NOT_A_PARTICIPANT.
Try it:
/client/messaging/conversations/%7B%7BconversationId%7D%7D/messagescurl -X GET 'https://api.amba.dev/client/messaging/conversations/%7B%7BconversationId%7D%7D/messages'Curl:
POST /client/messaging/conversations/:conversationId/read
Stamp the caller's conversation_participants.last_read_at = now().
Response 200
Updated participant row.
Errors
404 UPDATE_FAILED— caller is not a participant.500 UPDATE_FAILED.
Try it:
/client/messaging/conversations/%7B%7BconversationId%7D%7D/readcurl -X POST 'https://api.amba.dev/client/messaging/conversations/%7B%7BconversationId%7D%7D/read'Curl: