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.

HTTP
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

Shell
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

workspace_id

string

Yes

The current workspace ID must be consistent with X-Workspace-ID.

conversation_id

string

Yes

The session ID to view messages.

Query parameters

Field

Type

Required

Description

agent_id

string

No

View only sessions belonging to the specified agent. If not provided, filtering by agent ID is not performed.

agent_workspace_id

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.

role

string

No

Filter by message role.

limit

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.

offset

integer

No

Returns the offset. 0 when not provided or less than 0.

Successful response

JSON
{
  "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

code

integer

0 on success.

data.items

array

List of messages on this page.

data.total

integer

The total number of messages matching the filter criteria.

data.limit

integer

The upper limit of return quantity actually adopted this time.

data.offset

integer

The actual offset used this time.

data.items[].id

string

Message ID.

data.items[].workspace_id

string

The workspace ID to which the message belongs.

data.items[].conversation_id

string

The session ID to which the message belongs.

data.items[].task_id

string

Associated task ID. Does not return when there are no associated tasks.

data.items[].agent_id

string

Associated agent ID. It will not be returned when there is no associated agent.

data.items[].manifest_id

string

Associated runtime manifest ID. Does not return if there is no associated list.

data.items[].role

string

Message role.

data.items[].parts

array

Message content segmentation.

data.items[].parts[]

object

A message content segment. The fields are determined by the message segment type.

data.items[].parent_message_id

string

Parent message ID. Does not return if there is no parent message.

data.items[].seq

integer

Message sequence number within the session.

data.items[].created_at

string

Message creation time, in RFC 3339 format.

Error response

JSON
{
  "code": 3,
  "message": "会话不存在"
}

Common HTTP errors

HTTP status code

error code

Description

400

2(INVALID_ARGUMENT)

The session ID, agent filter parameter, or paging parameter is invalid. Recommendation: Check the path and query parameters.

404

3(NOT_FOUND)

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.

500

1(INTERNAL)

The server cannot query messages or generate message display data. Suggestion: Record the request time and error message and try again.

503

15(UNAVAILABLE)

Session service is temporarily unavailable. Suggestion: Try again later.

Last updated on