Skip to main content

Read the session event stream

Call requirements, permissions, request fields, response fields, and error handling.

Request and permissions

GET https://openapi.qwenwork.ai/v1/session/sessions/{session_id}/events 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: Cursor-paginated event stream. Pass the returned next_cursor to the next call and persist it so you can resume from the saved cursor after a restart rather than replaying from the beginning. seq_id is a 64-bit integer that increases monotonically within a session. Process events in seq_id order. A malformed cursor returns 422 rather than starting over. Events are already assembled: an agent message arrives as one event with its full content; you do not need to reassemble fragments. type is always method, result, or error. Dispatch on the combination (type, method, sub_type); x-event-catalogue in the events schema lists each combination and its payload structure. Content safety. Safety checks apply to text already emitted, but retraction signals are not part of this event stream, so callers reading this endpoint cannot be notified of retractions. Text read here is not authorized for republication to end users. Stability of raw. Envelope fields change only with API versions. Event discriminators and their internal fields evolve only through additions. Fields under _meta have no compatibility guarantees. Remote-control sessions: Shares public gateway authentication with cloud sessions; this endpoint requires the business Scope stated below. No controller device ID or pairing is required. The target remote-control master switch must be enabled. If explicitly disabled, returns 403 FORBIDDEN with detail.reason=ACP_HOST_DISABLED; rejected write requests return detail.acceptance=not_accepted. An explicitly nonexistent session returns 404 NOT_FOUND with detail.reason=SESSION_NOT_FOUND. Commands route only to target connections signed in to the currently authenticated account. Offline targets, unknown targets, and targets belonging to other accounts all return device unavailable. Unknown request body fields are rejected. Reads desktop history, not a cloud archive. An offline device returns an error, not an empty page. next_cursor can resume history or SSE, including when has_more=false. Cursors are bound to the account, device, session, and event stream. Event stream changes or unrecoverable history gaps return explicit errors. A cursor ahead of the current end returns 422 VALIDATION_ERROR; a cursor at the current end returns an empty page. Aggregate text by id, deduplicate by sequence number, append raw fragments, and replace them with assembled multi-sequence text. 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, remote 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

ParameterTypeRequiredDescription and constraints
session_idstringYesSession 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

ParameterTypeRequiredDescription and constraints
cursorstringNoResume position; omit or pass 0 to start from the beginning.

This endpoint and /events/stream share the same seq_id space, so cursors are interchangeable. The same rule applies: send the end of the first contiguous sequence range you hold, not the largest value observed; within a record, advance to the maximum seq_ids value, not seq_id.
Remote-control sessions: an opaque string cursor bound to the account, device, session, and event stream.
Pass unchanged as a string in HTTP parameters: a decimal sequence number for cloud sessions, an opaque cursor for remote control. The service validates it according to session type.
Maximum length: 8192
limitintegerNoPage size.
Cloud: default 100, range 1 to 500. Remote control: default 50, range 1 to 100.
Number of entries per page.
Format: "int64"
Minimum (inclusive): 1
Maximum (inclusive): 500
session_typestringNoOmitting 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_idstringNoRequired 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
FieldTypeRequiredDescription and constraints
$schemastringNoAt least one of: branch 1
URL of the JSON Schema for this object.
Format: "uri"
has_morebooleanYesAt least one of: branch 1
true means more events are already available; call again immediately without waiting. false means no more events are currently available.
itemsarrayYesAt least one of: branch 1
Events in ascending seq_id order. An empty array, never null, when no more events exist. An empty page is a normal response, not an error.
items[]objectNoAt least one of: branch 1
Additional fields: false
items[].created_atstringYesAt least one of: branch 1
When the event was recorded. ISO 8601, with microseconds and timezone. Sort by seq_id, not this value—database insertion order may differ from timestamp order.
items[].idstringYesAt least one of: branch 1
Unique id of this event.
items[].methodstring | nullYesAt least one of: branch 1
JSON-RPC method when type=method; null for result and error frames. Currently session/update or session/request_permission. This is an open set—tolerate unrecognized values.
items[].rawobjectYesAt least one of: branch 1
JSON-RPC 2.0 message, passed through verbatim. Payload locations: raw.params.update for session/update, raw.params for other methods, and raw.result for type=result. See x-event-catalogue in open-events-schema.json for the payload shape of each (type, method, sub_type) combination.

🔴 Do not read ids from here. raw contains the runtime's own identifiers—especially raw.params.sessionId, which is the agent runtime's session handle, not the same value as this API's session_id (observed: a UUID such as 9bf6533e-… in the envelope versus ses_f8dc… in raw). Use session_id / turn_id / seq_id on the envelope—every endpoint in this API recognizes only these identifiers.
Additional fields: "Constrained by Schema; see the full contract"
items[].seq_idintegerYesAt least one of: branch 1
Monotonically increasing sequence number within the session, also used as a pagination cursor. Persist the highest processed value and pass it back as ?cursor= to resume without gaps or duplicates.
Format: "int64"
items[].seq_idsarrayYesAt least one of: branch 1
Sequence numbers covered by this envelope, in ascending order. This is how to distinguish deltas from complete messages, which must be handled differently.

Group by id first, then within each group:

- len(seq_ids) == 1—streaming delta. Append its text to the existing content for that id.
- len(seq_ids) > 1—an assembled complete message covering those deltas. Replace all existing content for that id; do not append.

Why both exist: each streaming fragment arrives in an envelope with the same id. Once complete, the message is stored as one event containing the entire message text. History readers, or callers reconnecting mid-message, receive the whole message at once—appending it to existing fragments would duplicate content.

Observed example. Five live envelopes, id=e57bee1f, with seq_ids [26], [27], [28], [29], [30] and text fragments meaning "I will", "make a", "water-ink", "style", "five"—append. A later envelope with the same id, seq_ids=[26..38], contains the full text meaning "I will make a water-ink-style Gomoku game. First, build the overall structure."—replace.

Cursors: within one envelope, advance to the maximum value here, not seq_id (the smallest sequence number covered; resuming from it redelivers the message tail). Across envelopes, resume from the end of the first contiguous sequence range you hold, not the largest observed value. Missing numbers are normal and will never arrive—some events consume sequence numbers but are not published here. Gaps do not mean lost events, but resuming past a gap skips everything after it.
items[].seq_ids[]integerNoAt least one of: branch 1
Format: "int64"
items[].session_idstringYesAt least one of: branch 1
The session this event belongs to.
items[].sub_typestring | nullYesAt least one of: branch 1
Variant discriminator: the sessionUpdate value, or prompt_response on a result frame ending a turn. null when the method needs no further subdivision, such as session/request_permission. See x-event-catalogue in the events schema for all types. Open enum; tolerate unrecognized values.
items[].turn_idstring | nullYesAt least one of: branch 1
The turn this event belongs to. null for events outside a turn—session startup, idle state, and out-of-band publication genuinely belong to no turn.
items[].typestringYesAt least one of: branch 1
JSON-RPC frame type. Dispatch on (type, method, sub_type); see x-event-catalogue in the events schema.
Allowed values: ["method", "result", "error"]
next_cursorintegerYesAt least one of: branch 1
The largest seq_id on this page. Pass it back as ?cursor= on the next call and persist it to resume here after a restart. 0 when this page is empty; keep using the original cursor in that case.
Format: "int64"
$schemastringNoAt least one of: branch 2
URL of the JSON Schema for this object.
Format: "uri"
has_morebooleanYesAt least one of: branch 2
—
itemsarrayYesAt least one of: branch 2
—
items[]objectNoAt least one of: branch 2
Additional fields: false
items[].created_atstringYesAt least one of: branch 2
—
items[].idstringYesAt least one of: branch 2
—
items[].methodstring | nullYesAt least one of: branch 2
—
items[].rawobjectYesAt least one of: branch 2
JSON-RPC after the existing safe outbound projection, not executor logs.
Additional fields: "Constrained by Schema; see the full contract"
items[].seq_idintegerYesAt least one of: branch 2
The first covered sequence number in the current event stream. Use the opaque cursor to resume.
Format: "int64"
items[].seq_idsarrayYesAt least one of: branch 2
Set of covered sequence numbers. Deduplicate single-sequence text fragments by sequence number before appending; multi-sequence aggregated text replaces existing fragments with the same id.
items[].seq_ids[]integerNoAt least one of: branch 2
Format: "int64"
items[].session_idstringYesAt least one of: branch 2
—
items[].sub_typestring | nullYesAt least one of: branch 2
—
items[].turn_idstring | nullYesAt least one of: branch 2
—
items[].typestringYesAt least one of: branch 2
—
next_cursorstringYesAt least one of: branch 2
Resource-scoped cursor for the next history read or SSE subscription, even when has_more is false.

Error responses

HTTPDescription and handling
defaultError. Branch on code, not just the HTTP status code—multiple conditions can share the same status code.
Retain the request ID and error fields in the response for troubleshooting. A write operation may already have taken effect after a timeout or disconnection. Do not automatically retry merely because no successful response was received.

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.
{
  "components": {
    "schemas": {
      "SessionPublicErrorBody": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "description": "Stable machine-readable error code. Branch on it rather than the HTTP status code, because different conditions can share the same status. New codes may be added; treat unrecognized values as unexpected errors in that HTTP status class.",
            "examples": [
              "VALIDATION_ERROR"
            ],
            "type": "string"
          },
          "detail": {
            "description": "Structured context whose shape depends on code—for example, the fields rejected by validation. null when no additional information is available."
          },
          "message": {
            "description": "Human-readable explanation for logs and error displays. The wording is not part of the contract and may change without a version increment.",
            "examples": [
              "Request validation failed"
            ],
            "type": "string"
          },
          "trace_id": {
            "description": "W3C trace id for this request. Include it when reporting problems—it locates the request in platform logs. If the request carried no trace context, this is 32 zero characters.",
            "examples": [
              "00000000000000000000000000000000"
            ],
            "type": "string"
          }
        },
        "required": [
          "code",
          "message",
          "detail",
          "trace_id"
        ],
        "type": "object"
      },
      "SessionPublicEvent": {
        "additionalProperties": false,
        "properties": {
          "created_at": {
            "description": "When the event was recorded. ISO 8601, with microseconds and timezone. Sort by seq_id, not this value—database insertion order may differ from timestamp order.",
            "type": "string"
          },
          "id": {
            "description": "Unique id of this event.",
            "examples": [
              "evt_01J8XQ2ZK4M7"
            ],
            "type": "string"
          },
          "method": {
            "description": "JSON-RPC method when type=method; null for result and error frames. Currently session/update or session/request_permission. This is an open set—tolerate unrecognized values.",
            "examples": [
              "session/update"
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "raw": {
            "additionalProperties": {},
            "description": "JSON-RPC 2.0 message, passed through verbatim. Payload locations: raw.params.update for session/update, raw.params for other methods, and raw.result for type=result. See x-event-catalogue in open-events-schema.json for the payload shape of each (type, method, sub_type) combination.\n\n🔴 **Do not read ids from here.** raw contains the runtime's own identifiers—especially `raw.params.sessionId`, which is the agent runtime's session handle, **not the same value** as this API's `session_id` (observed: a UUID such as `9bf6533e-…` in the envelope versus `ses_f8dc…` in raw). Use `session_id` / `turn_id` / `seq_id` on the envelope—every endpoint in this API recognizes only these identifiers.",
            "type": "object"
          },
          "seq_id": {
            "description": "Monotonically increasing sequence number within the session, also used as a pagination cursor. Persist the highest processed value and pass it back as ?cursor= to resume without gaps or duplicates.",
            "examples": [
              42
            ],
            "format": "int64",
            "type": "integer"
          },
          "seq_ids": {
            "description": "Sequence numbers covered by this envelope, in ascending order. This is **how to distinguish deltas from complete messages**, which must be handled differently.\n\nGroup by id first, then within each group:\n\n- len(seq_ids) == 1—streaming **delta**. **Append** its text to the existing content for that id.\n- len(seq_ids) > 1—an **assembled complete message** covering those deltas. **Replace all** existing content for that id; **do not append**.\n\nWhy both exist: each streaming fragment arrives in an envelope with the same id. Once complete, the message is stored as **one** event containing the entire message text. History readers, or callers reconnecting mid-message, receive **the whole message at once**—appending it to existing fragments would duplicate content.\n\nObserved example. Five live envelopes, id=e57bee1f, with seq_ids [26], [27], [28], [29], [30] and text fragments meaning \"I will\", \"make a\", \"water-ink\", \"style\", \"five\"—append. A later envelope with the same id, seq_ids=[26..38], contains the full text meaning \"I will make a water-ink-style Gomoku game. First, build the overall structure.\"—replace.\n\nCursors: **within one envelope**, advance to the **maximum** value here, not seq_id (the **smallest** sequence number covered; resuming from it redelivers the message tail). **Across envelopes**, resume from **the end of the first contiguous sequence range you hold**, not the largest observed value. Missing numbers are **normal** and will never arrive—some events consume sequence numbers but are not published here. Gaps do not mean lost events, but resuming past a gap skips everything after it.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "session_id": {
            "description": "The session this event belongs to.",
            "examples": [
              "0b9f2c14-6d3a-4f18-9c27-8ae5d1b47f30"
            ],
            "type": "string"
          },
          "sub_type": {
            "description": "Variant discriminator: the sessionUpdate value, or prompt_response on a result frame ending a turn. null when the method needs no further subdivision, such as session/request_permission. See x-event-catalogue in the events schema for all types. Open enum; tolerate unrecognized values.",
            "examples": [
              "agent_message_chunk"
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "turn_id": {
            "description": "The turn this event belongs to. null for events outside a turn—session startup, idle state, and out-of-band publication genuinely belong to no turn.",
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "description": "JSON-RPC frame type. Dispatch on (type, method, sub_type); see x-event-catalogue in the events schema.",
            "enum": [
              "method",
              "result",
              "error"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "session_id",
          "seq_id",
          "seq_ids",
          "type",
          "method",
          "sub_type",
          "raw",
          "turn_id",
          "created_at"
        ],
        "type": "object"
      },
      "SessionPublicEventListResponse": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "URL of the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/EventListResponse.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "has_more": {
            "description": "true means more events are already available; call again immediately without waiting. false means no more events are currently available.",
            "type": "boolean"
          },
          "items": {
            "description": "Events in ascending seq_id order. An empty array, never null, when no more events exist. An empty page is a normal response, not an error.",
            "items": {
              "$ref": "#/components/schemas/SessionPublicEvent"
            },
            "type": "array"
          },
          "next_cursor": {
            "description": "The largest seq_id on this page. Pass it back as ?cursor= on the next call and persist it to resume here after a restart. 0 when this page is empty; keep using the original cursor in that case.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "SessionPublicRemoteEvent": {
        "additionalProperties": false,
        "properties": {
          "created_at": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "method": {
            "type": [
              "string",
              "null"
            ]
          },
          "raw": {
            "additionalProperties": {},
            "description": "JSON-RPC after the existing safe outbound projection, not executor logs.",
            "type": "object"
          },
          "seq_id": {
            "description": "The first covered sequence number in the current event stream. Use the opaque cursor to resume.",
            "format": "int64",
            "type": "integer"
          },
          "seq_ids": {
            "description": "Set of covered sequence numbers. Deduplicate single-sequence text fragments by sequence number before appending; multi-sequence aggregated text replaces existing fragments with the same id.",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "session_id": {
            "type": "string"
          },
          "sub_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "turn_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "session_id",
          "seq_id",
          "seq_ids",
          "type",
          "method",
          "sub_type",
          "raw",
          "turn_id",
          "created_at"
        ],
        "type": "object"
      },
      "SessionPublicRemoteEventList": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "URL of the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RemoteEventList.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/SessionPublicRemoteEvent"
            },
            "type": "array"
          },
          "next_cursor": {
            "description": "Resource-scoped cursor for the next history read or SSE subscription, even when has_more is false.",
            "type": "string"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "SessionRelayError": {
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "string"
          },
          "error_code": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "error_description",
          "error_code"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "OpenPlatformBearer": {
        "description": "Authorization: Bearer <access_token>; JSON Content-Type: application/json; charset=utf-8. The current CN Review temporarily allows access only for routing debugging.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/session/sessions/{session_id}/events": {
      "get": {
        "description": "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.\n\nCloud sessions:\nCursor-paginated event stream. Pass the returned `next_cursor` to the next call and persist it so you can resume from the saved cursor after a restart rather than replaying from the beginning.\n\n`seq_id` is a 64-bit integer that increases monotonically within a session. Process events in `seq_id` order.\n\nA malformed `cursor` returns 422 rather than starting over.\n\nEvents are already assembled: an agent message arrives as one event with its full content; you do not need to reassemble fragments.\n\n`type` is always `method`, `result`, or `error`. Dispatch on the combination `(type, method, sub_type)`; `x-event-catalogue` in the events schema lists each combination and its payload structure.\n\n**Content safety.** Safety checks apply to text already emitted, but retraction signals are not part of this event stream, so callers reading this endpoint cannot be notified of retractions. Text read here is not authorized for republication to end users.\n\n**Stability of `raw`.** Envelope fields change only with API versions. Event discriminators and their internal fields evolve only through additions. Fields under `_meta` have no compatibility guarantees.\n\nRemote-control sessions:\nShares public gateway authentication with cloud sessions; this endpoint requires the business Scope stated below. No controller device ID or pairing is required. The target remote-control master switch must be enabled. If explicitly disabled, returns 403 FORBIDDEN with detail.reason=ACP_HOST_DISABLED; rejected write requests return detail.acceptance=not_accepted. An explicitly nonexistent session returns 404 NOT_FOUND with detail.reason=SESSION_NOT_FOUND. Commands route only to target connections signed in to the currently authenticated account. Offline targets, unknown targets, and targets belonging to other accounts all return device unavailable. Unknown request body fields are rejected. Reads desktop history, not a cloud archive. An offline device returns an error, not an empty page. next_cursor can resume history or SSE, including when has_more=false. Cursors are bound to the account, device, session, and event stream. Event stream changes or unrecoverable history gaps return explicit errors. A cursor ahead of the current end returns 422 VALIDATION_ERROR; a cursor at the current end returns an empty page. Aggregate text by id, deduplicate by sequence number, append raw fragments, and replace them with assembled multi-sequence text.\nCall 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.",
        "operationId": "publishedList-events",
        "parameters": [
          {
            "description": "Session identifier: a UUID for cloud sessions; an opaque identifier on the selected device for remote-control sessions.",
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Resume position; omit or pass 0 to start from the beginning.\n\nThis endpoint and /events/stream **share the same seq_id space**, so cursors are interchangeable. The same rule applies: send **the end of the first contiguous sequence range you hold**, not the largest value observed; within a record, advance to the maximum `seq_ids` value, not `seq_id`.\nRemote-control sessions: an opaque string cursor bound to the account, device, session, and event stream.\nPass unchanged as a string in HTTP parameters: a decimal sequence number for cloud sessions, an opaque cursor for remote control. The service validates it according to session type.",
            "explode": false,
            "in": "query",
            "name": "cursor",
            "schema": {
              "maxLength": 8192,
              "type": "string"
            }
          },
          {
            "description": "Page size.\nCloud: default 100, range 1 to 500. Remote control: default 50, range 1 to 100.",
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "description": "Number of entries per page.",
              "format": "int64",
              "maximum": 500,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "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 upstream does not validate OAuth session scope; the open platform validates the corresponding Scope according to the manifest.",
            "in": "query",
            "name": "session_type",
            "schema": {
              "default": "cloud",
              "enum": [
                "cloud",
                "remote"
              ],
              "type": "string"
            }
          },
          {
            "description": "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.",
            "in": "query",
            "name": "device_id",
            "schema": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionPublicEventListResponse"
                    },
                    {
                      "$ref": "#/components/schemas/SessionPublicRemoteEventList"
                    }
                  ]
                }
              }
            },
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Request ID generated by the open platform for each HTTP request, for log correlation and troubleshooting. Retries generate new IDs; this is not an idempotency key or distributed Trace ID.",
                "schema": {
                  "pattern": "^[0-9a-f]{32}$",
                  "type": "string"
                }
              },
              "X-Trace-ID": {
                "description": "OpenTelemetry TraceID for the current open-platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if the sample was not retained.",
                "schema": {
                  "pattern": "^[0-9a-f]{32}$",
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionPublicErrorBody"
                    },
                    {
                      "$ref": "#/components/schemas/SessionRelayError"
                    }
                  ]
                }
              }
            },
            "description": "Error. Branch on `code`, not just the HTTP status code—multiple conditions can share the same status code.",
            "headers": {
              "X-Request-ID": {
                "description": "Request ID generated by the open platform for each HTTP request, for log correlation and troubleshooting. Retries generate new IDs; this is not an idempotency key or distributed Trace ID.",
                "schema": {
                  "pattern": "^[0-9a-f]{32}$",
                  "type": "string"
                }
              },
              "X-Trace-ID": {
                "description": "OpenTelemetry TraceID for the current open-platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if the sample was not retained.",
                "schema": {
                  "pattern": "^[0-9a-f]{32}$",
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "OpenPlatformBearer": []
          }
        ],
        "summary": "Read the session event stream",
        "tags": [
          "会话事件"
        ],
        "x-session-variants": {
          "cloud": {
            "summary": "Read the session event stream",
            "description": "Cursor-paginated event stream. Pass the returned `next_cursor` to the next call and persist it so you can resume from the saved cursor after a restart rather than replaying from the beginning.\n\n`seq_id` is a 64-bit integer that increases monotonically within a session. Process events in `seq_id` order.\n\nA malformed `cursor` returns 422 rather than starting over.\n\nEvents are already assembled: an agent message arrives as one event with its full content; you do not need to reassemble fragments.\n\n`type` is always `method`, `result`, or `error`. Dispatch on the combination `(type, method, sub_type)`; `x-event-catalogue` in the events schema lists each combination and its payload structure.\n\n**Content safety.** Safety checks apply to text already emitted, but retraction signals are not part of this event stream, so callers reading this endpoint cannot be notified of retractions. Text read here is not authorized for republication to end users.\n\n**Stability of `raw`.** Envelope fields change only with API versions. Event discriminators and their internal fields evolve only through additions. Fields under `_meta` have no compatibility guarantees.",
            "parameters": [
              {
                "description": "Session ID returned by POST /sessions.",
                "in": "path",
                "name": "session_id",
                "required": true,
                "schema": {
                  "description": "Session ID returned by POST /sessions.",
                  "format": "uuid",
                  "type": "string"
                }
              },
              {
                "description": "Resume position; omit or pass 0 to start from the beginning.\n\nThis endpoint and /events/stream **share the same seq_id space**, so cursors are interchangeable. The same rule applies: send **the end of the first contiguous sequence range you hold**, not the largest value observed; within a record, advance to the maximum `seq_ids` value, not `seq_id`.",
                "explode": false,
                "in": "query",
                "name": "cursor",
                "schema": {
                  "description": "Resume position; omit or pass 0 to start from the beginning.\n\nThis endpoint and /events/stream **share the same seq_id space**, so cursors are interchangeable. The same rule applies: send **the end of the first contiguous sequence range you hold**, not the largest value observed; within a record, advance to the maximum `seq_ids` value, not `seq_id`.",
                  "format": "int64",
                  "minimum": 0,
                  "type": "integer"
                }
              },
              {
                "description": "Number of entries per page.",
                "explode": false,
                "in": "query",
                "name": "limit",
                "schema": {
                  "default": 100,
                  "description": "Number of entries per page.",
                  "format": "int64",
                  "maximum": 500,
                  "minimum": 1,
                  "type": "integer"
                }
              }
            ],
            "requestBody": null,
            "responses": {
              "200": {
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/SessionPublicEventListResponse"
                    }
                  }
                },
                "description": "Success"
              }
            }
          },
          "remote": {
            "summary": "Read authoritative event history from a remote-control device",
            "description": "Shares public gateway authentication with cloud sessions; this endpoint requires the business Scope stated below. No controller device ID or pairing is required. The target remote-control master switch must be enabled. If explicitly disabled, returns 403 FORBIDDEN with detail.reason=ACP_HOST_DISABLED; rejected write requests return detail.acceptance=not_accepted. An explicitly nonexistent session returns 404 NOT_FOUND with detail.reason=SESSION_NOT_FOUND. Commands route only to target connections signed in to the currently authenticated account. Offline targets, unknown targets, and targets belonging to other accounts all return device unavailable. Unknown request body fields are rejected. Reads desktop history, not a cloud archive. An offline device returns an error, not an empty page. next_cursor can resume history or SSE, including when has_more=false. Cursors are bound to the account, device, session, and event stream. Event stream changes or unrecoverable history gaps return explicit errors. A cursor ahead of the current end returns 422 VALIDATION_ERROR; a cursor at the current end returns an empty page. Aggregate text by id, deduplicate by sequence number, append raw fragments, and replace them with assembled multi-sequence text.",
            "parameters": [
              {
                "description": "Opaque target device identifier, possibly including suffixes such as :dev. The target connection must belong to the currently authenticated account.",
                "explode": false,
                "in": "query",
                "name": "device_id",
                "required": true,
                "schema": {
                  "description": "Opaque target device identifier, possibly including suffixes such as :dev. The target connection must belong to the currently authenticated account.",
                  "maxLength": 256,
                  "type": "string"
                }
              },
              {
                "description": "Session identifier on the target device.",
                "in": "path",
                "name": "session_id",
                "required": true,
                "schema": {
                  "description": "Session identifier on the target device.",
                  "maxLength": 256,
                  "type": "string"
                }
              },
              {
                "explode": false,
                "in": "query",
                "name": "limit",
                "schema": {
                  "default": 50,
                  "format": "int64",
                  "maximum": 100,
                  "minimum": 1,
                  "type": "integer"
                }
              },
              {
                "explode": false,
                "in": "query",
                "name": "cursor",
                "schema": {
                  "maxLength": 8192,
                  "type": "string"
                }
              }
            ],
            "requestBody": null,
            "responses": {
              "200": {
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/SessionPublicRemoteEventList"
                    }
                  }
                },
                "description": "Success"
              }
            }
          }
        },
        "x-supported-session-types": [
          "cloud",
          "remote"
        ]
      }
    }
  },
  "info": {
    "title": "Read the session event stream",
    "version": "2026-11-24"
  },
  "servers": [
    {
      "url": "https://openapi.qwenwork.ai"
    }
  ]
}
Back to the OpenAPI overview.