{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gpucloud-ca/json-schema/gpucloud-ca-create-reservation-request-schema.json",
  "title": "CreateReservationRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gpucloud-ca-openapi.json#/components/schemas/CreateReservationRequest",
  "type": "object",
  "required": [
    "productId",
    "sshKeyId",
    "maxHourlyCad",
    "consent",
    "consentVersion"
  ],
  "properties": {
    "productId": {
      "type": "string",
      "description": "Exact GPU machine (model and size), e.g. gpu-h100-x8."
    },
    "sshKeyId": {
      "type": "string"
    },
    "maxHourlyCad": {
      "type": "number",
      "description": "Highest hourly price accepted (CAD): at least the current price, at most 5 times it."
    },
    "validityDays": {
      "type": "integer",
      "minimum": 1,
      "maximum": 30,
      "default": 7
    },
    "acceptAlternative": {
      "type": "boolean",
      "default": false,
      "description": "Launch an equivalent machine (same usage, at least the same GPU memory, never spot) when the exact one is not in stock."
    },
    "name": {
      "type": "string",
      "description": "Server name: letters, digits, space, dot, dash, underscore (63 at most)."
    },
    "templateId": {
      "type": "string"
    },
    "templateModel": {
      "type": "string"
    },
    "consent": {
      "type": "boolean",
      "description": "The user explicitly agreed: \"I authorize GPU Cloud to launch this server as soon as it is available, to charge my saved card the amount needed if my balance is not enough, then to bill it by the hour under the terms.\"",
      "enum": [
        true
      ]
    },
    "consentVersion": {
      "type": "string"
    },
    "consentLang": {
      "type": "string",
      "enum": [
        "fr",
        "en"
      ]
    },
    "onFundsExhausted": {
      "$ref": "#/$defs/FundsExhaustedAction"
    }
  },
  "$defs": {
    "FundsExhaustedAction": {
      "type": "string",
      "enum": [
        "HIBERNATE",
        "DELETE"
      ],
      "default": "HIBERNATE",
      "description": "What happens to this hourly server when the balance reaches its threshold and no automatic reload brings it back. HIBERNATE: hibernated (its GPU place is kept, hourly hibernation fee), restarted as soon as the balance is back above the threshold. DELETE: no hibernation fee; it keeps running while the balance pays its next hour, then it is taken out of service, and restarted as soon as the balance pays its next hour again. A server is never deleted while the account has credit left. When the balance covers only about 24 hours of what the account spends per hour, a first notice is sent while the servers still run, then two more about 24 hours and 1 hour before the deletion; a server is deleted with its data only once it is out of service (stopped or hibernated for lack of credit, or hibernated by the user for at least 72 hours), once the credit is exhausted (the balance no longer pays the next hour of the account's servers), after the three notices and at least 24 hours after the first. Adding credits cancels the deletion. Machines that cannot be hibernated (spot) are always DELETE. Any other value: 400."
    }
  }
}