Call requirements, permissions, request fields, response fields, and error handling.
Request and permissions
GET https://openapi.qwenwork.ai/v1/session/sessions/{session_id}/turns
Authentication: Authorization: Bearer <access_token>; use an access token obtained through user OAuth authorization.
Required business Scope: session.session.read
Authorization methods declared by the contract: Organization authorization (organization), personal authorization (personal)
The platform must enable the Scope for the application. The user must have the corresponding business permissions, and the target resource must be within their accessible scope. Whether personal or organization authorization is available to the application depends on the actual console configuration.
Behavior and limitations
Omitting session_type selects a cloud session. Every remote-control request must use session_type=remote and provide a nonempty device_id. Providing device_id for a cloud session, an empty or unknown type, or duplicate target parameters returns 422 VALIDATION_ERROR. Cross-device aggregated lists and automatic fallback to cloud are not provided. Both types use the same authentication chain; the open platform validates the corresponding Scope declared by each endpoint.
Cloud sessions:
One entry per turn, newest first. A turn appears here after execution starts; prompts still waiting appear in GET /sessions/{session_id}/prompt-queue.
Turn status
status | Meaning |
|---|---|
running | Executing |
action_required | Executing, waiting for an answer—see pending_action |
completed | The agent finished normally on its own |
interrupted | Ended by something outside the agent—see interrupt_reason |
failed | Unsuccessful—see stop_reason and error |
ended_at is null if and only if status is running or action_required.
pending_action is non-null if and only if status is action_required. It contains the question and the tool_call_id needed to answer via POST /sessions/{session_id}/question-response. Answering returns the turn to running rather than ending it; the agent continues and reports its conclusion later.
cancelled is deprecated and no longer emitted. It covered both caller cancellation and runtime failure; these are now distinguished by interrupted plus interrupt_reason.
Retryability
status alone is insufficient: whether an interrupted turn is worth retrying depends on what interrupted it. interrupt_reason distinguishes these cases:
interrupt_reason | Reason | Retryable |
|---|---|---|
user_requested | The caller cancelled the turn | No |
runtime_restarted | The turn lost contact with its runtime, or its conclusion could not be delivered | Yes |
runtime_unavailable | The runtime became unavailable | Yes, after a delay |
session_ended | The session ended while this turn was executing | No |
action_required_timeout | The pending question remained unanswered | Yes, also provide an answer |
failed, distinguish by stop_reason: refusal, max_tokens, and max_turn_requests are properties of the prompt itself, so retrying unchanged yields the same result. Other values can be retried after a delay.
For upstream failures, error.category and error.remedy describe the required action. retry and retry_after_backoff mean the same request can be resent; other remedies require a change first. new_session means the problem affects every subsequent turn in this session.
stop_reason alone does not indicate success: abnormal termination also reports end_turn. Use status.
final_message in this response is truncated to 50000 characters; final_message_truncated indicates whether truncation occurred. Obtain the full text from GET /sessions/{session_id}/turns/{turn_id}.
Remote-control sessions: This operation returns 422 OPERATION_NOT_SUPPORTED without contacting the target device.
Call through the open platform, retaining the existing oauth_app Token, identity resolution, application IP restrictions, and resource ownership checks. Cloud and remote-control parameters retain their actual contract semantics.
Short paths such as /sessions in this page are relative to the common prefix /v1/session. Use the full path at the top of this page for actual requests.
Supported session types: cloud
In the full JSON, x-session-variants preserves the parameters, request bodies, and responses for cloud and remote-control sessions separately. Do not mix fields from the two branches.
Path parameters
| Parameter | Type | Required | Description and constraints |
|---|---|---|---|
session_id | string | Yes | Session identifier: a UUID for cloud sessions; an opaque identifier on the selected device for remote-control sessions. Minimum length: 1 Maximum length: 256 |
Query parameters
| Parameter | Type | Required | Description and constraints |
|---|---|---|---|
cursor | integer | No | Opaque pagination cursor; omit for the first page. Opaque pagination cursor; omit for the first page. Format: "int64" Minimum (inclusive): 0 |
limit | integer | No | Number of entries per page. Number of entries per page. Default: 20 Format: "int64" Minimum (inclusive): 1 Maximum (inclusive): 100 |
session_type | string | No | Omitting session_type selects a cloud session. Every remote-control request must use session_type=remote and provide a nonempty device_id. Providing device_id for a cloud session, an empty or unknown type, or duplicate target parameters returns 422 VALIDATION_ERROR. Cross-device aggregated lists and automatic fallback to cloud are not provided. Both types use the same authentication chain; the open platform validates the corresponding Scope declared by each endpoint. Default: "cloud" Allowed values: ["cloud", "remote"] |
device_id | string | No | Required only for remote control. An opaque target device identifier from device discovery; it must be URL-encoded. The target connection must be signed in to the currently authenticated account. Minimum length: 1 Maximum length: 256 |
Request body
The public contract declares no request body. Do not add identity fields or undeclared business fields.
Successful responses
Preserve the original response structure of each business endpoint; do not add a common code/msg/data wrapper.
HTTP 200
Success
Response type: application/json
| Field | Type | Required | Description and constraints |
|---|---|---|---|
$schema | string | No | URL of the JSON Schema for this object. Format: "uri" |
has_more | boolean | Yes | true means another page exists. Check this rather than inferring from a full page. |
items | array | Yes | One row per turn, newest first. An empty array, never null, when the session has no turns. |
items[] | object | No | Additional fields: false |
items[].channel | string | null | No | Source of this turn initiating prompt; null for unattributed historical turns. |
items[].ended_at | string | null | Yes | When the turn ended, or null while still running. ISO 8601. |
items[].error | object | null | Yes | Structured failure details. null unless status is failed. |
items[].error | object | Yes | At least one of: branch 1 Additional fields: false |
items[].error.category | string | No | At least one of: branch 1 Problem category: quota, auth, permission, rate_limit, model_unavailable, timeout, content_rejected, input_too_large, input_invalid, limit_reached, service_error, or unknown. Open enum. For classification and statistics; branch on remedy instead, because the same category can require different actions. Treat unrecognized values as unknown. |
items[].error.code | string | Yes | At least one of: branch 1 Machine-readable failure code. Open enum. Branch on known codes and handle the rest as generic failures. |
items[].error.message | string | Yes | At least one of: branch 1 Human-readable explanation for logs and operational displays. The wording is not part of the contract and may change. |
items[].error.remedy | string | No | At least one of: branch 1 Action required to resolve the error: retry, retry_after_backoff, switch_model, new_session, modify_input, reauthenticate, top_up_quota, contact_admin, refresh, or report. Open enum. Branch on this field. retry and retry_after_backoff mean the same request can be resent; all other values require a change first. new_session means the problem affects the entire session: create a new session instead of merely changing the prompt. Treat unrecognized values as requiring a change first. |
items[].error.trace_id | string | No | At least one of: branch 1 Server trace id, identical to the X-Request-Id response header. Include it when reporting a problem—we use it to locate the request. |
items[].error | null | Yes | At least one of: branch 2 — |
items[].final_message | string | null | Yes | The agent's closing text for this turn, truncated in the list view. null when the turn ends with a tool call that has no user-facing output. This is the last contiguous text segment, not the full response; assemble the full response from agent_message_chunk events. |
items[].final_message_truncated | boolean | Yes | true means final_message in this response was truncated. Obtain the full text from GET /sessions/{id}/turns/{turn_id}. |
items[].interrupt_reason | string | null | Yes | What ended this turn. Non-null only when status is interrupted. Values: "user_requested", "runtime_restarted", "runtime_unavailable", "session_ended", or "action_required_timeout". Open enum; treat unrecognized values as non-retryable. |
items[].meta | object | No | Public metadata of the initiating prompt, when recorded. Additional fields: false |
items[].meta.pa_str | string | No | — |
items[].output_count | integer | null | Yes | Number of output items from this turn. 0 means the turn's items array is empty. null means the count is unknown, not zero; read the turn details endpoint to obtain the list in that case. Format: "int64" |
items[].pending_action | object | null | Yes | The question blocking this turn, or null if none. Non-null if and only if status is action_required. Inlined in the list, not just the details, so identifying which entries need attention takes one request rather than N. Same shape as in GET /sessions/{id}. |
items[].pending_action | object | Yes | At least one of: branch 1 Additional fields: false |
items[].pending_action.asked_at | string | Yes | At least one of: branch 1 When the agent asked the question. ISO 8601, with microseconds and timezone. The turn has been consuming wall-clock time since then, so treat older values as urgent. |
items[].pending_action.questions | array | Yes | At least one of: branch 1 Questions to display, ready to render. Usually only one. Answer in the same order in the answers array. |
items[].pending_action.questions[] | object | No | At least one of: branch 1 Additional fields: false |
items[].pending_action.questions[].header | string | No | At least one of: branch 1 Optional short label for the question, suitable as a heading above it. |
items[].pending_action.questions[].multi_select | boolean | Yes | At least one of: branch 1 true means the agent requests multiple selections. ⚠️ The answer field accepts only one string per question, so multiple selections are written as text in that entry for the agent to interpret, not parsed—see updated_input.answers in POST /question-response. When false, return exactly one label. |
items[].pending_action.questions[].options | array | No | At least one of: branch 1 List of options. When empty, this is a free-text question and any text is a valid answer. |
items[].pending_action.questions[].options[] | object | No | At least one of: branch 1 Additional fields: false |
items[].pending_action.questions[].options[].description | string | No | At least one of: branch 1 Optional additional explanation of what selecting this option means. |
items[].pending_action.questions[].options[].label | string | Yes | At least one of: branch 1 Return this string unchanged when answering. It identifies the option; it is not just display text. |
items[].pending_action.questions[].question | string | Yes | At least one of: branch 1 Question text to display. |
items[].pending_action.tool_call_id | string | Yes | At least one of: branch 1 Return this as tool_call_id in POST /sessions/{id}/question-response. It associates the answer with the question asked. |
items[].pending_action | null | Yes | At least one of: branch 2 — |
items[].started_at | string | Yes | When the turn started. ISO 8601, with microseconds and timezone. |
items[].status | string | Yes | How this turn ended, or whether it has not ended yet. See the TurnStatus schema—use this field, not stop_reason, to distinguish successful from abnormal termination. |
items[].stop_reason | string | null | Yes | The agent's stop reason, for example end_turn or max_tokens. null while executing or if the turn ended before reporting. This value does not indicate success: abnormal termination also reports end_turn. Use status. |
items[].turn_id | string | Yes | This turn's id. Pass to GET /sessions/{id}/turns/{turn_id} for the full version, including untruncated text and output items. |
next_cursor | integer | Yes | Pass back as ?cursor= to get the next page. 0 when there is no next page. Format: "int64" |
Error responses
| HTTP | Description and handling |
|---|---|
default | Error. Branch on code, not just the HTTP status code—multiple conditions can share the same status code. |
Full field contract
The JSON below contains the complete request, response, and error schemas, nested constraints, and public extension definitions for this endpoint. Copy it for verification. Success examples not declared in the contract are not inferred.
Full OpenAPI JSON
Full OpenAPI JSON