Skip to main content
POST /api/v1/cloud/environments Creates a new cloud execution environment for hosting Agent sessions.

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT>
Content-TypeYesapplication/json

Request body

FieldTypeRequiredDescription
namestringYesNon-empty environment name
descriptionstringNoEnvironment description
configEnvironment configYesEnvironment configuration
metadataMetadata objectNoCustom metadata. Defaults to {}

Example request

curl -s -X POST 'https://api.qoder.com/api/v1/cloud/environments' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "doc-test-env",
    "config": {
      "type": "cloud",
      "networking": {
        "type": "limited"
      },
      "packages": {
        "apt": ["curl"]
      }
    }
  }'

Example request: with setup script

curl -s -X POST 'https://api.qoder.com/api/v1/cloud/environments' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "doc-test-env-with-setup",
    "config": {
      "type": "cloud",
      "networking": {"type": "unrestricted"},
      "packages": {
        "npm": ["pnpm@9"]
      },
      "setup_script": "set -euo pipefail\n[ -d /workspace/.git ] || git clone https://github.com/me/repo /workspace\ncd /workspace && pnpm install --frozen-lockfile"
    }
  }'

Example response

HTTP 200 OK
{
  "id": "env_019e3bb39b6774d8878cd0b9d237574b",
  "type": "environment",
  "name": "doc-test-env",
  "description": "",
  "config": {
    "type": "cloud",
    "networking": {
      "type": "limited",
      "allowed_hosts": [],
      "allow_package_managers": false,
      "allow_mcp_servers": false
    },
    "packages": {
      "type": "packages",
      "apt": ["curl"],
      "npm": [],
      "pip": []
    }
  },
  "metadata": {},
  "archived_at": null,
  "created_at": "2026-05-18T15:28:07.017808Z",
  "updated_at": "2026-05-18T15:28:07.017808Z"
}

Response fields

FieldTypeDescription
idstringEnvironment unique identifier with the env_ prefix
typestringAlways "environment"
namestringEnvironment name
descriptionstringEnvironment description
configEnvironment configEnvironment configuration
metadataMetadata objectCustom metadata
archived_atstring|nullArchive time (ISO 8601), null when not archived
created_atstringCreation time (ISO 8601)
updated_atstringLast update time (ISO 8601)

Errors

HTTPTypeTrigger
400invalid_request_errorMissing required field name
400invalid_request_errorMissing required field config
400invalid_request_errorInvalid config or metadata value
400invalid_request_errorconfig.setup_script is not a string, or exceeds 64 KB
401authentication_errorPAT invalid or expired
403permission_errorNot authorized for this operation
See Errors for the full error envelope.

Cloud environment setup

Choose the container, network, and dependencies your agent runs in.