GetConversationMessages
Performs a paging query to retrieve the message history of a specified session, including reply content, execution process blocks, and timelines, and optionally refreshes the status of analysis runs.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
odps:GetConversationMessages |
get |
*All Resource
|
None | None |
Request syntax
GET /api/v1/ai/conversations/{conversationId}/messages HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| conversationId |
string |
No |
The conversation ID. |
123456789012****#cn-shanghai#1ee04bea-0488-46b6-b85b-827e3cd37e55 |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| maxResults |
integer |
No |
The maximum number of messages to return in this request. Valid values: 1 to 200. Default value: 50. |
50 |
| nextToken |
string |
No |
The pagination token. Leave this parameter empty for the first query. For subsequent queries, pass the nextToken value returned in the previous response. An empty nextToken value in the response indicates that no more data is available. |
eyJvZmZzZXQiOjUwfQ== |
| refreshRuns |
boolean |
No |
Specifies whether to refresh the latest status of analysis runs in the conversation before reading the history. Valid values:
|
Response elements
|
Element |
Type |
Description |
Example |
|
object |
PopResult |
||
| requestId |
string |
The request ID, which uniquely identifies the request and can be used for troubleshooting and log correlation. |
A3F5B7C9-1D2E-4F6A-8B9C-0D1E2F3A4B5C |
| httpCode |
integer |
The business status code. This field is not returned if the call is successful. If the call fails, the corresponding HTTP error code is returned, such as 400, 403, 404, or 500. |
400 |
| errorCode |
string |
The error code. This field is not returned if the call is successful. If the call fails, a specific error code is returned to help identify the cause of the error. |
InvalidParameter |
| errorMsg |
string |
The error message. This field is not returned if the call is successful. If the call fails, a human-readable error description is returned. |
The specified parameter is invalid. |
| data |
object |
The conversation message history and pagination information. |
|
| runRefresh |
object |
The refresh result of the analysis runs for the current read operation. This field is returned only when the refreshRuns request parameter is set to true. It indicates the freshness of the refresh for the current read operation and does not represent the execution result of the analysis job itself. |
|
| status |
string |
The refresh status. Valid values:
|
refreshed |
| refreshedRunIds |
array |
The list of IDs for successfully refreshed runs. A maximum of five IDs are returned. |
|
|
string |
The ID of the refreshed analysis run. |
9f8e7d6c5b4a39281706f5e4d3c2b1a0 |
|
| unconfirmedRunIds |
array |
The list of IDs for runs whose latest status could not be confirmed. A maximum of five IDs are returned. |
|
|
string |
The ID of the unconfirmed analysis run. |
9f8e7d6c5b4a39281706f5e4d3c2b1a0 |
|
| status |
string |
The current status of the conversation. Valid values:
|
idle |
| messages |
array<object> |
The list of messages, sorted by creation time. |
|
|
array<object> |
|||
| id |
string |
The message ID. |
msg_assistant_0123456789abcdef0123456789abcdef |
| role |
string |
The role of the message sender. Valid values:
|
assistant |
| content |
string |
The text content of the message. |
The analysis of sales trends over the past 30 days is complete. See the chart below for the results |
| status |
string |
The message status. Valid values:
|
completed |
| turnId |
string |
The ID of the turn to which the message belongs. Messages generated from the same request share the same turn ID. |
9f8e7d6c5b4a39281706f5e4d3c2b1a0 |
| answerPresentation |
object |
The presentation snapshot of the final reply, which includes segmented content and reference information used to render the final answer. |
{"version":1,"answerId":"answer:9f8e7d6c5b4a39281706f5e4d3c2b1a0","revision":1,"status":"completed","segments":[{"id":"answer:9f8e7d6c5b4a39281706f5e4d3c2b1a0:0","type":"markdown","text":"The analysis of sales trends over the past 30 days is as follows.\n\n"},{"id":"answer:9f8e7d6c5b4a39281706f5e4d3c2b1a0:1","type":"artifact_ref","state":"resolved","title":"Sales Trend Analysis Report for the Past 30 Days","artifactId":"01J5ZKQ8M7N2P4R6T8V0W2X4Y6","blockId":"report_0123456789abcdef0123456789abcdef","sha256":"a1b2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcdef0"}]} |
| workflowResult |
object |
The workflow stage result associated with the current message. The workflowId field identifies the workflow, and the stage field identifies the stage. The remaining fields are determined by the workflow and stage. For example, during the planning stage of text deduplication, the collected configurations and the parameters that still need to be provided are returned. |
{"workflowId":"text-dedup","stage":"plan","plan":{"project":"demo_project","schema":"default","mode":"training"},"missing":["table","id","text"]} |
| workflowResultVersion |
integer |
The data format version of the workflow result, which is used to parse the workflowResult field. The current version is 1. |
1 |
| commandSelection |
object |
The task command and display status selected by the server for the current turn, which is used to restore the task entry point during history playback. |
|
| commandId |
string |
The ID of the selected preset command. This field is not returned if no command is selected. |
task.analyze |
| skillName |
string |
The name of the skill associated with the command. |
sales-analysis |
| domainId |
string |
The ID of the business domain associated with the command. |
domain-sales |
| workflowId |
string |
The ID of the Solutions workflow associated with the command. |
wf-sales-review |
| analysisMode |
string |
The analysis mode for the current turn. Valid values:
|
standard |
| status |
string |
The command selection status. Valid values:
|
activated |
| turnId |
string |
The ID of the turn to which the command selection belongs. |
9f8e7d6c5b4a39281706f5e4d3c2b1a0 |
| workflowDraft |
object |
The workflow plan draft saved for the current conversation turn. The plan field contains the collected configurations, the missing field lists the parameters that still need to be provided, and the planVersion field identifies the saved plan version. |
{"workflowId":"text-dedup","stage":"plan","plan":{"project":"demo_project","schema":"default","mode":"training"},"missing":["table","id","text"],"planVersion":"pv-example"} |
| workflowExecution |
object |
The workflow execution information for the current conversation turn. The executionId field identifies the current execution, the planVersion field associates the plan used, the action field indicates the executed operation, and the status field indicates whether the execution is accepted, started, or succeeded. |
{"executionId":"run-0123456789abcdef0123456789abcdef","planVersion":"pv-example","action":"sample","status":"started"} |
| blocks |
array<object> |
The list of structured content blocks for the message, which carry the reasoning process, execution progress, pending confirmation operations, and analysis artifacts. |
|
|
array<object> |
|||
| id |
string |
The content block ID. |
progress_0123456789abcdef0123456789abcdef |
| role |
string |
The role of the message to which the content block belongs, such as assistant. |
assistant |
| type |
string |
The content block type. Valid values:
|
progress |
| title |
string |
The title of the content block. |
Execute SQL query |
| content |
string |
The text content of the content block. |
Executing SQL query.. |
| data |
object |
The structured data of the content block, which varies depending on the type. For example, a progress block contains tool references, input and output, and execution duration, while an action block contains the details of the pending confirmation operation. |
{"tool":{"name":"sql_execute","label":"SQL Execute","callId":"call_9f8e7d6c5b4a39281706f5e4d3c2b1a0"},"input":{"sql":"SELECT ds, SUM(amount) AS total FROM sales WHERE ds >= '20260801' GROUP BY ds ORDER BY ds;"},"output":{"kind":"json","value":{"rowCount":30},"truncated":false},"timing":{"startedAt":1756284818000,"finishedAt":1756284825000,"durationMs":7000}} |
| status |
string |
The content block status. Valid values:
|
completed |
| source |
object |
The source information of the content block, which may include the SQL statement used to generate the block, the associated tables, and the project name. |
{"projectName":"odps_project","sql":"SELECT ds, SUM(amount) AS total FROM sales WHERE ds >= '20260801' GROUP BY ds ORDER BY ds;","executionId":"20260827085338123abcdefg","tables":["odps_project.sales"],"generatedAt":1756284818} |
| timeline |
array<object> |
The list of message timeline entries, which record text snippets and content block references in chronological order to restore the complete display of the message. |
|
|
object |
A single entry in the message timeline, sorted in chronological order. When type is text, it is a text snippet and contains the text field. When type is block, it is a content block reference and contains the blockId (content block ID), blockType (content block type), and title (content block title) fields. |
{"type":"block","blockId":"report_0123456789abcdef0123456789abcdef","blockType":"report","title":"Sales Trend Analysis Report for the Past 30 Days"} |
|
| createdAt |
string |
The time when the message was created. The time is displayed in UTC and follows the RFC 3339 format, such as 2026-08-27T08:53:38.000Z. |
2026-08-27T08:53:38.000Z |
| projectName |
string |
The name of the MaxCompute project associated with the message. This field is an empty string if no project is associated. |
odps_project |
| nextToken |
string |
The pagination token for the next page. An empty string indicates that no more data is available. |
eyJvZmZzZXQiOjUwfQ== |
| maxResults |
integer |
The maximum number of entries to return for the current request. |
50 |
Examples
Success response
JSON format
{
"requestId": "A3F5B7C9-1D2E-4F6A-8B9C-0D1E2F3A4B5C",
"httpCode": 400,
"errorCode": "InvalidParameter",
"errorMsg": "The specified parameter is invalid.",
"data": {
"runRefresh": {
"status": "refreshed",
"refreshedRunIds": [
"9f8e7d6c5b4a39281706f5e4d3c2b1a0"
],
"unconfirmedRunIds": [
"9f8e7d6c5b4a39281706f5e4d3c2b1a0"
]
},
"status": "idle",
"messages": [
{
"id": "msg_assistant_0123456789abcdef0123456789abcdef",
"role": "assistant",
"content": "The analysis of sales trends over the past 30 days is complete. See the chart below for the results",
"status": "completed",
"turnId": "9f8e7d6c5b4a39281706f5e4d3c2b1a0",
"answerPresentation": {
"version": 1,
"answerId": "answer:9f8e7d6c5b4a39281706f5e4d3c2b1a0",
"revision": 1,
"status": "completed",
"segments": [
{
"id": "answer:9f8e7d6c5b4a39281706f5e4d3c2b1a0:0",
"type": "markdown",
"text": "The analysis of sales trends over the past 30 days is as follows.\n\n"
},
{
"id": "answer:9f8e7d6c5b4a39281706f5e4d3c2b1a0:1",
"type": "artifact_ref",
"state": "resolved",
"title": "Sales Trend Analysis Report for the Past 30 Days",
"artifactId": "01J5ZKQ8M7N2P4R6T8V0W2X4Y6",
"blockId": "report_0123456789abcdef0123456789abcdef",
"sha256": "a1b2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcdef0"
}
]
},
"workflowResult": {
"workflowId": "text-dedup",
"stage": "plan",
"plan": {
"project": "demo_project",
"schema": "default",
"mode": "training"
},
"missing": [
"table",
"id",
"text"
]
},
"workflowResultVersion": 1,
"commandSelection": {
"commandId": "task.analyze",
"skillName": "sales-analysis",
"domainId": "domain-sales",
"workflowId": "wf-sales-review",
"analysisMode": "standard",
"status": "activated",
"turnId": "9f8e7d6c5b4a39281706f5e4d3c2b1a0",
"workflowDraft": {
"workflowId": "text-dedup",
"stage": "plan",
"plan": {
"project": "demo_project",
"schema": "default",
"mode": "training"
},
"missing": [
"table",
"id",
"text"
],
"planVersion": "pv-example"
},
"workflowExecution": {
"executionId": "run-0123456789abcdef0123456789abcdef",
"planVersion": "pv-example",
"action": "sample",
"status": "started"
}
},
"blocks": [
{
"id": "progress_0123456789abcdef0123456789abcdef",
"role": "assistant",
"type": "progress",
"title": "Execute SQL query",
"content": "Executing SQL query..",
"data": {
"tool": {
"name": "sql_execute",
"label": "SQL Execute",
"callId": "call_9f8e7d6c5b4a39281706f5e4d3c2b1a0"
},
"input": {
"sql": "SELECT ds, SUM(amount) AS total FROM sales WHERE ds >= '20260801' GROUP BY ds ORDER BY ds;"
},
"output": {
"kind": "json",
"value": {
"rowCount": 30
},
"truncated": false
},
"timing": {
"startedAt": 1756284818000,
"finishedAt": 1756284825000,
"durationMs": 7000
}
},
"status": "completed",
"source": {
"projectName": "odps_project",
"sql": "SELECT ds, SUM(amount) AS total FROM sales WHERE ds >= '20260801' GROUP BY ds ORDER BY ds;",
"executionId": "20260827085338123abcdefg",
"tables": [
"odps_project.sales"
],
"generatedAt": 1756284818
}
}
],
"timeline": [
{
"type": "block",
"blockId": "report_0123456789abcdef0123456789abcdef",
"blockType": "report",
"title": "Sales Trend Analysis Report for the Past 30 Days"
}
],
"createdAt": "2026-08-27T08:53:38.000Z",
"projectName": "odps_project"
}
],
"nextToken": "eyJvZmZzZXQiOjUwfQ==",
"maxResults": 50
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.