ThreadRpc
ThreadRpc provides the thread-related JSON-RPC surface for creating, listing, updating, deleting, and managing chat thread membership, as well as a small set of thread-scoped file and sandbox helpers. It also includes title generation support and a read-marking action for the current user.
Endpoints
POST /api/rpc (Method: ThreadRpc.create)
Description: Creates a new chat thread.
Request Body:
{ "method": "ThreadRpc.create", "params": { "agentName": "string", "title": "string", "type": "ai_only | ai_human | group", "groupName": "string", "aiResponseMode": "always | mentioned | manual" } }Parameters:
Name Type Required Description agentNameStringYes Agent name associated with the new thread. titleStringNo Initial thread title. typeStringNo Thread type. Allowed values are ai_only,ai_human, andgroup.groupNameStringNo Group name for group threads. aiResponseModeStringNo AI response mode. Allowed values are always,mentioned, andmanual.Response:
{ "success": true, "data": { "...": "Depends on the underlying thread creation result." } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ThreadRpc.create", "params": { "agentName": "sales-assistant" } }'
POST /api/rpc (Method: ThreadRpc.getData)
Description: Lists all threads the current user participates in.
Request Body:
{ "method": "ThreadRpc.getData", "params": { "filter": {}, "page": 1, "pageSize": 50 } }Parameters:
Name Type Required Description filterRecord<string, any>No Arbitrary filter object. Defaults to an empty object. pageNumberNo Page number. Must be a positive integer. Defaults to 1.pageSizeNumberNo Page size. Must be a positive integer. Defaults to 50.Response:
{ "success": true, "data": { "...": "Thread list data returned by the thread listing service." } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ThreadRpc.getData", "params": { "page": 1, "pageSize": 50 } }'
POST /api/rpc (Method: ThreadRpc.update)
Description: Updates thread metadata, including title, group name, group avatar, AI response mode, and status.
Request Body:
{ "method": "ThreadRpc.update", "params": { "_id": "string", "title": "string", "groupName": "string", "groupAvatarUrl": "string", "aiResponseMode": "always | mentioned | manual", "status": "active | archived" } }Parameters:
Name Type Required Description _idStringYes Thread identifier. titleStringNo New thread title. groupNameStringNo New group name. groupAvatarUrlStringNo Group avatar URL. aiResponseModeStringNo AI response mode. Allowed values are always,mentioned, andmanual.statusStringNo Thread status. Allowed values are activeandarchived.Response:
{ "success": true, "data": { "...": "Updated thread data." } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ThreadRpc.update", "params": { "_id": "thread_123", "title": "New title" } }'
POST /api/rpc (Method: ThreadRpc.delete)
Description: Deletes a thread and all its messages.
Request Body:
{ "method": "ThreadRpc.delete", "params": { "_id": "string" } }Parameters:
Name Type Required Description _idStringYes Thread identifier. Response:
{ "success": true, "data": { "...": "Deletion result returned by the thread service." } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ThreadRpc.delete", "params": { "_id": "thread_123" } }'
POST /api/rpc (Method: ThreadRpc.addMember)
Description: Adds a participant to a thread.
Request Body:
{ "method": "ThreadRpc.addMember", "params": { "threadId": "string", "participantId": "string", "participantType": "user | agent | contact", "displayName": "string", "avatarUrl": "string | null", "transport": "string | null", "transportId": "string | null", "role": "member | observer | assistant" } }Parameters:
Name Type Required Description threadIdStringYes Thread identifier. participantIdStringYes Participant identifier. participantTypeStringNo Participant type. Allowed values are user,agent, andcontact. Defaults touser.displayNameStringNo Display name for the participant. avatarUrlStringorNullNo Participant avatar URL. transportStringorNullNo Transport name. transportIdStringorNullNo Transport-specific identifier. roleStringNo Participant role. Allowed values are member,observer, andassistant. Defaults tomember.Response:
{ "success": true, "data": { "...": "Updated thread data." } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ThreadRpc.addMember", "params": { "threadId": "thread_123", "participantId": "user_456" } }'
POST /api/rpc (Method: ThreadRpc.removeMember)
Description: Removes a participant from a thread.
Request Body:
{ "method": "ThreadRpc.removeMember", "params": { "threadId": "string", "participantId": "string" } }Parameters:
Name Type Required Description threadIdStringYes Thread identifier. participantIdStringYes Participant identifier. Response:
{ "success": true, "data": { "...": "Removal result returned by the thread service." } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ThreadRpc.removeMember", "params": { "threadId": "thread_123", "participantId": "user_456" } }'
POST /api/rpc (Method: ThreadRpc.markAsRead)
Description: Marks the thread as read up to a specific message.
Request Body:
{ "method": "ThreadRpc.markAsRead", "params": { "threadId": "string", "messageId": "string" } }Parameters:
Name Type Required Description threadIdStringYes Thread identifier. messageIdStringNo Message identifier used as the read boundary. Response:
{ "success": true, "data": { "success": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ThreadRpc.markAsRead", "params": { "threadId": "thread_123", "messageId": "msg_789" } }'
POST /api/rpc (Method: ThreadRpc.setUserState)
- Description: Updates scoped user preferences for a thread, including pin, star, and archive state.
- Request Body:
{ "method": "ThreadRpc.setUserState", "params": { "threadId": "string", "preferences": { "is