Create a new Session bound to an Agent and Environment.
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 <PAT or SAT> |
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 |
budget | object | null | No | Total session budget (model and sandbox credits), e.g. {"type":"limit","max_credit_cost":"100.00"}. Omit it or pass null to create the Session without a limit. See Session budget. |
title | string | null | No | Session title |
metadata | object | No | Session metadata |
environment_variables | object | No | Session-level environment variables to inject into the agent runtime, provided as a map of string keys to string values ({"NAME":"value"}). See Validation. Not supported on self-hosted environments |
resources | array | No | File, GitHub, generic Git, or Memory Store resources to attach at creation |
vault_ids | array | No | Vault IDs available to the Session |
resources[] with type: "memory_store" to attach Memory Stores.
Environment variables validation
Names must match [A-Za-z_][A-Za-z0-9_]*, and all values must be strings. 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 map cannot exceed 64 entries or 64 KiB combined. Invalid keys or values, 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 |
git_repository | type, url | password, mount_path, checkout |
memory_store | type, memory_store_id | access, instructions |
github_repository for github.com; its existing username/token-optional behavior is preserved. Use git_repository for GitLab, Gitee, Bitbucket, and other HTTP(S) Git services. Public repositories need neither a username nor a password, for example https://gitlab.com/group/repo.git. For private repositories or push, include the provider username in the URL and set password to the account password or the Access Token/PAT required by the provider. Username and password must be provided together.
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 field, or invalid resource |
| 401 | authentication_error | PAT or SAT 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.

