Query session messages¶
Read saved messages in visible sessions. This interface is read-only. New messages are written by the A2A runtime called by the agent and are not created through this interface.
GET $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/conversations/{conversation_id}/messages
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query agent session details or create agent session to obtain the session ID. Prepare the personal access token, target workspace ID, and session ID that can access the target workspace.
Request parameters¶
curl --get "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/conversations/$CONVERSATION_ID/messages" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
--data-urlencode "agent_id=$AGENT_ID" \
--data-urlencode "role=assistant" \
--data-urlencode "limit=50"
Path parameters
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
The current workspace ID must be consistent with X-Workspace-ID. |
|
string |
Yes |
The session ID to view messages. |
Query parameters
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
View only sessions belonging to the specified agent. If not provided, filtering by agent ID is not performed. |
|
string |
No |
The workspace ID to which the agent belongs. If this parameter is not provided when agent_id is specified, the current workspace will be used. Only the current workspace or system workspace can be specified. |
|
string |
No |
Filter by message role. |
|
integer |
No |
Single return quantity. When it is not provided or is less than or equal to 0, it is 50, and the maximum is 200. |
|
integer |
No |
Returns the offset. 0 when not provided or less than 0. |
Successful response¶
{
"code": 0,
"data": {
"items": [
{
"id": "msg_01",
"workspace_id": "ws_01",
"conversation_id": "conv_01",
"task_id": "task_01",
"agent_id": "agent_01",
"role": "assistant",
"parts": [
{
"kind": "text",
"text": "分析已完成"
}
],
"seq": 2,
"created_at": "2026-01-02T15:04:05Z"
}
],
"total": 1,
"limit": 50,
"offset": 0
}
}
Returns 200 on success. data.items is a saved message on this page. It provides related information and content segments according to the session message serial number.
Field |
Type |
Description |
|---|---|---|
|
integer |
0 on success. |
|
array |
List of messages on this page. |
|
integer |
The total number of messages matching the filter criteria. |
|
integer |
The upper limit of return quantity actually adopted this time. |
|
integer |
The actual offset used this time. |
|
string |
Message ID. |
|
string |
The workspace ID to which the message belongs. |
|
string |
The session ID to which the message belongs. |
|
string |
Associated task ID. Does not return when there are no associated tasks. |
|
string |
Associated agent ID. It will not be returned when there is no associated agent. |
|
string |
Associated runtime manifest ID. Does not return if there is no associated list. |
|
string |
Message role. |
|
array |
Message content segmentation. |
|
object |
A message content segment. The fields are determined by the message segment type. |
|
string |
Parent message ID. Does not return if there is no parent message. |
|
integer |
Message sequence number within the session. |
|
string |
Message creation time, in RFC 3339 format. |
Error response¶
{
"code": 3,
"message": "会话不存在"
}
Common HTTP errors
HTTP status code |
error code |
Description |
|---|---|---|
|
|
The session ID, agent filter parameter, or paging parameter is invalid. Recommendation: Check the path and query parameters. |
|
|
The session does not exist, is not visible, or does not belong to the specified agent scope. Suggestion: Confirm the session ID and agent filter conditions. |
|
|
The server cannot query messages or generate message display data. Suggestion: Record the request time and error message and try again. |
|
|
Session service is temporarily unavailable. Suggestion: Try again later. |