メインコンテンツへスキップ
POST /api/v1/cloud/environments Agent セッションをホストするための新しいクラウド実行環境を作成します。

リクエストヘッダー

ヘッダー必須説明
AuthorizationはいBearer <PAT>
Content-Typeはいapplication/json

リクエストボディ

フィールド必須説明
namestringはい空でない Environment 名
descriptionstringいいえEnvironment の説明
configEnvironment configはいEnvironment 設定
metadataMetadata オブジェクトいいえカスタムメタデータ。省略時は {}

リクエスト例

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"]
      }
    }
  }'

リクエスト例:セットアップスクリプト付き

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"
    }
  }'

レスポンス例

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"
}

レスポンスフィールド

フィールド説明
idstringEnvironment の一意識別子(env_ プレフィックス付き)
typestringリソースタイプ、固定値 "environment"
namestringEnvironment 名
descriptionstringEnvironment の説明
configEnvironment configEnvironment 設定
metadataMetadata オブジェクトカスタムメタデータ
archived_atstring|nullアーカイブ時刻(ISO 8601)、未アーカイブ時は null
created_atstring作成時刻(ISO 8601)
updated_atstring最終更新時刻(ISO 8601)

エラーコード

HTTPtype説明
400invalid_request_error必須フィールド name が未指定
400invalid_request_error必須フィールド config が未指定
400invalid_request_errorconfig または metadata の値が不正
400invalid_request_errorconfig.setup_script が文字列でない、または 64 KB を超えている
401authentication_error認証失敗、PAT が無効または期限切れ
403permission_errorこの操作を実行する権限がない

関連

クラウド環境

Agent が実行されるコンテナ、ネットワーク、依存関係を選択する。