{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codai-ro/json-schema/codai-ro-environment-create-body-schema.json",
  "title": "Create environment body",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/codai-ro-projects-environments-api-openapi.yml#/components/schemas/EnvironmentCreateBody",
  "type": "object",
  "required": [
    "project_id",
    "provider"
  ],
  "properties": {
    "project_id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120,
      "description": "Required unless the project is `vm_per_dev` (then defaults to `<project> — <you>`)."
    },
    "slug": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$",
      "description": "Defaults to `<project-slug>-<4 random chars>`."
    },
    "provider": {
      "$ref": "#/$defs/EnvironmentProvider"
    },
    "region": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Managed providers; defaults per provider (`hetzner` → `nbg1`, `openstack` → `eu-east-1`)."
    },
    "size": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Managed providers; one of the catalog sizes, default `small`."
    },
    "idle_timeout_minutes": {
      "type": "integer",
      "minimum": 5,
      "maximum": 1440,
      "default": 30
    },
    "budget_micro_eur": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "Per-environment spend ceiling in micro-EUR, enforced by the worker; `null` = none."
    }
  },
  "$defs": {
    "EnvironmentProvider": {
      "type": "string",
      "enum": [
        "byo",
        "openstack",
        "hetzner",
        "local",
        "gce"
      ],
      "description": "`byo` (bring your own machine; the daemon enrols with a token) is open to every key. `openstack` / `hetzner` are managed by the worker and billed hourly; `gce` (Google Cloud) offers on-demand CPU sizes `small`/`medium`/`large` (e2-standard-2/4/8) and the GPU size `gpu-l4` (Spot, 30-minute cap); it is available only where the deployment enables it AND to `super_admin` accounts (403 for everyone else); `local` is a developer convenience. Managed providers answer 403 until enabled for your key."
    }
  }
}