{
  "openapi": "3.1.0",
  "info": {
    "title": "DCS developer API",
    "version": "0.1.0",
    "description": "Supported customer cluster workflow. This reference covers the developer kit, not every dashboard or internal API. v1 paths and current server authorization remain authoritative."
  },
  "servers": [
    {
      "url": "/api/v1",
      "description": "Same-origin DCS Core gateway"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/auth/login": {
      "post": {
        "operationId": "login",
        "summary": "Sign in with an existing DCS account",
        "description": "Returns an unscoped session. Select an organisation next. One current normal session is stored per user; login can replace a dashboard or CLI session. OAuth-only accounts use the dashboard. This kit does not introduce service-account credentials.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Credentials"
              }
            }
          }
        }
      }
    },
    "/organisations/my-organisation": {
      "get": {
        "operationId": "listOrganisations",
        "summary": "List your organisation memberships",
        "description": "",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Membership"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/organisations/switch": {
      "post": {
        "operationId": "useOrganisation",
        "summary": "Select an organisation",
        "description": "Checks current membership and replaces the session token. Use the JSON body token instead of any intermediate X-Access-Token header.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganisationSelection"
              }
            }
          }
        }
      }
    },
    "/resource-groups": {
      "get": {
        "operationId": "listResourceGroups",
        "summary": "List accessible resource groups",
        "description": "Requires an active organisation; results are filtered by resource-group access.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ResourceGroup"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "rg:view"
      },
      "post": {
        "operationId": "createResourceGroup",
        "summary": "Create a resource group",
        "description": "",
        "responses": {
          "201": {
            "description": "Created; provisioning may still be pending.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceGroup"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "rg:create",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResourceGroupInput"
              }
            }
          }
        }
      }
    },
    "/network/organisations/{organisationId}/resource-groups/{resourceGroupId}/networks": {
      "get": {
        "operationId": "listNetworks",
        "summary": "List networks in a resource group",
        "description": "organisationId must match the active organisation. These are provider VNETs used for cluster provisioning.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Network"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "network:view",
        "parameters": [
          {
            "name": "organisationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "resourceGroupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      },
      "post": {
        "operationId": "createNetwork",
        "summary": "Allocate a network in a resource group",
        "description": "Allocates real network infrastructure. No idempotency key support; inspect state after ambiguous failures.",
        "responses": {
          "201": {
            "description": "Created; provisioning may still be pending.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Network"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "network:create",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "organisationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "resourceGroupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      }
    },
    "/proxmox/compute-limits": {
      "get": {
        "operationId": "computeLimits",
        "summary": "Read organisation compute allocations",
        "description": "Support sessions are rejected. enabled=false means no quota policy is configured. usageComplete=false means some retained allocations have unknown sizes.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputeLimits"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "Organisation owner/admin"
      }
    },
    "/clusters": {
      "get": {
        "operationId": "listClusters",
        "summary": "List accessible clusters",
        "description": "",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Cluster"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "compute:view"
      },
      "post": {
        "operationId": "createCluster",
        "summary": "Provision a K3s cluster",
        "description": "Asynchronous creation. network_id must belong to resource_group_id. Poll GET /clusters/{id} until active or error. A 201 is not readiness. Names are unique per organisation. No automatic retry or idempotency key support.",
        "responses": {
          "201": {
            "description": "Created; provisioning may still be pending.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Cluster"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "compute:create",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCluster"
              }
            }
          }
        }
      }
    },
    "/clusters/{id}": {
      "get": {
        "operationId": "getCluster",
        "summary": "Inspect cluster status",
        "description": "",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Cluster"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "compute:view",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      },
      "delete": {
        "operationId": "deleteCluster",
        "summary": "Delete a cluster",
        "description": "Destructive provider cleanup. Protected platform clusters cannot be deleted. Inspect cluster status before repeating an interrupted request.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "compute:delete",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      }
    },
    "/clusters/{id}/kubeconfig": {
      "get": {
        "operationId": "clusterConnection",
        "summary": "Download private cluster connection details",
        "description": "Returns credentials only when the cluster is active and the private control-plane identity is ready. Write kubeconfig to a private file. The returned endpoint requires private-network connectivity; never disable certificate verification.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClusterConnection"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "compute:configure",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      }
    },
    "/clusters/{id}/access-key": {
      "post": {
        "operationId": "createDeviceKey",
        "summary": "Create a short-lived private-network device key",
        "description": "Creates a sensitive enrollment credential. Limited to five requests per minute per IP. Never print it to logs; repeated calls generate additional keys.",
        "responses": {
          "201": {
            "description": "Created; provisioning may still be pending.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceKey"
                }
              }
            }
          },
          "default": {
            "description": "Failure. Inspect HTTP status, message/error, request ID and Retry-After.",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated correlation ID for support.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Access-Token": {
                "description": "Replacement session token, when automatically refreshed. Persist before the next request.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Suggested retry delay in seconds or an HTTP date. Never blindly retry a write.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-dcs-permission": "compute:configure",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "Credentials": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "writeOnly": true
          }
        },
        "required": [
          "email",
          "password"
        ]
      },
      "Session": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          }
        },
        "required": [
          "token"
        ]
      },
      "OrganisationSelection": {
        "type": "object",
        "properties": {
          "organisation_id": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "organisation_id"
        ]
      },
      "Membership": {
        "type": "object",
        "properties": {
          "organisation": {
            "type": "object",
            "properties": {
              "organisation_id": {
                "type": "integer",
                "minimum": 1
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "organisation_id",
              "name"
            ]
          },
          "role": {
            "type": "string"
          }
        },
        "required": [
          "organisation",
          "role"
        ]
      },
      "ResourceGroup": {
        "type": "object",
        "properties": {
          "resource_group_id": {
            "type": "integer",
            "minimum": 1
          },
          "organisation_id": {
            "type": "integer",
            "minimum": 1
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "resource_group_id",
          "organisation_id",
          "name"
        ]
      },
      "ResourceGroupInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "name"
        ]
      },
      "Network": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "organisation_id": {
            "type": "integer",
            "minimum": 1
          },
          "resource_group_id": {
            "type": "integer",
            "minimum": 1
          },
          "network_name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "organisation_id",
          "resource_group_id"
        ]
      },
      "NetworkInput": {
        "type": "object",
        "properties": {
          "network_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "network_name"
        ]
      },
      "Cluster": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "name": {
            "type": "string"
          },
          "organisation_id": {
            "type": "integer",
            "minimum": 1
          },
          "resource_group_id": {
            "type": "integer",
            "minimum": 1
          },
          "network_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "provisioning",
              "configuring",
              "active",
              "inactive",
              "error"
            ]
          },
          "provider": {
            "type": "string"
          },
          "has_kubeconfig": {
            "type": "boolean"
          },
          "status_message": {
            "type": "string"
          },
          "status_updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "organisation_id",
          "resource_group_id",
          "status"
        ]
      },
      "CreateCluster": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,46}[a-z0-9])?$",
            "maxLength": 48
          },
          "resource_group_id": {
            "type": "integer",
            "minimum": 1
          },
          "network_id": {
            "type": "integer",
            "minimum": 1
          },
          "node_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "default": 1
          }
        },
        "required": [
          "name",
          "resource_group_id",
          "network_id"
        ]
      },
      "ClusterConnection": {
        "type": "object",
        "properties": {
          "kubeconfig": {
            "type": "string"
          },
          "server": {
            "type": "string",
            "format": "uri"
          },
          "loginServer": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "kubeconfig",
          "server",
          "loginServer"
        ]
      },
      "DeviceKey": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "loginServer": {
            "type": "string"
          }
        },
        "required": [
          "key",
          "expiresAt",
          "loginServer"
        ]
      },
      "ComputeAllocation": {
        "type": "object",
        "properties": {
          "vms": {
            "type": "number",
            "minimum": 0
          },
          "containers": {
            "type": "number",
            "minimum": 0
          },
          "vcpus": {
            "type": "number",
            "minimum": 0
          },
          "memoryMiB": {
            "type": "number",
            "minimum": 0
          },
          "diskGiB": {
            "type": "number",
            "minimum": 0
          }
        },
        "required": [
          "vms",
          "containers",
          "vcpus",
          "memoryMiB",
          "diskGiB"
        ]
      },
      "ComputeLimits": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "usageComplete": {
            "type": "boolean"
          },
          "usage": {
            "$ref": "#/components/schemas/ComputeAllocation"
          },
          "limits": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ComputeAllocation"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "enabled",
          "usageComplete",
          "usage",
          "limits"
        ]
      }
    }
  }
}
