Call requirements, permissions, request fields, response fields, and error handling.
Request and permissions
POST https://openapi.qwenwork.ai/v1/session/sessions
Authentication: Authorization: Bearer <access_token>; use an access token obtained through user OAuth authorization.
Required business Scope: session.session.execute
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
Create a session using the application's currently effective configuration. Use an oauth_app user Bearer Token; app_id must match the token. System prompts, skills, connectors, and expert suites are injected from the currently effective application and Agent versions. Callers must not set user_id, initial_prompt, attachments, or additional_resources, or override these configurations. The request body uses fields such as app_id and text; this creation endpoint does not currently support session_type/device_id parameters for remote-control creation. 202 means accepted; query the session or subscribe to events under the same /v1/session prefix. This operation provides no idempotency guarantee: creation may have succeeded after a timeout or disconnection, so do not retry automatically.
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.
Request body
The request body is required.
application/json
A child field is required only when its containing object exists. Union branches are listed separately; this does not mean that fields from all branches are required simultaneously.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
agent_id | string | No | Agent ID within the application; if omitted, existing creation logic selects the default Agent. |
app_id | string | Yes | Application ID; must match app_id in the oauth_app user Token. Minimum length: 1 |
locale | string | No | Language preference, passed through using the original creation logic. |
mode | string | No | Session mode; if omitted, the Session service determines the default. |
name | string | No | Session name, passed through using the original creation logic. |
text | string | Yes | First-turn task text; must not be whitespace-only, with at most 100000 Unicode characters. Minimum length: 1 Maximum length: 100000 |
timezone | string | No | Timezone preference, passed through using the original creation logic. |
ttl_seconds | integer | No | Session lifetime in seconds. The Session service validates the allowed range; not passed through if omitted. |
Successful responses
Preserve the original response structure of each business endpoint; do not add a common code/msg/data wrapper.
HTTP 202
Creation accepted. Uses the original creation endpoint's response without an additional outer wrapper.
Response type: application/json
| Field | Type | Required | Description and constraints |
|---|---|---|---|
agent_id | string | Yes | Application Agent ID actually used. |
app_id | string | Yes | Application ID actually used. |
created_at | string | Yes | Session creation time, in the original creation endpoint's format. |
first_turn_id | string | Yes | First-turn identifier, as returned by Session. |
session_id | string | Yes | ID of the created session. |
status | string | Yes | Session state returned by Session, without enum restrictions. |
version_id | string | Yes | Effective application version ID whose configuration was actually injected. |
Error responses
| HTTP | Description and handling |
|---|---|
400 | Invalid request parameters, or app_id does not match the token. |
401 | User Token is missing, invalid, or of an incompatible type. |
403 | Access denied by application IP restrictions. |
404 | Application or Agent does not exist. |
409 | The application has no effective published version yet. |
413 | Request body exceeds 1 MiB. |
415 | Request content type is not JSON. |
422 | Session rejected creation, for example because resource, mode, or quota validation failed. |
429 | Business service rate limit exceeded. |
500 | Internal processing error. |
503 | Identity, configuration storage, or Session dependency is unavailable. |
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