Call requirements, permissions, request fields, response fields, and error handling.
Request and permissions
GET https://openapi.qwenwork.ai/v1/session/sessions/{session_id}/turns/{turn_id}
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:
Returns a single turn, including fields omitted from list rows:
final_messageis the full text, without truncation.itemslists what the agent presented during this turn, discriminated bytype:file—a file the agent explicitly presented to the user as part of its response, not every file it wrote.altis the agent's own description, usable directly as a caption.pathis a storage path, not a URL; exchange it for a download link when you need the bytes.web_app—a Web application started by the agent.document_review—a reviewed document, includingverdictandfindings.
GET /sessions/{session_id}/output.
For web_app, published_url is a persistent address. live_preview: true means a live view may exist while the runtime is alive. Its address is returned in the live section of GET /sessions/{session_id}/output, not embedded here.
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 |
turn_id | string | Yes | Turn id, for example one obtained from GET /sessions/{session_id}/turns. Turn id, for example one obtained from GET /sessions/{session_id}/turns. Format: "uuid" |
Query parameters
| Parameter | Type | Required | Description and constraints |
|---|---|---|---|
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" |
channel | string | null | No | Source of this turn initiating prompt; null for unattributed historical turns. |
ended_at | string | null | Yes | When the turn ended, or null while still running. ISO 8601. |
error | object | null | Yes | Structured failure details. null unless status is failed. |
error | object | Yes | At least one of: branch 1 Additional fields: false |
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. |
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. |
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. |
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. |
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. |
error | null | Yes | At least one of: branch 2 — |
final_message | string | null | Yes | The agent's closing text, complete and untruncated. 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. |
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 | array | Yes | Items the agent presented during this turn. An empty array when nothing was presented. Files written to the output directory are listed by GET /sessions/{id}/output. If output_count in the turn list is not 0 but this array is empty, the read is incomplete and can be retried. |
items[] | object | No | — |
items[] | object | No | Exactly one of: branch 1 Present when type is "file". Additional fields: false |
items[].created_at | string | Yes | Exactly one of: branch 1 When this item was produced. ISO 8601, with microseconds and timezone. |
items[].file | object | Yes | Exactly one of: branch 1 Additional fields: false |
items[].file.alt | string | No | Exactly one of: branch 1 The agent's description of this file. Suitable as a caption or alt text. |
items[].file.barn_id | string | No | Exactly one of: branch 1 Storage id; exchange it for a download URL. |
items[].file.mime_type | string | No | Exactly one of: branch 1 Content type, for example application/pdf. |
items[].file.path | string | Yes | Exactly one of: branch 1 Storage path, not a URL. Exchange it for a download link when you need the file content; presigned URLs expire, so they are issued on demand rather than listed here. |
items[].file.size | integer | No | Exactly one of: branch 1 Size in bytes. Format: "int64" |
items[].tool_call_id | string | No | Exactly one of: branch 1 The tool call that produced this item. Correlate it with tool_call / tool_call_update events in the event stream. |
items[].type | string | Yes | Exactly one of: branch 1 Item type, determining which other fields exist. Open enum; skip unrecognized types rather than raising an error. Allowed values: ["file"] |
items[] | object | No | Exactly one of: branch 2 Present when type is "web_app". Additional fields: false |
items[].created_at | string | Yes | Exactly one of: branch 2 When this item was produced. ISO 8601, with microseconds and timezone. |
items[].tool_call_id | string | No | Exactly one of: branch 2 The tool call that produced this item. Correlate it with tool_call / tool_call_update events in the event stream. |
items[].type | string | Yes | Exactly one of: branch 2 Item type, determining which other fields exist. Open enum; skip unrecognized types rather than raising an error. Allowed values: ["web_app"] |
items[].web_app | object | Yes | Exactly one of: branch 2 Additional fields: false |
items[].web_app.live_preview | boolean | No | Exactly one of: branch 2 true means this turn provided a page that may still be viewable live. This is a flag, not a URL: addresses are short-lived, so the live section of GET /sessions/{id}/output issues them on demand. |
items[].web_app.published_url | string | No | Exactly one of: branch 2 A persistent address, present only if the page was actually published. Safe to store and share—unlike live previews, it outlives the runtime. |
items[].web_app.source_dir | string | No | Exactly one of: branch 2 The application's directory in this session's workspace. |
items[].web_app.static | boolean | No | Exactly one of: branch 2 true for a static site; false when a running server is required. Static sites can be published persistently; dynamic applications exist only while the runtime is alive. |
items[] | object | No | Exactly one of: branch 3 Present when type is "document_review". Additional fields: false |
items[].created_at | string | Yes | Exactly one of: branch 3 When this item was produced. ISO 8601, with microseconds and timezone. |
items[].document_review | object | Yes | Exactly one of: branch 3 Additional fields: false |
items[].document_review.findings | array | No | Exactly one of: branch 3 Issues found; present when verdict is "failed". |
items[].document_review.findings[] | string | No | Exactly one of: branch 3 — |
items[].document_review.path | string | No | Exactly one of: branch 3 Workspace path of the reviewed document. A turn may review multiple documents, so use this to associate verdict and findings with the specific file. |
items[].document_review.verdict | string | Yes | Exactly one of: branch 3 "passed" or "failed". |
items[].tool_call_id | string | No | Exactly one of: branch 3 The tool call that produced this item. Correlate it with tool_call / tool_call_update events in the event stream. |
items[].type | string | Yes | Exactly one of: branch 3 Item type, determining which other fields exist. Open enum; skip unrecognized types rather than raising an error. Allowed values: ["document_review"] |
items[] | object | No | Exactly one of: branch 4 Item types added after this document was written. Only the fields common to all items are guaranteed. Skip them rather than raising an error. |
items[].created_at | string | Yes | Exactly one of: branch 4 When this item was produced. ISO 8601, with microseconds and timezone. |
items[].tool_call_id | string | No | Exactly one of: branch 4 The tool call that produced this item. Correlate it with tool_call / tool_call_update events in the event stream. |
items[].type | string | Yes | Exactly one of: branch 4 Item type, determining which other fields exist. Open enum; skip unrecognized types rather than raising an error. |
meta | object | No | Public metadata of the initiating prompt, when recorded. Additional fields: false |
meta.pa_str | string | No | — |
pending_action | object | null | Yes | The question blocking this turn, or null if none. Non-null if and only if status is action_required. |
pending_action | object | Yes | At least one of: branch 1 Additional fields: false |
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. |
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. |
pending_action.questions[] | object | No | At least one of: branch 1 Additional fields: false |
pending_action.questions[].header | string | No | At least one of: branch 1 Optional short label for the question, suitable as a heading above it. |
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. |
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. |
pending_action.questions[].options[] | object | No | At least one of: branch 1 Additional fields: false |
pending_action.questions[].options[].description | string | No | At least one of: branch 1 Optional additional explanation of what selecting this option means. |
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. |
pending_action.questions[].question | string | Yes | At least one of: branch 1 Question text to display. |
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. |
pending_action | null | Yes | At least one of: branch 2 — |
session_id | string | Yes | The session this turn belongs to. |
started_at | string | Yes | When the turn started. ISO 8601, with microseconds and timezone. |
status | string | Yes | How this turn ended, or whether it has not ended yet. Read this field, not stop_reason, to determine successful versus abnormal termination. |
stop_reason | string | null | Yes | The agent's stop reason, for example end_turn. null while the turn is executing or if it ended before reporting. Abnormal termination also reports end_turn, so use status to determine success. |
turn_id | string | Yes | This turn's id. |
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