{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vpsnet-com/json-schema/vpsnet-com-service-schema.json",
  "title": "service",
  "description": "Service model (partial)",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vpsnet-com-openapi.yml#/components/schemas/service",
  "type": "object",
  "properties": {
    "title": {
      "type": "string"
    },
    "orderNo": {
      "description": "Service order number, e.g. \"VP87359\"",
      "type": "string"
    },
    "type": {
      "description": "Service type",
      "type": "string",
      "enum": [
        "vps",
        "vds",
        "ds",
        "firecracker",
        "vps_storage"
      ]
    },
    "plan": {
      "description": "Plan name; null when the service's plan is no longer in the catalog.",
      "type": [
        "string",
        "null"
      ]
    },
    "state": {
      "type": "string"
    },
    "stateRevision": {
      "description": "Monotonic compare-and-set version for lifecycle, progress and resource snapshots. Discard GET or WebSocket payloads whose value is lower than the newest value already applied for this service.",
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "stateProcess": {
      "description": "In-progress action for this service, or null when idle. Canonical spelling; prefer this over the misspelled \"stateProccess\" alias.",
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "percentage": {
          "type": "integer"
        },
        "waitingReason": {
          "description": "`public_ip_inventory`: the exact paid CREATE is retained and resumes automatically after public IP inventory becomes available; no additional payment is required. `reinstall_disk_wait`: a Cloud VPS OS reinstall waits for a server-disk reason (a disk change still open, a disk being checked); it was not refused and continues by itself; the administrators are told when a person must act.",
          "type": "string",
          "enum": [
            "public_ip_inventory",
            "reinstall_disk_wait"
          ]
        },
        "attention": {
          "description": "Provisioning needs operator attention instead of automatic continuation.",
          "type": "boolean"
        }
      }
    },
    "stateProccess": {
      "description": "DEPRECATED misspelling of \"stateProcess\", kept populated with the identical value for existing integrations. Read \"stateProcess\" instead. Both names are also mirrored on the service state WebSocket notification.",
      "deprecated": true,
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "percentage": {
          "type": "integer"
        },
        "waitingReason": {
          "description": "`public_ip_inventory`: the exact paid CREATE is retained and resumes automatically after public IP inventory becomes available; no additional payment is required. `reinstall_disk_wait`: a Cloud VPS OS reinstall waits for a server-disk reason (a disk change still open, a disk being checked); it was not refused and continues by itself; the administrators are told when a person must act.",
          "type": "string",
          "enum": [
            "public_ip_inventory",
            "reinstall_disk_wait"
          ]
        },
        "attention": {
          "description": "Provisioning needs operator attention instead of automatic continuation.",
          "type": "boolean"
        }
      }
    },
    "isQuarantine": {
      "description": "True while the service is in post-expiry quarantine awaiting destruction. Canonical spelling; prefer this over \"isCarantine\".",
      "type": "boolean"
    },
    "isCarantine": {
      "description": "DEPRECATED misspelling of \"isQuarantine\", kept populated with the identical value for existing integrations. Read \"isQuarantine\".",
      "deprecated": true,
      "type": "boolean"
    },
    "expireDate": {
      "type": "string"
    },
    "resources": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "extra": {
      "type": "object",
      "properties": {
        "resourcesUsage": {
          "type": "array",
          "description": "Current resource measurements. When available is false, value and percentage are compatibility placeholders and must not be interpreted as measured zero usage.",
          "items": {
            "$ref": "#/$defs/ServiceResourceUsage"
          }
        },
        "deletionPending": {
          "type": "boolean",
          "description": "Present only on an expired (quarantined) service. True when the expiry cleanup is already removing the service and no renewal can bring it back (a Firecracker server in its runtime or DNS cleanup); the service will be deleted. False otherwise, including a VDS or VPS in the same cleanup, which a paid renewal can still rescue. \"state\" is not changed by it."
        },
        "powerWait": {
          "$ref": "#/$defs/ServicePowerWait"
        }
      }
    }
  },
  "$defs": {
    "ServicePowerWait": {
      "type": "object",
      "description": "Cloud VPS (KVM) only, present only while a stop or restart waits for the server to shut down by itself (its one graceful attempt; absent otherwise, also after a forced power-off was asked for). The platform switches the server off by itself when gracefulSeconds have passed; from forceAvailable on, the customer may do it at once with POST /account/services/{orderNo}/force-power-off.",
      "required": [
        "action",
        "waitingSince",
        "waitedSeconds",
        "gracefulSeconds",
        "forceAvailable",
        "forceAvailableInSeconds"
      ],
      "additionalProperties": false,
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "stop",
            "restart"
          ]
        },
        "waitingSince": {
          "type": "string",
          "format": "date-time",
          "description": "When the stop or restart was asked for (UTC)."
        },
        "waitedSeconds": {
          "type": "integer",
          "minimum": 0
        },
        "gracefulSeconds": {
          "type": "integer",
          "description": "How long the server is given to shut down by itself: 120 s, or 300 s for a Windows server."
        },
        "forceAvailable": {
          "type": "boolean",
          "description": "True after 30 s of waiting."
        },
        "forceAvailableInSeconds": {
          "type": "integer",
          "minimum": 0,
          "description": "Seconds until forceAvailable becomes true (0 when it is)."
        }
      }
    },
    "ServiceResourceUsage": {
      "type": "object",
      "required": [
        "type",
        "value",
        "percentage",
        "available"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "cpu",
            "ram",
            "ssd",
            "storage",
            "traffic"
          ]
        },
        "value": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            }
          ]
        },
        "percentage": {
          "type": "number"
        },
        "total": {
          "type": [
            "string",
            "null"
          ]
        },
        "available": {
          "type": "boolean",
          "description": "True only when value and percentage come from a successful measurement. False means the numeric fields are placeholders."
        },
        "source": {
          "type": "string",
          "enum": [
            "guest",
            "hypervisor",
            "host_allocated"
          ],
          "description": "KVM (vds) RAM rows of running services only. guest means value is MemTotal minus MemAvailable read from inside the VM (page cache is not counted as used). hypervisor means the guest could not be read and value is the hypervisor figure from the guest's balloon statistics, which counts page cache as used. host_allocated means the VM has neither a guest agent answer nor balloon statistics (typical for network appliance images) and value is the memory the VM holds on the host, an upper bound of its own use."
        },
        "unmeasured_reason": {
          "type": "string",
          "enum": [
            "no_guest_agent",
            "not_reported"
          ],
          "description": "Services list, KVM (vds) RAM and disk rows of running services with available false only, when the figure cannot be measured for a lasting reason: no_guest_agent (asked since the VM booted, the QEMU guest agent never answered) or not_reported (the agent answers but the guest does not report this figure). Absent while the figure is only not read yet."
        },
        "used_bytes": {
          "type": "integer",
          "description": "KVM (vds) RAM rows of running services only. Used memory in bytes."
        },
        "total_bytes": {
          "type": "integer",
          "description": "KVM (vds) RAM rows of running services only. Assigned memory in bytes."
        },
        "guest_total_bytes": {
          "type": "integer",
          "description": "Present when source is guest. MemTotal reported by the guest kernel, in bytes."
        },
        "guest_available_bytes": {
          "type": "integer",
          "description": "Present when source is guest. MemAvailable reported by the guest kernel, in bytes."
        }
      }
    }
  }
}