Create a new cloud execution environment for hosting Agent sessions.
POST /api/v1/cloud/environments
Creates a new cloud execution environment for hosting Agent sessions.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <PAT or SAT> |
Content-Type | Yes | application/json |
x-qoder-beta | Conditional | Required when config contains storage.buckets; value oss-bucket-2026-09-23 |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Non-empty environment name |
description | string | No | Environment description |
config | Environment config | No | Environment configuration. Defaults to {"type":"cloud"} when omitted |
metadata | Metadata object | No | Custom metadata. Defaults to {} |
config.storage.buckets are mounted at /mnt/buckets/<name> in the Session. See Mount your own OSS buckets (Beta) for fields, credentials, authorization, and permissions.
Example request
Example request: with setup script
Example response
HTTP 200 OK
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Environment unique identifier with the env_ prefix |
type | string | Always "environment" |
name | string | Environment name |
description | string | Environment description |
config | Environment config | Environment configuration |
metadata | Metadata object | Custom metadata |
archived_at | string|null | Archive time (ISO 8601), null when not archived |
created_at | string | Creation time (ISO 8601) |
updated_at | string | Last update time (ISO 8601) |
Errors
| HTTP | Type | Trigger |
|---|---|---|
| 400 | invalid_request_error | Missing required field name |
| 400 | invalid_request_error | Invalid config or metadata value |
| 400 | invalid_request_error | config.setup_script is not a string, or exceeds 64 KB |
| 400 | invalid_request_error | config.startup_script is not a string, or exceeds 64 KB |
| 400 | invalid_request_error | Invalid config.storage.buckets, missing the x-qoder-beta header, or the save-time probe was refused |
| 401 | authentication_error | PAT or SAT invalid or expired |
| 403 | permission_error | Not authorized for this operation |
| 503 | feature_not_available | The account is not eligible for the oss_bucket Beta |
| 503 | api_error | OSS / STS was temporarily unavailable during the save-time probe; retry |