{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/oec-sh/json-schema/oec-sh-vmresponse-schema.json",
  "title": "VMResponse",
  "description": "Schema for VM/Server response.\n\nSECURITY NOTE: This schema intentionally excludes sensitive credential fields:\n- ssh_password (encrypted in database, never exposed via API)\n- ssh_private_key (encrypted in database, never exposed via API)\n- ssh_key_passphrase (encrypted in database, never exposed via API)\n- netdata_api_key (only exposed as netdata_api_key_set boolean)\n\nCredentials are only accessible internally by the application for SSH operations.",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/oec-sh-api-openapi.json#/components/schemas/VMResponse",
  "properties": {
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At",
      "description": "Creation timestamp"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At",
      "description": "Last update timestamp"
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id",
      "description": "Unique identifier"
    },
    "name": {
      "type": "string",
      "title": "Name",
      "description": "Server name"
    },
    "organization_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Organization Id",
      "description": "Organization ID (null for shared servers)"
    },
    "organization_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Organization Name",
      "description": "Organization name"
    },
    "is_shared": {
      "type": "boolean",
      "title": "Is Shared",
      "description": "Whether this is a portal-managed shared server",
      "default": false
    },
    "owner_type": {
      "type": "string",
      "title": "Owner Type",
      "description": "Owner type: 'organization' (BYOS) or 'portal' (shared server)",
      "default": "organization"
    },
    "provider": {
      "anyOf": [
        {
          "$ref": "#/$defs/VMProvider"
        },
        {
          "type": "null"
        }
      ],
      "description": "Cloud provider"
    },
    "region": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Region",
      "description": "Cloud region or location"
    },
    "instance_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Instance Type",
      "description": "Provider-specific instance type (e.g., Standard_B4ms, s-4vcpu-8gb, t3.medium)"
    },
    "status": {
      "$ref": "#/$defs/VMStatus",
      "description": "Server status"
    },
    "ipv4_address": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ipv4 Address",
      "description": "Public IPv4 address"
    },
    "ipv6_address": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ipv6 Address",
      "description": "Public IPv6 address"
    },
    "fqdn": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fqdn",
      "description": "Fully qualified domain name"
    },
    "hostname": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Hostname",
      "description": "Server hostname"
    },
    "private_ipv4": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Private Ipv4",
      "description": "Private IPv4 address"
    },
    "private_ipv6": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Private Ipv6",
      "description": "Private IPv6 address"
    },
    "connection_host_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Connection Host Type",
      "description": "Which address to use for SSH",
      "default": "auto"
    },
    "connection_host": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Connection Host",
      "description": "Resolved address for SSH connection"
    },
    "ip_address": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ip Address",
      "description": "Deprecated: Use ipv4_address"
    },
    "private_ip": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Private Ip",
      "description": "Deprecated: Use private_ipv4"
    },
    "ssh_port": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ssh Port",
      "description": "SSH port",
      "default": 22
    },
    "ssh_username": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ssh Username",
      "description": "SSH username",
      "default": "root"
    },
    "ssh_auth_method": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ssh Auth Method",
      "description": "SSH auth method",
      "default": "ssh_key"
    },
    "ssh_sudo_mode": {
      "type": "string",
      "title": "Ssh Sudo Mode",
      "description": "Sudo mode: auto, none, or sudo",
      "default": "auto"
    },
    "ssh_secured_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ssh Secured At",
      "description": "When server was converted to SSH key auth"
    },
    "server_ssh_key_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Server Ssh Key Id",
      "description": "Stored SSH key used for this server"
    },
    "provider_vm_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Provider Vm Id",
      "description": "Provider-specific ID"
    },
    "provisioned_via_cloud": {
      "type": "boolean",
      "title": "Provisioned Via Cloud",
      "description": "Whether this server was provisioned via cloud provider API",
      "default": false
    },
    "cloud_connection_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cloud Connection Id",
      "description": "Cloud connection used for provisioning"
    },
    "cloud_server_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cloud Server Id",
      "description": "Cloud provider's server ID (for deletion)"
    },
    "cloud_region": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cloud Region",
      "description": "Cloud region where server was provisioned"
    },
    "cloud_server_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cloud Server Type",
      "description": "Cloud provider's server type/size identifier"
    },
    "connection_method": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Connection Method",
      "description": "How platform connects: 'direct' or 'cloudflare_tunnel'"
    },
    "cf_tunnel_status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cf Tunnel Status",
      "description": "Tunnel connector status: pending, connected, disconnected, error"
    },
    "cf_tunnel_managed_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cf Tunnel Managed By",
      "description": "Who owns the Cloudflare resources: 'platform' (ours, default) or 'customer' (BYOS legacy/vanity)."
    },
    "cf_tunnel_hostname": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cf Tunnel Hostname",
      "description": "SSH hostname assigned via Cloudflare Tunnel"
    },
    "cf_tunnel_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cf Tunnel Id",
      "description": "Cloudflare Tunnel UUID"
    },
    "cf_tunnel_qualified_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cf Tunnel Qualified At",
      "description": "Timestamp of last successful E2E SSH qualification through the tunnel"
    },
    "cf_tunnel_qualify_attempted_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cf Tunnel Qualify Attempted At",
      "description": "Timestamp of last qualification attempt (success or failure)"
    },
    "cf_tunnel_qualify_error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cf Tunnel Qualify Error",
      "description": "Last qualification error (bounded to 500 chars); null on success or never-attempted"
    },
    "cpu_cores": {
      "type": "integer",
      "title": "Cpu Cores",
      "description": "Number of CPU cores",
      "default": 4
    },
    "memory_gb": {
      "type": "integer",
      "title": "Memory Gb",
      "description": "Memory in GB",
      "default": 8
    },
    "disk_gb": {
      "type": "integer",
      "title": "Disk Gb",
      "description": "Disk size in GB",
      "default": 160
    },
    "disk_available_gb": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Disk Available Gb",
      "description": "Available disk space in GB (from monitoring)"
    },
    "size": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Size",
      "description": "VM size category"
    },
    "max_projects": {
      "type": "integer",
      "title": "Max Projects",
      "description": "Maximum environments on this server (0 = unlimited)",
      "default": 0
    },
    "is_active": {
      "type": "boolean",
      "title": "Is Active",
      "description": "Whether server is active",
      "default": true
    },
    "health_status": {
      "type": "string",
      "title": "Health Status",
      "description": "Health status",
      "default": "unknown"
    },
    "docker_status": {
      "type": "string",
      "title": "Docker Status",
      "description": "Docker daemon status",
      "default": "unknown"
    },
    "last_health_check": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Health Check",
      "description": "When health was last actually checked (None = never)"
    },
    "health_is_stale": {
      "type": "boolean",
      "title": "Health Is Stale",
      "description": "True when last_health_check is missing or older than 24h",
      "default": true
    },
    "access_lost_since": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Access Lost Since",
      "description": "When we lost SSH access to this server (circuit open)"
    },
    "access_lost_class": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Access Lost Class",
      "description": "auth_key | auth_password | network: which fix the owner needs"
    },
    "access_lost_text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Access Lost Text",
      "description": "What happened and the fix, in plain words (same text as the email)"
    },
    "qualification_status": {
      "type": "string",
      "title": "Qualification Status",
      "description": "Server qualification status: unchecked, checking, qualified, needs_setup, unqualified, stale, expired, needs_recheck, unknown",
      "default": "unchecked"
    },
    "last_error_message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Error Message",
      "description": "Last error message (e.g., connection failure reason)"
    },
    "last_error_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Error At",
      "description": "When the last error occurred (ISO datetime)"
    },
    "netdata_api_key_set": {
      "type": "boolean",
      "title": "Netdata Api Key Set",
      "description": "Whether Netdata API key is configured (key value not exposed)",
      "default": false
    },
    "netdata_machine_guid": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Netdata Machine Guid",
      "description": "Netdata machine GUID for identifying this server"
    },
    "netdata_installed_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Netdata Installed At",
      "description": "When Netdata was installed (ISO datetime)"
    },
    "netdata_version": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Netdata Version",
      "description": "Installed Netdata version"
    },
    "netdata_streaming_enabled": {
      "type": "boolean",
      "title": "Netdata Streaming Enabled",
      "description": "Whether Netdata streaming is enabled",
      "default": false
    },
    "netdata_streaming_status": {
      "type": "string",
      "title": "Netdata Streaming Status",
      "description": "Streaming status: active, configured, or not_configured",
      "default": "not_configured"
    },
    "os_auto_update_enabled": {
      "type": "boolean",
      "title": "Os Auto Update Enabled",
      "description": "Whether automatic OS security updates are enabled on this server",
      "default": false
    },
    "os_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Os Type",
      "description": "Operating system type"
    },
    "os_version": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Os Version",
      "description": "Operating system version"
    },
    "environment_count": {
      "type": "integer",
      "title": "Environment Count",
      "description": "Total number of environments on this server",
      "default": 0
    },
    "running_environment_count": {
      "type": "integer",
      "title": "Running Environment Count",
      "description": "Number of running environments on this server",
      "default": 0
    },
    "allocation_info": {
      "anyOf": [
        {
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Allocation Info",
      "description": "Allocation quota info if requester is in shared mode (cpu_quota, ram_quota_mb, disk_quota_gb, max_environments, expires_date)"
    },
    "is_demo": {
      "type": "boolean",
      "title": "Is Demo",
      "description": "True on the platform-owned shared demo pool VM",
      "default": false
    },
    "allowed_env_types": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Allowed Env Types",
      "description": "Portal-admin-only: env types this server permits"
    },
    "allowed_odoo_versions": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Allowed Odoo Versions",
      "description": "Portal-admin-only: Odoo versions this server permits"
    },
    "allowed_editions": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Allowed Editions",
      "description": "Portal-admin-only: Odoo editions this server permits"
    },
    "allows_db_tuning": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Allows Db Tuning",
      "description": "Portal-admin-only: whether DB-tuning toggles are exposed"
    },
    "allows_custom_git": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Allows Custom Git",
      "description": "Portal-admin-only: whether custom git URLs are allowed"
    },
    "domain_pattern": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Domain Pattern",
      "description": "Portal-admin-only: 'custom' or 'vanity'"
    },
    "module_source": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Module Source",
      "description": "Portal-admin-only: 'any' or 'official+oca-allowlist'"
    },
    "fixed_resource_caps": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fixed Resource Caps",
      "description": "Portal-admin-only: when True, env resources are fixed"
    }
  },
  "type": "object",
  "required": [
    "created_at",
    "updated_at",
    "id",
    "name",
    "provider",
    "region",
    "status"
  ],
  "$defs": {
    "VMProvider": {
      "type": "string",
      "enum": [
        "aws",
        "azure",
        "gcp",
        "digitalocean",
        "vultr",
        "ovhcloud",
        "hetzner",
        "linode",
        "custom"
      ],
      "title": "VMProvider",
      "description": "Supported cloud providers for VMs."
    },
    "VMStatus": {
      "type": "string",
      "enum": [
        "pending",
        "provisioning",
        "running",
        "stopped",
        "error",
        "deleting",
        "deleted",
        "terminated"
      ],
      "title": "VMStatus",
      "description": "VM status states."
    }
  }
}