ListChatMessages

Updated at:

Retrieves the message history and temporary download URLs for the pipeline snapshot of a specified session by session ID.

Operation description

Request description

  • When calling the V2 service, set the AgentVersion parameter to V2.

  • This operation only accepts the SessionId of the current user's session. It does not directly return a message array, but returns presigned download URLs for session.jsonl and a2a-snapshot.json.

  • The download URLs are valid for 1,800 seconds (30 minutes). Complete the download within the validity period.

  • The URLs in the response contain signature parameters. Do not log, share, or cache them for a long time.

  • MaxResults and NextToken are compatibility fields and are not consumed in V2.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ros:ListChatMessages

list

*All Resource

*

None None

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

SessionId

string

Yes

The ID of the session to query. You can only query sessions owned by the current user. You can call ListChatSessions to obtain an existing session ID, or call StartChat to create a new session and obtain the session ID.

7f4e2a8c6d9b4a1f8e3c5b7d2a6f9012

MaxResults

integer

No

The compatibility field. V2 does not return message arrays in pages, and the service does not consume this field.

20

NextToken

string

No

The compatibility field. V2 does not return message arrays in pages, and the service does not consume this field.

CAES...

AgentVersion

string

No

Set this parameter to V2 to route the request to the ROS Agent V2 backend.

V2

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The ID of the request.

4C68F7A5-2D16-5C8F-A4B1-01E9C6A9B0D2

Messages

array<object>

The compatibility field. The V2 response does not return a message array.

[]

object

The compatibility field. V2 does not return message objects.

{}

NextToken

string

The compatibility field. The V2 response does not return NextToken.

CAES...

MaxResults

integer

The compatibility field. The V2 response does not return MaxResults.

20

SessionMessagesDownloadUrl

string

The presigned download URL for the session messages in session.jsonl. The URL is valid for 1,800 seconds.

https://oss.example/session.jsonl?signature=REDACTED

PipelineSnapshotDownloadUrl

string

The presigned download URL for the pipeline snapshot in a2a-snapshot.json. The URL is valid for 1,800 seconds.

https://oss.example/a2a-snapshot.json?signature=REDACTED

Title

string

The title of the session. This field may be empty.

Create VPC template

PipelineName

string

The name of the pipeline. Valid values: EvaluationFirstSelling and SolutionFirstSelling.

SolutionFirstSelling

WorkspaceTemplates

array<object>

The list of ROS templates in the session workspace. This field is returned only for the solution-first workflow. If no published templates exist, this field is not returned or an empty array is returned.

object

The path, availability status, and temporary download URL of a single ROS template.

TemplatePath

string

The relative path of the template in the session workspace. The .yml, .yaml, and .json formats are supported.

templates/0-vpc.yml

Status

string

The downloadable status of the template. Valid values:

  • available: The template is ready and can be downloaded. The DownloadUrl is also returned.

  • not_ready: The template path is determined, but the file is not ready. Try again later.

  • unavailable: The template cannot be downloaded. For example, the file is too large or the temporary download URL fails to be generated.

available

DownloadUrl

string

The temporary download URL of the template file. This field is returned only when Status is available. The URL is valid for 300 seconds. After the URL expires, you must call the operation again to obtain a new URL.

https://example.com/templates/0-vpc.yml?expires=300

HistoryReadiness

string

The readiness status of session history messages. History can be loaded only when the status is READY. History cannot be loaded when the status is STARTING, RUNNING, STOPPING, FINALIZING (processing), NOT_READY (not ready), RECOVERY_REQUIRED (recovery required), or UNKNOWN (unknown).

READY

Workspace

object

The session workspace data.

{}

Examples

Success response

JSON format

{
  "RequestId": "4C68F7A5-2D16-5C8F-A4B1-01E9C6A9B0D2",
  "Messages": [
    {}
  ],
  "NextToken": "CAES...",
  "MaxResults": 20,
  "SessionMessagesDownloadUrl": "https://oss.example/session.jsonl?signature=REDACTED",
  "PipelineSnapshotDownloadUrl": "https://oss.example/a2a-snapshot.json?signature=REDACTED",
  "Title": "Create VPC template",
  "PipelineName": "SolutionFirstSelling",
  "WorkspaceTemplates": [
    {
      "TemplatePath": "templates/0-vpc.yml",
      "Status": "available",
      "DownloadUrl": "https://example.com/templates/0-vpc.yml?expires=300"
    }
  ],
  "HistoryReadiness": "READY",
  "Workspace": {}
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.