{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/runcrate/main/json-schema/runcrate-instance-create-request-schema.json",
  "title": "InstanceCreateRequest",
  "description": "Provide either `gpu_type` (Runcrate picks an available configuration for that GPU) or `instance_type_id` (specific config from `/instances/types`).",
  "x-generated": "2026-10-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/runcrate-api-openapi.json#/components/schemas/InstanceCreateRequest",
  "type": "object",
  "required": [
    "name"
  ],
  "properties": {
    "name": {
      "type": "string",
      "description": "Human-readable instance name."
    },
    "gpu_type": {
      "type": "string",
      "description": "GPU model id (e.g. `h100-sxm`). Required if `instance_type_id` is not provided."
    },
    "instance_type_id": {
      "type": "string",
      "description": "Exact instance-type id from `GET /instances/types`. Required if `gpu_type` is not provided."
    },
    "region": {
      "type": "string",
      "description": "Only launch in this region: a `region` from `GET /instances/types`, the start of one (`us-east`), or a city or country (`canada`). If nothing is available there the request fails and names the regions that have it; it never launches elsewhere. Defaults to `auto` (any region)."
    },
    "gpu_count": {
      "type": "integer",
      "minimum": 1
    },
    "cpu_cores": {
      "type": "integer",
      "minimum": 1
    },
    "memory": {
      "type": "integer",
      "description": "GB",
      "minimum": 1
    },
    "storage": {
      "type": "integer",
      "description": "GB ephemeral storage",
      "minimum": 1
    },
    "template": {
      "type": "string",
      "description": "Template id to boot from."
    },
    "ssh_key_id": {
      "type": "string",
      "description": "ID of an SSH key to inject (create one via POST /ssh-keys)."
    },
    "env_vars": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EnvVar"
      },
      "description": "Environment variables to inject. Each item must be `{ \"key\": \"NAME\", \"value\": \"...\" }`."
    },
    "startup_commands": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "storage_id": {
      "type": "string",
      "description": "Persistent volume to attach at boot. Mounts at `/workspace`."
    },
    "launch_script": {
      "type": "string",
      "description": "Raw shell script to run on boot."
    },
    "launch_script_base64": {
      "type": "string",
      "description": "Base64-encoded launch script (alternative to `launch_script`)."
    }
  },
  "$defs": {
    "EnvVar": {
      "type": "object",
      "required": [
        "key",
        "value"
      ],
      "properties": {
        "key": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    }
  }
}