POST /api/v1/cloud/sessions
Creates a Session. The new Session starts in the idle state; send events to begin work.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer $QODER_PAT |
Content-Type | Yes | application/json |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
agent | string or object | Yes | Agent ID, or an object with id, mandatory type: "agent", and optional version. See Agent reference |
environment_id | string | Yes | Existing Environment ID with the env_ prefix |
title | string | null | No | Session title |
metadata | object | No | Session metadata |
environment_variables | string | No | Session-level environment variables to inject into the agent runtime, formatted as a single string of KEY=VALUE pairs separated by ; (or newlines, full-width ; is also accepted). The response field is a JSON object — see Validation. Not supported on self-hosted environments |
incremental_streaming_enabled | boolean | No | Enables incremental streaming events for this Session. Default: false. When true, list and stream event APIs expose incremental agent events such as agent.message_start, agent.content_block_delta, and agent.message_stop in addition to the final full events |
resources | array | No | File, GitHub repository, or Memory Store resources to attach at creation |
vault_ids | array | No | Vault IDs available to the Session |
environment, delta_flush_interval_ms, vaults, and memory_store_ids are not supported. Use resources[] with type: "memory_store" to attach Memory Stores.
Environment variables validation
Names must match[A-Za-z_][A-Za-z0-9_]*. Reserved names SERVER_ENDPOINT, USER_ID, WORK_DIR, and any name with the CAW_ or QODER_ prefix are rejected. Each value cannot exceed 8 KiB; the entire field cannot exceed 64 entries or 64 KiB combined. Duplicate keys, malformed entries, or use on self-hosted environments return 400 invalid_request_error.
Resource parameters
| Resource type | Required fields | Optional fields |
|---|---|---|
file | type, file_id | mount_path |
github_repository | type, url, authorization_token | mount_path, checkout |
memory_store | type, memory_store_id | access, instructions |
Example request
Example response
HTTP 200 OK Returns a Session object.Errors
| HTTP | Type | Trigger |
|---|---|---|
| 400 | invalid_request_error | Malformed request, missing required field, unsupported legacy field, or invalid resource |
| 401 | authentication_error | PAT invalid or expired |
| 404 | not_found_error | Agent, Environment, file, Memory Store, or Vault does not exist |
| 409 | invalid_request_error | A referenced file is not ready, or resource paths/IDs conflict |
agent value without the agent_ prefix (or an environment_id without the env_ prefix) is also resolved to a 404 not_found_error rather than a 400.
See Errors for the full error envelope.
Related
Start a session
Run an agent against an environment as a stateful conversation.