Skip to main content

Cloud only: List queued prompts

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

Request and permissions

GET https://openapi.qwenwork.ai/v1/session/sessions/{session_id}/prompt-queue 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 prompts queued after the current turn, in execution order. Excludes the executing prompt, which appears in current_turn from GET /sessions/{session_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

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
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
$schemastringNoURL of the JSON Schema for this object.
Format: "uri"
itemsarrayYesPrompts waiting to execute, in execution order. An empty array, never null, when the queue is empty. The executing prompt appears in current_turn from GET /sessions/{id}.
items[]objectNoAdditional fields: false
items[].created_atstring | nullYesWhen queued. ISO 8601, with microseconds and timezone. null when the queue entry has no timestamp—the queue is an ordered list, so use position, not this field, to determine order.
items[].positionintegerYesQueue position; 1 means next to execute. Position 1 is not currently running—it starts after the current turn ends.
Format: "int64"
items[].prompt_idstringYesWhile this prompt is still waiting, pass this to DELETE /sessions/{id}/prompt-queue/{prompt_id} to withdraw it.
items[].textstringYesOriginal prompt text as submitted.

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"
      },
      "SessionPublicPromptQueueResponse": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "URL of the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/PromptQueueResponse.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "items": {
            "description": "Prompts waiting to execute, in execution order. An empty array, never null, when the queue is empty. The executing prompt appears in current_turn from GET /sessions/{id}.",
            "items": {
              "$ref": "#/components/schemas/SessionPublicQueuedPrompt"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "SessionPublicQueuedPrompt": {
        "additionalProperties": false,
        "properties": {
          "created_at": {
            "description": "When queued. ISO 8601, with microseconds and timezone. null when the queue entry has no timestamp—the queue is an ordered list, so use position, not this field, to determine order.",
            "examples": [
              "2026-08-24T09:15:04.123456+00:00"
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "position": {
            "description": "Queue position; 1 means next to execute. Position 1 is not currently running—it starts after the current turn ends.",
            "format": "int64",
            "type": "integer"
          },
          "prompt_id": {
            "description": "While this prompt is still waiting, pass this to DELETE /sessions/{id}/prompt-queue/{prompt_id} to withdraw it.",
            "type": "string"
          },
          "text": {
            "description": "Original prompt text as submitted.",
            "type": "string"
          }
        },
        "required": [
          "prompt_id",
          "text",
          "created_at",
          "position"
        ],
        "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}/prompt-queue": {
      "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:\nReturns prompts queued after the current turn, in execution order. Excludes the executing prompt, which appears in current_turn from `GET /sessions/{session_id}`.\n\nRemote-control sessions: This operation returns 422 OPERATION_NOT_SUPPORTED without contacting the target device.\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-prompt-queue",
        "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": "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": {
                  "$ref": "#/components/schemas/SessionPublicPromptQueueResponse"
                }
              }
            },
            "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": "Cloud only: List queued prompts",
        "tags": [
          "会话管理"
        ],
        "x-session-variants": {
          "cloud": {
            "summary": "List queued prompts",
            "description": "Returns prompts queued after the current turn, in execution order. Excludes the executing prompt, which appears in current_turn from `GET /sessions/{session_id}`.",
            "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"
                }
              }
            ],
            "requestBody": null,
            "responses": {
              "200": {
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/SessionPublicPromptQueueResponse"
                    }
                  }
                },
                "description": "Success"
              }
            }
          }
        },
        "x-supported-session-types": [
          "cloud"
        ]
      }
    }
  },
  "info": {
    "title": "Cloud only: List queued prompts",
    "version": "2026-11-24"
  },
  "servers": [
    {
      "url": "https://openapi.qwenwork.ai"
    }
  ]
}
Back to the OpenAPI overview.