{
  "openapi": "3.1.0",
  "info": {
    "title": "Cloady API",
    "version": "0.9.1",
    "description": "Control-plane REST API for the Cloady PaaS. Authenticate with a `cldy_` token via `Authorization: Bearer`."
  },
  "servers": [
    {
      "url": "https://cloady.com"
    }
  ],
  "security": [
    {
      "cloady": []
    }
  ],
  "paths": {
    "/api/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Get the authenticated user",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateMe",
        "summary": "Update your name, avatar or account card (requires full scope)",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMeBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/regions": {
      "get": {
        "operationId": "listRegions",
        "summary": "List available regions",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "regions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Region"
                      }
                    }
                  },
                  "required": [
                    "regions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Check the control plane's database, registry and every ready region. Public: no token needed. Answers 503 when any check fails",
        "security": [],
        "parameters": [
          {
            "in": "query",
            "name": "component",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Degraded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        }
      }
    },
    "/api/ai": {
      "get": {
        "operationId": "getAiStatus",
        "summary": "Whether Ask AI is set up. Public: no token needed",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enabled": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "enabled"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "askAi",
        "summary": "Ask Cloady's AI a question",
        "description": "Public: without credentials a caller gets 7 answers a day per IP address. An API key or a signed-in session gets 60 an hour and answers about its own account, and can build: the AI writes files, uploads them and deploys them, which a `read`-scope key cannot. A key that isn't valid is refused rather than answered anonymously. `deploy` names a template, repository or image the answer suggests deploying. With `answer`, the question and that answer move into a new support ticket instead, which needs a signed-in caller, and the response is the ticket's `id`.",
        "security": [
          {},
          {
            "cloady": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AskAiBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AiAnswer"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        }
                      },
                      "required": [
                        "id"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many questions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "The AI did not answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Ask AI is not set up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/inspect": {
      "post": {
        "operationId": "inspectPublicSource",
        "summary": "Read a public GitHub repository, or a template, and preview what it would deploy. Public: no token needed",
        "description": "Answers 429 when GitHub's rate limit, shared by every caller, runs out. Signed in, use inspectSource.",
        "security": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicInspectBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PublicInspection"
                    },
                    {
                      "$ref": "#/components/schemas/Inspection"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/registry": {
      "get": {
        "operationId": "lookupImage",
        "summary": "Look up a public Docker image and the one-service compose file that runs it. Public: no token needed",
        "description": "Reads Docker Hub, ghcr.io, quay.io, gcr.io, public.ecr.aws, mcr.microsoft.com, registry.gitlab.com and lscr.io only. `image` is null when the image is not found.",
        "security": [],
        "parameters": [
          {
            "in": "query",
            "name": "ref",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "image": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/RegistryImage"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "image"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/dns": {
      "get": {
        "operationId": "checkDns",
        "summary": "The addresses a custom domain must point at and, with `host`, whether it already does and whether another app holds it. Public: no token needed",
        "security": [],
        "parameters": [
          {
            "in": "query",
            "name": "host",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainDns"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/support": {
      "post": {
        "operationId": "contactSupport",
        "summary": "Send a message to Cloady support without an account. Public: no token needed",
        "security": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/integrations/github/installations": {
      "get": {
        "operationId": "listGithubInstallations",
        "summary": "List the GitHub App installations your GitHub account can see",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "installations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GithubInstallation"
                      }
                    }
                  },
                  "required": [
                    "installations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces": {
      "get": {
        "operationId": "listWorkspaces",
        "summary": "List workspaces for the authenticated user",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspaces": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Workspace"
                      }
                    }
                  },
                  "required": [
                    "workspaces"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWorkspace",
        "summary": "Create a workspace (requires full scope)",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkspaceBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "$ref": "#/components/schemas/Workspace"
                    }
                  },
                  "required": [
                    "workspace"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}": {
      "get": {
        "operationId": "getWorkspace",
        "summary": "Get a workspace by slug",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "$ref": "#/components/schemas/Workspace"
                    }
                  },
                  "required": [
                    "workspace"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateWorkspace",
        "summary": "Update a workspace (requires full scope)",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWorkspaceBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "$ref": "#/components/schemas/Workspace"
                    }
                  },
                  "required": [
                    "workspace"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWorkspace",
        "summary": "Delete a workspace (requires full scope)",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/inspect": {
      "post": {
        "operationId": "inspectSource",
        "summary": "Inspect a source and preview its template",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source": {
                    "$ref": "#/components/schemas/Source"
                  },
                  "env": {
                    "$ref": "#/components/schemas/EnvId"
                  }
                },
                "required": [
                  "source"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Inspection"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/import/{provider}": {
      "post": {
        "operationId": "importFromProvider",
        "summary": "List importable units from a provider, or import one",
        "description": "Credentials are used for this call only and never stored. Without projectId the response is a listing of importable units; with projectId it is an import result whose source can be passed straight to deployApp.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "provider",
            "schema": {
              "$ref": "#/components/schemas/ImportProvider"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/uploads": {
      "post": {
        "operationId": "createUpload",
        "summary": "Upload project files to deploy",
        "description": "Send each file's path and content. The response's uploadId goes into deployApp or inspectSource as source { type: \"upload\", uploadId }. A single .zip file is taken as the whole project. Up to 3000 files and 50 MB; an upload that no app uses within an hour is deleted.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUploadBody"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary",
                      "contentEncoding": "binary"
                    },
                    "description": "One part per file"
                  },
                  "paths": {
                    "type": "string",
                    "description": "JSON array of each file's path inside the project, in the order of the file parts"
                  }
                },
                "required": [
                  "file",
                  "paths"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "uploadId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "files": {
                      "type": "number"
                    },
                    "size": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "uploadId",
                    "name",
                    "files",
                    "size"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/deploy": {
      "post": {
        "operationId": "deployApp",
        "summary": "Deploy an app from a git repository or upload",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeployAppBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "app": {
                      "$ref": "#/components/schemas/App"
                    }
                  },
                  "required": [
                    "app"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}": {
      "patch": {
        "operationId": "updateApp",
        "summary": "Update an app (name / status / version)",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAppBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "app": {
                      "$ref": "#/components/schemas/App"
                    }
                  },
                  "required": [
                    "app"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteApp",
        "summary": "Delete an app and purge its data",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/redeploy": {
      "post": {
        "operationId": "redeployApp",
        "summary": "Redeploy an app (refresh code + roll pods)",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "app": {
                      "$ref": "#/components/schemas/App"
                    }
                  },
                  "required": [
                    "app"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/ssh/session": {
      "get": {
        "operationId": "getSshSession",
        "summary": "Get the SSH credential for a running container: the GET form of createSshSession",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "component",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SshSession"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSshSession",
        "summary": "Create a short-lived SSH session credential for a running container",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SshSessionBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SshSession"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/exec": {
      "post": {
        "operationId": "execCommand",
        "summary": "Run a one-off shell command in a running container (kubernetes exec)",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/backups": {
      "get": {
        "operationId": "listBackups",
        "summary": "List an app's backups and its backup settings",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackupState"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateBackups",
        "summary": "Turn managed backups on or off and set the daily window",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBackupsBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackupState"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/backups/{backupId}/restore": {
      "post": {
        "operationId": "restoreBackup",
        "summary": "Restore an app's volumes from a backup",
        "description": "Overwrites the app's current volume contents with the snapshot. There is no undo.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "backupId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/branches": {
      "get": {
        "operationId": "listBranches",
        "summary": "List the git branches available to an app",
        "description": "Fetched live from GitHub; empty for apps whose source is not git. `current` is the branch the app deploys from.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Branches"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/deploys/{deployId}/rollback": {
      "post": {
        "operationId": "rollbackDeploy",
        "summary": "Roll an app back to a previous deploy's image",
        "description": "Needs a running, build-backed app whose target image is still in the registry. Restarts every service in the instance, database included.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "deployId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deploy": {
                      "$ref": "#/components/schemas/Deploy"
                    }
                  },
                  "required": [
                    "deploy"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/keys": {
      "get": {
        "operationId": "getVolumeKeys",
        "summary": "Get S3 and SFTP credentials for one volume or service filesystem",
        "description": "Derived, not stored, so they are stable and need no rotation step. `volume` is a name from listVolumes; `kind` selects a persistent volume (default) or a service filesystem.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "volume",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "$ref": "#/components/schemas/MountKind"
            }
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolumeKeys"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/db/credentials": {
      "get": {
        "operationId": "getDbCredentials",
        "summary": "Get the connection credentials for a database component",
        "description": "Read from the running pod's resolved environment at call time, so the container is the source of truth rather than the template. `component` is a compose service running a database.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "component",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DbCredentials"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/db/schema": {
      "get": {
        "operationId": "getDbSchema",
        "summary": "List a database component's schemas and tables",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "component",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "schema",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DbSchema"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/db/query": {
      "post": {
        "operationId": "runDbQuery",
        "summary": "Run a query against a database component",
        "description": "Runs over a real protocol driver, not a shell, and executes whatever is sent — including writes and DDL. Redis and MongoDB take their own command syntax rather than SQL.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DbQueryBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DbQueryResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/git": {
      "get": {
        "operationId": "getGitOverview",
        "summary": "Read the working tree of a development app: branch, changes and recent commits",
        "description": "Reads the repository inside the running container by pod exec, so it is ground truth rather than the deploy record. Returns `{ok:false, reason}` when the app has no repo, no pod, or no git.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitOverview"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "runGitAction",
        "summary": "Act on a development app's repository",
        "description": "One action per call: discard, stage, unstage, commit, checkout, merge, rebase, revert, cherry, pull or push. Commits live in the container and die with it unless pushed.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitActionBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitOverview"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/git/diff": {
      "get": {
        "operationId": "getGitDiff",
        "summary": "Read a patch from a development app's repository",
        "description": "With no `sha`, diffs the working tree. `path` narrows it to one file. Large patches come back with `truncated: true`.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "sha",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitPatch"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/status": {
      "get": {
        "operationId": "streamAppStatus",
        "summary": "Read an app's live status: per-service state, capacity waits, in-flight deploy",
        "description": "Returns one status frame. Sending `Accept: text/event-stream` instead follows the status live, a frame every five seconds, which never completes on its own.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFrame"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/metrics": {
      "get": {
        "operationId": "streamAppMetrics",
        "summary": "Read an app's CPU, memory, disk and network usage",
        "description": "Returns one metrics reading; `network` and `requestsPerSec` are null until a second sample exists, so they are null on a one-shot read. Sending `Accept: text/event-stream` instead follows usage live, a frame every five seconds, which never completes on its own.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstanceMetrics"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/deploys/active": {
      "get": {
        "operationId": "streamActiveDeploy",
        "summary": "Read the app's in-flight deploy, or its latest when none is running",
        "description": "Returns one `{ts, deploy}` frame: the active deploy if one is running, otherwise the most recent, and `deploy` is null when the app has never deployed. Sending `Accept: text/event-stream` instead follows it live, a frame every two seconds, closing after one terminal frame.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActiveDeployFrame"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/deploys/{deployId}/logs": {
      "get": {
        "operationId": "streamDeployLogs",
        "summary": "Read a deploy's build log",
        "description": "Returns one `{kind:\"snapshot\", log, status}` frame — the whole log so far, not a delta: the stored log for a finished deploy, the live build pod's log for the in-flight one. Sending `Accept: text/event-stream` instead re-sends a growing snapshot every two seconds; a finished deploy sends one frame and closes, the in-flight one keeps the connection open after it ends, so close it yourself once a frame carries `final: true`.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "deployId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeployLogSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/deploys": {
      "get": {
        "operationId": "listDeploys",
        "summary": "List an app's deploys",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deploys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Deploy"
                      }
                    }
                  },
                  "required": [
                    "deploys"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/vars": {
      "get": {
        "operationId": "listVars",
        "summary": "List environment variables and credentials for an app",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "vars": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Var"
                      }
                    }
                  },
                  "required": [
                    "vars"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createVar",
        "summary": "Create a new environment variable or credential",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVarBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "var": {
                      "$ref": "#/components/schemas/Var"
                    }
                  },
                  "required": [
                    "var"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/vars/import": {
      "post": {
        "operationId": "importVars",
        "summary": "Bulk-create environment variables, skipping keys already set",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportVarsBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportVarsResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/vars/{varId}": {
      "patch": {
        "operationId": "updateVar",
        "summary": "Update an environment variable or credential value",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "varId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateVarBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "var": {
                      "$ref": "#/components/schemas/Var"
                    }
                  },
                  "required": [
                    "var"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteVar",
        "summary": "Delete an environment variable or credential",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "varId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/vars/{varId}/reveal": {
      "get": {
        "operationId": "revealVar",
        "summary": "Reveal the decrypted value of a secret variable",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "varId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "value"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/domains": {
      "get": {
        "operationId": "listAppDomains",
        "summary": "List all domains for an app in a workspace",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domains": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Domain"
                      }
                    }
                  },
                  "required": [
                    "domains"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createDomain",
        "summary": "Create a new domain for an app",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDomainBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "$ref": "#/components/schemas/Domain"
                    }
                  },
                  "required": [
                    "domain"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/domains/{domainId}": {
      "patch": {
        "operationId": "updateDomain",
        "summary": "Update a domain configuration",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "domainId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDomainBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "$ref": "#/components/schemas/Domain"
                    }
                  },
                  "required": [
                    "domain"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteDomain",
        "summary": "Delete a domain from an app",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "domainId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/domains/certs": {
      "get": {
        "operationId": "listCertStatuses",
        "summary": "List TLS certificate statuses for app domains",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "certs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CertStatus"
                      }
                    }
                  },
                  "required": [
                    "certs"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/services/{serviceName}/logs": {
      "get": {
        "operationId": "readServiceLogs",
        "summary": "Read a container's recent logs",
        "description": "Returns the last 200 log lines of one container as `{container, state, logs}`; `state` is `no-pod` when nothing is running. `serviceName` is a compose service. Sending `Accept: text/event-stream` instead follows the log live as server-sent events, one bare `data:` frame per line, which never completes on its own.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "serviceName",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceLogs"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/services": {
      "get": {
        "operationId": "getAppServices",
        "summary": "List all services in an app instance",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "services": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ComponentService"
                      }
                    }
                  },
                  "required": [
                    "services"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/deploy": {
      "post": {
        "operationId": "createAppDeploy",
        "summary": "Trigger a new deployment for an app",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDeployBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deploy": {
                      "$ref": "#/components/schemas/Deploy"
                    }
                  },
                  "required": [
                    "deploy"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/volumes": {
      "get": {
        "operationId": "listVolumes",
        "summary": "List an app's volumes and service filesystems",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "volumes": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/VolumeInfo"
                      }
                    }
                  },
                  "required": [
                    "volumes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/apps/{appSlug}/transfer": {
      "post": {
        "operationId": "transferApp",
        "summary": "Transfer an app to another workspace",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "appSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferAppBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "app": {
                      "$ref": "#/components/schemas/App"
                    },
                    "targetWorkspaceSlug": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "app",
                    "targetWorkspaceSlug"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/billing": {
      "get": {
        "operationId": "getWorkspaceBilling",
        "summary": "Get workspace billing info",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "billing": {
                      "$ref": "#/components/schemas/WorkspaceBilling"
                    }
                  },
                  "required": [
                    "billing"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/members": {
      "get": {
        "operationId": "listWorkspaceMembers",
        "summary": "List workspace members",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "members": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Member"
                      }
                    },
                    "viewerRole": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "admin",
                        "developer",
                        "viewer"
                      ]
                    }
                  },
                  "required": [
                    "members",
                    "viewerRole"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/invitations": {
      "get": {
        "operationId": "listWorkspaceInvitations",
        "summary": "List pending workspace invitations",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invitations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Invitation"
                      }
                    }
                  },
                  "required": [
                    "invitations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWorkspaceInvitation",
        "summary": "Send workspace invitation",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvitationBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invitation": {
                      "$ref": "#/components/schemas/Invitation"
                    },
                    "emailDelivered": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "invitation",
                    "emailDelivered"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/invitations/{invitationId}": {
      "delete": {
        "operationId": "revokeWorkspaceInvitation",
        "summary": "Revoke workspace invitation",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "invitationId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/transfer": {
      "post": {
        "operationId": "transferWorkspaceOwnership",
        "summary": "Transfer workspace ownership",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferWorkspaceBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Workspace"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "needsPayment": {
                      "type": "boolean"
                    },
                    "checkoutUrl": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "workspace"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/domains": {
      "get": {
        "operationId": "listWorkspaceDomains",
        "summary": "List all domains in workspace",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domains": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Domain"
                      }
                    }
                  },
                  "required": [
                    "domains"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/volumes": {
      "get": {
        "operationId": "listWorkspaceVolumes",
        "summary": "List a workspace's volumes and service filesystems",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "env",
            "schema": {
              "$ref": "#/components/schemas/EnvId"
            }
          },
          {
            "in": "query",
            "name": "region",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "volumes": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkspaceVolume"
                      }
                    }
                  },
                  "required": [
                    "volumes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/integrations": {
      "get": {
        "operationId": "listWorkspaceIntegrations",
        "summary": "List workspace integrations and provider status",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "integrations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GithubIntegration"
                      }
                    },
                    "providers": {
                      "type": "object",
                      "properties": {
                        "github": {
                          "type": "object",
                          "properties": {
                            "configured": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "configured"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "github"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "integrations",
                    "providers"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/sso": {
      "get": {
        "operationId": "getWorkspaceSso",
        "summary": "Read the workspace's single sign-on connection",
        "description": "`redirectUri` is what to register at the provider; `txtValue` is the TXT record the domain needs at `_cloady.<domain>` before it can be saved.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sso": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/SsoConnection"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "redirectUri": {
                      "type": "string"
                    },
                    "txtValue": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "sso",
                    "redirectUri",
                    "txtValue"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setWorkspaceSso",
        "summary": "Connect an OpenID Connect identity provider for single sign-on",
        "description": "Refuses a domain whose `_cloady.<domain>` TXT record doesn't carry the workspace's `txtValue` yet, so a saved connection is always live. Anyone the provider signs in with an email at the domain joins the workspace as a developer. Omit `clientSecret` to keep the stored one. Requires admin.",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveSsoBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sso": {
                      "$ref": "#/components/schemas/SsoConnection"
                    }
                  },
                  "required": [
                    "sso"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWorkspaceSso",
        "summary": "Remove single sign-on from the workspace",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/integrations/github": {
      "post": {
        "operationId": "linkGithubIntegration",
        "summary": "Link GitHub installation to workspace",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkGithubBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "integration": {
                      "$ref": "#/components/schemas/GithubIntegration"
                    }
                  },
                  "required": [
                    "integration"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "disconnectGithubIntegration",
        "summary": "Disconnect GitHub integration from workspace",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/workspaces/{workspaceSlug}/integrations/github/repos": {
      "get": {
        "operationId": "listGithubRepos",
        "summary": "Search GitHub repositories",
        "parameters": [
          {
            "in": "path",
            "name": "workspaceSlug",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "installationId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "repos": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GithubRepo"
                      }
                    },
                    "totalAvailable": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "repos",
                    "totalAvailable"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/tokens": {
      "get": {
        "operationId": "listTokens",
        "summary": "List the authenticated user's API tokens",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tokens": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TokenView"
                      }
                    }
                  },
                  "required": [
                    "tokens"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createToken",
        "summary": "Create a new API token for the current user",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTokenBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "$ref": "#/components/schemas/TokenView"
                    },
                    "secret": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token",
                    "secret"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/tokens/{id}": {
      "delete": {
        "operationId": "revokeToken",
        "summary": "Revoke an API token",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/billing": {
      "get": {
        "operationId": "getAccountBilling",
        "summary": "Get account billing information including payment methods and invoices",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "billing": {
                      "$ref": "#/components/schemas/AccountBilling"
                    }
                  },
                  "required": [
                    "billing"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/billing/payment-method": {
      "post": {
        "operationId": "startCardSetup",
        "summary": "Create a SetupIntent for saving a card with the inline payment element",
        "description": "Returns a `clientSecret` that Stripe's payment element exchanges for a saved card in the browser. The secret alone cannot charge anything or read existing cards, and it is scoped to the caller's own Stripe customer.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "clientSecret": {
                      "type": "string"
                    },
                    "publishableKey": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "clientSecret",
                    "publishableKey"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Billing not configured",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/billing-state": {
      "get": {
        "operationId": "getUserBillingState",
        "summary": "Get the account's shared free allowance and payment method status",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserBillingState"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/notifications": {
      "get": {
        "operationId": "getNotificationPreferences",
        "summary": "Get notification preferences for the current user",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "prefs": {
                      "$ref": "#/components/schemas/NotificationPrefs"
                    }
                  },
                  "required": [
                    "prefs"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateNotificationPreferences",
        "summary": "Update notification preferences for the current user",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNotificationPrefsBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "prefs": {
                      "$ref": "#/components/schemas/NotificationPrefs"
                    }
                  },
                  "required": [
                    "prefs"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/security": {
      "get": {
        "operationId": "getSecurityState",
        "summary": "Read the account's phone and two-factor state",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecurityState"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/tickets": {
      "get": {
        "operationId": "listTickets",
        "summary": "List support tickets for the current user",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tickets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TicketSummary"
                      }
                    }
                  },
                  "required": [
                    "tickets"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTicket",
        "summary": "Create a new support ticket",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTicketBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ticket": {
                      "$ref": "#/components/schemas/Ticket"
                    }
                  },
                  "required": [
                    "ticket"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/tickets/{id}": {
      "get": {
        "operationId": "getTicket",
        "summary": "Get a single support ticket with all messages",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ticket": {
                      "$ref": "#/components/schemas/Ticket"
                    }
                  },
                  "required": [
                    "ticket"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateTicket",
        "summary": "Update ticket status or mark as read",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTicketBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/tickets/{id}/messages": {
      "post": {
        "operationId": "addTicketMessage",
        "summary": "Add a message to a support ticket",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddTicketMessageBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "$ref": "#/components/schemas/TicketMessage"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/security/phone": {
      "post": {
        "operationId": "startPhoneVerification",
        "summary": "Send a verification code to a phone number",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartPhoneBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "verifyPhone",
        "summary": "Confirm a phone number with the code that was sent",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyPhoneBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "phone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "phone"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "setMfa",
        "summary": "Turn two-factor sign-in on or off",
        "description": "Enabling it requires a verified phone number.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "mfaEnabled": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "mfaEnabled"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/tickets/{id}/stream": {
      "get": {
        "operationId": "streamTicketMessages",
        "summary": "Read a ticket's status and full message list",
        "description": "Returns one frame. Sending `Accept: text/event-stream` instead follows the thread live, every 2.5 seconds, which stops only when the ticket disappears.",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketThread"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/slug-check": {
      "get": {
        "operationId": "checkWorkspaceSlug",
        "summary": "Resolve a workspace slug to one that is free",
        "description": "Returns the slug that would actually be used; `suffixed` is true when the requested one was taken and a numeric suffix was added.",
        "parameters": [
          {
            "in": "query",
            "name": "slug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlugCheck"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/templates": {
      "get": {
        "operationId": "listTemplates",
        "summary": "Search, filter, sort and page the template catalog. Public: no token needed. `total` counts every match, and `categories` counts the matches in each category with every other filter applied. Omit `limit` for every match",
        "security": [],
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "in": "query",
            "name": "category",
            "schema": {
              "type": "string",
              "maxLength": 60
            }
          },
          {
            "in": "query",
            "name": "price",
            "schema": {
              "type": "string",
              "enum": [
                "free",
                "paid"
              ]
            }
          },
          {
            "in": "query",
            "name": "maxPrice",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "in": "query",
            "name": "minRating",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 5
            }
          },
          {
            "in": "query",
            "name": "singleService",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "withDatabase",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "updatedThisWeek",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "schema": {
              "default": "popular",
              "$ref": "#/components/schemas/TemplateSort"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateList"
                }
              }
            }
          }
        }
      }
    },
    "/api/templates/{slug}/review": {
      "put": {
        "operationId": "reviewTemplate",
        "summary": "Rate and review a template (one review per account; sending again replaces it)",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateReviewBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "review": {
                      "$ref": "#/components/schemas/TemplateReview"
                    }
                  },
                  "required": [
                    "review"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTemplateReview",
        "summary": "Delete your review of a template",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/pricing": {
      "get": {
        "operationId": "getPricing",
        "summary": "Get public resource pricing and the free allowance",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pricing": {
                      "$ref": "#/components/schemas/Pricing"
                    }
                  },
                  "required": [
                    "pricing"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/invitations/{token}": {
      "get": {
        "operationId": "getInvitation",
        "summary": "Get invitation details by token",
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invitation": {
                      "$ref": "#/components/schemas/InvitationDetail"
                    }
                  },
                  "required": [
                    "invitation"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/invitations/{token}/accept": {
      "post": {
        "operationId": "acceptInvitation",
        "summary": "Accept a workspace invitation",
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspaceSlug": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "workspaceSlug"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/invitations/{token}/decline": {
      "post": {
        "operationId": "declineInvitation",
        "summary": "Decline a workspace invitation",
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "UpdateMeBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "image": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 300000,
                "pattern": "^data:image\\/(png|jpe?g|webp|gif);base64,[A-Za-z0-9+/=]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentMethodId": {
            "description": "A card from startCardSetup becomes the account card; null removes it",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255,
                "pattern": "^pm_"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "AskAiBody": {
        "type": "object",
        "properties": {
          "q": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "workspace": {
            "type": "string",
            "pattern": "^[a-z0-9-]{1,63}$"
          },
          "answer": {
            "description": "An earlier answer to this question: moves both into a new support ticket instead of asking again, and needs a signed-in caller",
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          }
        },
        "required": [
          "q"
        ]
      },
      "PublicInspectBody": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "repoUrl": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "token": {
                "description": "A GitHub token of your own, to read a private repository",
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              }
            },
            "required": [
              "repoUrl"
            ]
          },
          {
            "type": "object",
            "properties": {
              "template": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "required": [
              "template"
            ]
          }
        ]
      },
      "ContactBody": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "subject": {
            "type": "string",
            "maxLength": 160
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          },
          "website": {
            "description": "Leave empty: a filled value is treated as spam and dropped",
            "type": "string"
          }
        },
        "required": [
          "email",
          "message"
        ]
      },
      "CreateWorkspaceBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "slug": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          },
          "hues": {
            "type": "array",
            "prefixItems": [
              {
                "type": "integer",
                "minimum": 0,
                "exclusiveMaximum": 360
              },
              {
                "type": "integer",
                "minimum": 0,
                "exclusiveMaximum": 360
              }
            ]
          },
          "iconUrl": {
            "type": "string",
            "maxLength": 8000000
          }
        },
        "required": [
          "name",
          "slug",
          "hues"
        ]
      },
      "UpdateWorkspaceBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "slug": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          },
          "hues": {
            "type": "array",
            "prefixItems": [
              {
                "type": "integer",
                "minimum": 0,
                "exclusiveMaximum": 360
              },
              {
                "type": "integer",
                "minimum": 0,
                "exclusiveMaximum": 360
              }
            ]
          },
          "iconUrl": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 8000000
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentMethodId": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255,
                "pattern": "^pm_"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Source": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "git"
              },
              "repoUrl": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "branch": {
                "type": "string",
                "maxLength": 255
              },
              "subdir": {
                "type": "string",
                "maxLength": 255
              },
              "autoDeploy": {
                "type": "boolean"
              },
              "branchTracking": {
                "$ref": "#/components/schemas/BranchTracking"
              },
              "profiles": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                }
              }
            },
            "required": [
              "type",
              "repoUrl"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "upload"
              },
              "uploadId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "subdir": {
                "type": "string",
                "maxLength": 255
              },
              "profiles": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                }
              }
            },
            "required": [
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "catalog"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "profiles": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                }
              }
            },
            "required": [
              "type",
              "name"
            ]
          }
        ],
        "type": "object"
      },
      "BranchTracking": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "all",
              "match"
            ]
          },
          "pattern": {
            "type": "string",
            "maxLength": 255
          }
        },
        "required": [
          "mode"
        ]
      },
      "EnvId": {
        "type": "string",
        "enum": [
          "production",
          "preview",
          "development"
        ]
      },
      "ImportProvider": {
        "type": "string",
        "enum": [
          "railway",
          "render",
          "vercel"
        ]
      },
      "ImportBody": {
        "type": "object",
        "properties": {
          "credentials": {
            "$ref": "#/components/schemas/ImportCredentials"
          },
          "projectId": {
            "description": "Absent lists importable units; present imports that unit (an ImportUnit.id)",
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "env": {
            "$ref": "#/components/schemas/EnvId"
          }
        },
        "required": [
          "credentials"
        ]
      },
      "ImportCredentials": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096,
            "description": "One-shot: used for this call only, never stored. Use the narrowest token the provider offers - a Railway project token, a Vercel token scoped to one team with an expiry; Render keys are account-wide."
          },
          "scope": {
            "description": "Railway workspace id, Render owner id (usr-/tea-), or Vercel team id or slug",
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "token"
        ]
      },
      "CreateUploadBody": {
        "type": "object",
        "properties": {
          "files": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024,
                  "description": "Path inside the project, e.g. public/index.html"
                },
                "content": {
                  "type": "string"
                },
                "encoding": {
                  "default": "utf8",
                  "description": "base64 for binary files",
                  "type": "string",
                  "enum": [
                    "utf8",
                    "base64"
                  ]
                }
              },
              "required": [
                "path",
                "content"
              ]
            }
          }
        },
        "required": [
          "files"
        ]
      },
      "DeployAppBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "region": {
            "type": "string",
            "minLength": 1
          },
          "env": {
            "$ref": "#/components/schemas/EnvId"
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "port": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 65535
          },
          "values": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "secretKeys": {
            "description": "Keys in values to store encrypted whatever the source's own env schema says - an import's secret decisions ride here because the deploy re-inspects the source",
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          "buildCmd": {
            "type": "string",
            "maxLength": 2000
          },
          "startCmd": {
            "type": "string",
            "maxLength": 2000
          },
          "autoDeploy": {
            "type": "boolean"
          },
          "scale": {
            "$ref": "#/components/schemas/ScaleBody"
          },
          "backups": {
            "description": "Managed backups enabled",
            "type": "boolean"
          }
        },
        "required": [
          "region",
          "source"
        ]
      },
      "ScaleBody": {
        "type": "object",
        "properties": {
          "cpu": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 4,
            "multipleOf": 0.25
          },
          "memory": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 4,
            "multipleOf": 0.25
          },
          "volumes": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 30
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1024
            }
          }
        },
        "required": [
          "cpu",
          "memory"
        ]
      },
      "UpdateAppBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 24,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "degraded",
              "stopped",
              "error"
            ]
          },
          "branch": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "tracking": {
            "$ref": "#/components/schemas/BranchTracking"
          },
          "autoDeploy": {
            "type": "boolean"
          },
          "scale": {
            "$ref": "#/components/schemas/ScaleBody"
          }
        }
      },
      "SshSessionBody": {
        "type": "object",
        "properties": {
          "component": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "component"
        ]
      },
      "ExecBody": {
        "type": "object",
        "properties": {
          "component": {
            "type": "string",
            "minLength": 1
          },
          "command": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100000
          },
          "cwd": {
            "type": "string",
            "maxLength": 4096
          },
          "stdin": {
            "type": "string",
            "maxLength": 1048576
          },
          "timeoutMs": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 300000
          }
        },
        "required": [
          "component",
          "command"
        ]
      },
      "UpdateBackupsBody": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "window": {
            "type": "string",
            "enum": [
              "12",
              "16",
              "20",
              "auto",
              "00",
              "04",
              "08"
            ]
          }
        }
      },
      "MountKind": {
        "type": "string",
        "enum": [
          "service",
          "volume"
        ]
      },
      "DbQueryBody": {
        "type": "object",
        "properties": {
          "component": {
            "type": "string",
            "minLength": 1
          },
          "sql": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100000
          },
          "schema": {
            "type": "string"
          }
        },
        "required": [
          "component",
          "sql"
        ]
      },
      "GitActionBody": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "discard"
              },
              "paths": {
                "minItems": 1,
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "action",
              "paths"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "commit"
              },
              "message": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4000
              },
              "paths": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "action",
              "message"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "checkout"
              },
              "branch": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              },
              "create": {
                "type": "boolean"
              }
            },
            "required": [
              "action",
              "branch"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "stage"
              },
              "paths": {
                "minItems": 1,
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "action",
              "paths"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "unstage"
              },
              "paths": {
                "minItems": 1,
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "action",
              "paths"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "merge"
              },
              "branch": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              }
            },
            "required": [
              "action",
              "branch"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "rebase"
              },
              "branch": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              }
            },
            "required": [
              "action",
              "branch"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "revert"
              },
              "sha": {
                "type": "string",
                "minLength": 4,
                "maxLength": 40
              }
            },
            "required": [
              "action",
              "sha"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "cherry"
              },
              "sha": {
                "type": "string",
                "minLength": 4,
                "maxLength": 40
              }
            },
            "required": [
              "action",
              "sha"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "pull"
              }
            },
            "required": [
              "action"
            ]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "const": "push"
              }
            },
            "required": [
              "action"
            ]
          }
        ],
        "type": "object"
      },
      "CreateVarBody": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "maxLength": 80,
            "pattern": "^[A-Z_][A-Z0-9_]*$"
          },
          "value": {
            "type": "string",
            "maxLength": 4096
          },
          "isSecret": {
            "type": "boolean"
          }
        },
        "required": [
          "key",
          "value"
        ]
      },
      "ImportVarsBody": {
        "type": "object",
        "properties": {
          "entries": {
            "minItems": 1,
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "maxLength": 80
                },
                "value": {
                  "type": "string",
                  "maxLength": 4096
                },
                "isSecret": {
                  "type": "boolean"
                }
              },
              "required": [
                "key",
                "value"
              ]
            }
          }
        },
        "required": [
          "entries"
        ]
      },
      "UpdateVarBody": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "maxLength": 4096
          },
          "isSecret": {
            "type": "boolean"
          }
        }
      },
      "CreateDomainBody": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,}$"
          },
          "isPrimary": {
            "type": "boolean"
          },
          "redirectTo": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "port": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 65535
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "host"
        ]
      },
      "UpdateDomainBody": {
        "type": "object",
        "properties": {
          "redirectTo": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "CreateDeployBody": {
        "type": "object",
        "properties": {
          "commitMsg": {
            "type": "string",
            "maxLength": 2000
          },
          "sha": {
            "type": "string",
            "maxLength": 64
          },
          "author": {
            "type": "string",
            "maxLength": 80
          }
        }
      },
      "TransferAppBody": {
        "type": "object",
        "properties": {
          "targetWorkspaceSlug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "region": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          }
        },
        "required": [
          "targetWorkspaceSlug"
        ]
      },
      "CreateInvitationBody": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "developer",
              "viewer"
            ]
          }
        },
        "required": [
          "email"
        ]
      },
      "TransferWorkspaceBody": {
        "type": "object",
        "properties": {
          "targetUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "required": [
          "targetUserId"
        ]
      },
      "SaveSsoBody": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string",
            "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,}$"
          },
          "issuer": {
            "type": "string",
            "format": "uri"
          },
          "clientId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "clientSecret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          }
        },
        "required": [
          "domain",
          "issuer",
          "clientId"
        ]
      },
      "LinkGithubBody": {
        "type": "object",
        "properties": {
          "installationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          }
        },
        "required": [
          "installationId"
        ]
      },
      "CreateTokenBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "scope": {
            "default": "full",
            "$ref": "#/components/schemas/TokenScope"
          },
          "expires": {
            "default": "never",
            "type": "string",
            "enum": [
              "never",
              "30d",
              "90d",
              "1y"
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "TokenScope": {
        "type": "string",
        "enum": [
          "full",
          "deploy",
          "read"
        ]
      },
      "UpdateNotificationPrefsBody": {
        "type": "object",
        "properties": {
          "deploys": {
            "description": "Deploy result emails: off, failures only, failures plus the deploy that fixes one, or every deploy. An app's first live deploy is always emailed",
            "$ref": "#/components/schemas/DeployEmails"
          },
          "tickets": {
            "type": "boolean"
          },
          "replies": {
            "type": "boolean"
          },
          "incidents": {
            "type": "boolean"
          },
          "billing": {
            "type": "boolean"
          },
          "weekly": {
            "type": "boolean"
          },
          "product": {
            "type": "boolean"
          }
        }
      },
      "DeployEmails": {
        "type": "string",
        "enum": [
          "off",
          "failures",
          "fixes",
          "all"
        ]
      },
      "CreateTicketBody": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "topic": {
            "default": "general",
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          }
        },
        "required": [
          "subject",
          "body"
        ]
      },
      "UpdateTicketBody": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "read": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "AddTicketMessageBody": {
        "type": "object",
        "properties": {
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          }
        },
        "required": [
          "body"
        ]
      },
      "StartPhoneBody": {
        "type": "object",
        "properties": {
          "phone": {
            "type": "string",
            "minLength": 7,
            "maxLength": 20
          }
        },
        "required": [
          "phone"
        ]
      },
      "VerifyPhoneBody": {
        "type": "object",
        "properties": {
          "phone": {
            "type": "string",
            "minLength": 7,
            "maxLength": 20
          },
          "code": {
            "type": "string",
            "minLength": 6,
            "maxLength": 6,
            "pattern": "^\\d{6}$"
          }
        },
        "required": [
          "phone",
          "code"
        ]
      },
      "MfaBody": {
        "type": "object",
        "properties": {
          "mfaEnabled": {
            "type": "boolean"
          }
        },
        "required": [
          "mfaEnabled"
        ]
      },
      "TemplateSort": {
        "type": "string",
        "enum": [
          "popular",
          "rating",
          "updated",
          "price",
          "name"
        ]
      },
      "TemplateReviewBody": {
        "type": "object",
        "properties": {
          "rating": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "body": {
            "default": "",
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "rating"
        ]
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "image": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "email",
          "name",
          "image"
        ],
        "additionalProperties": false
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            ]
          },
          "code": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Region": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "flag": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "ipv4": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "ipv6": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "code",
          "country",
          "flag",
          "status",
          "timezone",
          "ipv4",
          "ipv6"
        ],
        "additionalProperties": false
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "degraded"
            ]
          },
          "phoneGate": {
            "type": "boolean"
          },
          "components": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "ok": {
                  "type": "boolean"
                },
                "ms": {
                  "type": "number"
                }
              },
              "required": [
                "ok",
                "ms"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "status",
          "phoneGate",
          "components"
        ],
        "additionalProperties": false
      },
      "AiAnswer": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string"
          },
          "deploy": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "answer",
          "deploy"
        ],
        "additionalProperties": false
      },
      "PublicInspection": {
        "type": "object",
        "properties": {
          "owner": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "defaultBranch": {
            "type": "string"
          },
          "hasDockerfile": {
            "type": "boolean"
          },
          "deployable": {
            "type": "boolean"
          },
          "template": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppTemplate"
              },
              {
                "type": "null"
              }
            ]
          },
          "templateFile": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "templateError": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "envSchema": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppEnvSchema"
              },
              {
                "type": "null"
              }
            ]
          },
          "profileSchema": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppProfileSchema"
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "private_or_missing"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "owner",
          "repo",
          "defaultBranch",
          "hasDockerfile",
          "deployable",
          "template",
          "templateFile",
          "templateError",
          "envSchema",
          "profileSchema",
          "reason"
        ],
        "additionalProperties": false
      },
      "AppTemplate": {
        "type": "object",
        "properties": {
          "services": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,29}$"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "image": {
                  "type": "string"
                },
                "build": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "context": {
                          "type": "string"
                        },
                        "dockerfile": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                },
                "entrypoint": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ]
                },
                "command": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ]
                },
                "environment": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          },
                          {
                            "type": "boolean"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ]
                },
                "env_file": {
                  "anyOf": [
                    {
                      "type": "string",
                      "const": ".env"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "const": ".env"
                      }
                    }
                  ]
                },
                "ports": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 65535
                      },
                      {
                        "type": "string",
                        "pattern": "^\\d+(:\\d+)?(\\/(tcp|udp))?$"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "target": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 65535
                              },
                              {
                                "type": "string",
                                "pattern": "^\\d+$"
                              }
                            ]
                          },
                          "published": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 65535
                              },
                              {
                                "type": "string",
                                "pattern": "^\\d+$"
                              }
                            ]
                          },
                          "protocol": {
                            "type": "string",
                            "enum": [
                              "tcp",
                              "udp"
                            ]
                          },
                          "mode": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "target"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "expose": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 65535
                      },
                      {
                        "type": "string",
                        "pattern": "^\\d+(\\/(tcp|udp))?$"
                      }
                    ]
                  }
                },
                "volumes": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9-]{0,29}:\\/[^:]*(:[A-Za-z,]+)?$"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "volume"
                          },
                          "source": {
                            "type": "string",
                            "pattern": "^[a-z0-9][a-z0-9-]{0,29}$"
                          },
                          "target": {
                            "type": "string",
                            "pattern": "^\\/"
                          },
                          "read_only": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "source",
                          "target"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "healthcheck": {
                  "type": "object",
                  "properties": {
                    "test": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ]
                    },
                    "interval": {
                      "type": "string",
                      "pattern": "^\\d+(\\.\\d+)?(ns|us|ms|s|m|h)$"
                    },
                    "timeout": {
                      "type": "string",
                      "pattern": "^\\d+(\\.\\d+)?(ns|us|ms|s|m|h)$"
                    },
                    "start_period": {
                      "type": "string",
                      "pattern": "^\\d+(\\.\\d+)?(ns|us|ms|s|m|h)$"
                    },
                    "retries": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 50
                    },
                    "disable": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                },
                "configs": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string"
                          },
                          "target": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "source",
                          "target"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "depends_on": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "condition": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  ]
                },
                "deploy": {
                  "type": "object",
                  "properties": {
                    "replicas": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 20
                    },
                    "resources": {
                      "type": "object",
                      "properties": {
                        "reservations": {
                          "type": "object",
                          "properties": {
                            "cpus": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "memory": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "limits": {
                          "type": "object",
                          "properties": {
                            "cpus": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "memory": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                },
                "profiles": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                  }
                }
              },
              "additionalProperties": false
            }
          },
          "volumes": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,29}$"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "object",
                  "properties": {
                    "driver_opts": {
                      "type": "object",
                      "properties": {
                        "size": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              ]
            }
          },
          "configs": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "content": {
                  "type": "string"
                },
                "file": {
                  "type": "string",
                  "pattern": "^(\\.\\/)?(?!\\.\\.)[^\\0]*$"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "required": [
          "services"
        ],
        "additionalProperties": false
      },
      "AppEnvSchema": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string",
                "number",
                "boolean"
              ]
            },
            "title": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "default": {},
            "enum": {
              "type": "array",
              "items": {}
            },
            "secret": {
              "type": "boolean"
            },
            "generate": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "AppProfileSchema": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "object",
          "properties": {
            "title": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "type": {
              "anyOf": [
                {
                  "type": "string",
                  "const": "string"
                },
                {
                  "type": "array",
                  "prefixItems": [
                    {
                      "type": "string",
                      "const": "string"
                    },
                    {
                      "type": "string",
                      "const": "null"
                    }
                  ]
                },
                {
                  "type": "string",
                  "const": "array"
                }
              ]
            },
            "enum": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
              }
            },
            "items": {
              "type": "object",
              "properties": {
                "enum": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                  }
                }
              },
              "required": [
                "enum"
              ],
              "additionalProperties": false
            },
            "default": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                },
                {
                  "type": "null"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                  }
                }
              ]
            }
          },
          "additionalProperties": false
        }
      },
      "Inspection": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "owner": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "defaultBranch": {
            "type": "string"
          },
          "hasDockerfile": {
            "type": "boolean"
          },
          "deployable": {
            "type": "boolean"
          },
          "template": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppTemplate"
              },
              {
                "type": "null"
              }
            ]
          },
          "templateFile": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "templateError": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "envSchema": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppEnvSchema"
              },
              {
                "type": "null"
              }
            ]
          },
          "profileSchema": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppProfileSchema"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "owner",
          "repo",
          "defaultBranch",
          "hasDockerfile",
          "deployable",
          "template",
          "templateFile",
          "templateError",
          "envSchema",
          "profileSchema"
        ],
        "additionalProperties": false
      },
      "RegistryImage": {
        "type": "object",
        "properties": {
          "ref": {
            "type": "string"
          },
          "compose": {
            "type": "string"
          },
          "template": {
            "$ref": "#/components/schemas/AppTemplate"
          }
        },
        "required": [
          "ref",
          "compose",
          "template"
        ],
        "additionalProperties": false
      },
      "DomainDns": {
        "type": "object",
        "properties": {
          "targets": {
            "type": "object",
            "properties": {
              "a": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "aaaa": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "a",
              "aaaa"
            ],
            "additionalProperties": false
          },
          "ok": {
            "type": "boolean"
          },
          "taken": {
            "type": "boolean"
          }
        },
        "required": [
          "targets",
          "ok",
          "taken"
        ],
        "additionalProperties": false
      },
      "Ok": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      },
      "GithubInstallation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "accountLogin": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "accountType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "User",
                  "Organization"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "repoSelection": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "all",
                  "selected"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "accountLogin",
          "accountType",
          "repoSelection"
        ],
        "additionalProperties": false
      },
      "Workspace": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "hues": {
            "type": "array",
            "prefixItems": [
              {
                "type": "number"
              },
              {
                "type": "number"
              }
            ]
          },
          "iconUrl": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/ResourceQuota"
          },
          "monthlyCents": {
            "type": "number"
          },
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/App"
            }
          }
        },
        "required": [
          "slug",
          "name",
          "hues",
          "iconUrl",
          "usage",
          "monthlyCents",
          "services"
        ],
        "additionalProperties": false
      },
      "ResourceQuota": {
        "type": "object",
        "properties": {
          "cpu": {
            "type": "number"
          },
          "memory": {
            "type": "number"
          },
          "storage": {
            "type": "number"
          }
        },
        "required": [
          "cpu",
          "memory",
          "storage"
        ],
        "additionalProperties": false
      },
      "App": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "env": {
            "$ref": "#/components/schemas/EnvId"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/ServiceStatus"
          },
          "uptime": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "subServices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubService"
            }
          },
          "endpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ServiceEndpoint"
            }
          },
          "limits": {
            "$ref": "#/components/schemas/AppLimits"
          },
          "scale": {
            "$ref": "#/components/schemas/ScaleBodyOutput"
          },
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SourceOutput"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "slug",
          "env",
          "name",
          "status",
          "uptime",
          "region",
          "subServices",
          "endpoints",
          "limits",
          "scale",
          "source"
        ],
        "additionalProperties": false
      },
      "ServiceStatus": {
        "type": "string",
        "enum": [
          "deploying",
          "starting",
          "running",
          "degraded",
          "stopping",
          "stopped",
          "error"
        ]
      },
      "SubService": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/SubServiceRole"
          },
          "port": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/ServiceStatus"
          },
          "limits": {
            "type": "object",
            "properties": {
              "cpu": {
                "type": "number"
              },
              "memory": {
                "type": "number"
              }
            },
            "required": [
              "cpu",
              "memory"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "image",
          "role",
          "port",
          "status",
          "limits"
        ],
        "additionalProperties": false
      },
      "SubServiceRole": {
        "type": "string",
        "enum": [
          "web",
          "db",
          "cache",
          "queue",
          "worker",
          "proxy",
          "mail"
        ]
      },
      "ServiceEndpoint": {
        "type": "object",
        "properties": {
          "component": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "protocol": {
            "type": "string",
            "enum": [
              "http",
              "tcp",
              "udp"
            ]
          },
          "port": {
            "type": "number"
          },
          "custom": {
            "type": "boolean"
          }
        },
        "required": [
          "component",
          "url"
        ],
        "additionalProperties": false
      },
      "AppLimits": {
        "type": "object",
        "properties": {
          "cpu": {
            "type": "number"
          },
          "memory": {
            "type": "number"
          },
          "storage": {
            "type": "number"
          }
        },
        "required": [
          "cpu",
          "memory",
          "storage"
        ],
        "additionalProperties": false
      },
      "ImportResponse": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ImportListing"
          },
          {
            "$ref": "#/components/schemas/ImportResult"
          }
        ]
      },
      "ImportListing": {
        "type": "object",
        "properties": {
          "units": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportUnit"
            }
          }
        },
        "required": [
          "units"
        ],
        "additionalProperties": false
      },
      "ImportUnit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "importable": {
            "type": "boolean"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "group",
          "summary",
          "importable",
          "reason"
        ],
        "additionalProperties": false
      },
      "ImportResult": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "owner": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "defaultBranch": {
            "type": "string"
          },
          "hasDockerfile": {
            "type": "boolean"
          },
          "deployable": {
            "type": "boolean"
          },
          "template": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppTemplate"
              },
              {
                "type": "null"
              }
            ]
          },
          "templateFile": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "templateError": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "envSchema": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppEnvSchema"
              },
              {
                "type": "null"
              }
            ]
          },
          "profileSchema": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppProfileSchema"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "$ref": "#/components/schemas/SourceOutput"
          },
          "values": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "port": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 65535
              },
              {
                "type": "null"
              }
            ]
          },
          "buildCmd": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "startCmd": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "domains": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "owner",
          "repo",
          "defaultBranch",
          "hasDockerfile",
          "deployable",
          "template",
          "templateFile",
          "templateError",
          "envSchema",
          "profileSchema",
          "source",
          "values",
          "port",
          "buildCmd",
          "startCmd",
          "domains",
          "warnings"
        ],
        "additionalProperties": false
      },
      "SshSession": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string"
          },
          "port": {
            "type": "number"
          },
          "wsUrl": {
            "type": "string"
          },
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string"
          }
        },
        "required": [
          "host",
          "port",
          "wsUrl",
          "username",
          "password"
        ],
        "additionalProperties": false
      },
      "ExecResult": {
        "type": "object",
        "properties": {
          "output": {
            "type": "string"
          },
          "exit": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "timedOut": {
            "type": "boolean"
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "required": [
          "output",
          "exit",
          "timedOut",
          "truncated"
        ],
        "additionalProperties": false
      },
      "BackupState": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "window": {
            "type": "string",
            "enum": [
              "12",
              "16",
              "20",
              "auto",
              "00",
              "04",
              "08"
            ]
          },
          "volumes": {
            "type": "number"
          },
          "emergency": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Backup"
              },
              {
                "type": "null"
              }
            ]
          },
          "restoring": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Backup"
              },
              {
                "type": "null"
              }
            ]
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Backup"
            }
          }
        },
        "required": [
          "enabled",
          "window",
          "volumes",
          "emergency",
          "restoring",
          "points"
        ],
        "additionalProperties": false
      },
      "Backup": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "managed",
              "emergency",
              "restore"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "done",
              "failed"
            ]
          },
          "sizeBytes": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "sizeBytes",
          "error",
          "createdAt",
          "finishedAt"
        ],
        "additionalProperties": false
      },
      "Branches": {
        "type": "object",
        "properties": {
          "branches": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "current": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "branches",
          "current"
        ],
        "additionalProperties": false
      },
      "Deploy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "building",
              "live",
              "deployed",
              "failed"
            ]
          },
          "commitMsg": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sha": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "author": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "durationMs": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "canRollback": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "status",
          "commitMsg",
          "sha",
          "author",
          "durationMs",
          "createdAt",
          "finishedAt",
          "canRollback"
        ],
        "additionalProperties": false
      },
      "VolumeKeys": {
        "type": "object",
        "properties": {
          "s3": {
            "type": "object",
            "properties": {
              "accessKeyId": {
                "type": "string"
              },
              "secretAccessKey": {
                "type": "string"
              },
              "bucket": {
                "type": "string"
              },
              "endpoint": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "forcePathStyle": {
                "type": "boolean"
              }
            },
            "required": [
              "accessKeyId",
              "secretAccessKey",
              "bucket",
              "endpoint",
              "region",
              "forcePathStyle"
            ],
            "additionalProperties": false
          },
          "sftp": {
            "type": "object",
            "properties": {
              "host": {
                "type": "string"
              },
              "port": {
                "type": "number"
              },
              "username": {
                "type": "string"
              },
              "password": {
                "type": "string"
              }
            },
            "required": [
              "host",
              "port",
              "username",
              "password"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "s3",
          "sftp"
        ],
        "additionalProperties": false
      },
      "DbCredentials": {
        "type": "object",
        "properties": {
          "engine": {
            "$ref": "#/components/schemas/DbEngine"
          },
          "port": {
            "type": "number"
          },
          "user": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "database": {
            "type": "string"
          }
        },
        "required": [
          "engine",
          "port"
        ],
        "additionalProperties": false
      },
      "DbEngine": {
        "type": "string",
        "enum": [
          "postgres",
          "mysql",
          "redis",
          "mongodb",
          "clickhouse"
        ]
      },
      "DbSchema": {
        "type": "object",
        "properties": {
          "engine": {
            "$ref": "#/components/schemas/DbEngine"
          },
          "schemas": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "schema": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "tables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DbTable"
            }
          }
        },
        "required": [
          "engine",
          "schemas",
          "schema",
          "tables"
        ],
        "additionalProperties": false
      },
      "DbTable": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "table",
              "view",
              "mview"
            ]
          },
          "rows": {
            "type": "number"
          },
          "cols": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "pk": {
                  "type": "boolean"
                }
              },
              "required": [
                "key",
                "type"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "name",
          "kind"
        ],
        "additionalProperties": false
      },
      "DbQueryResult": {
        "type": "object",
        "properties": {
          "engine": {
            "$ref": "#/components/schemas/DbEngine"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "rowCount": {
            "type": "number"
          },
          "affected": {
            "type": "number"
          },
          "tag": {
            "type": "string"
          },
          "ms": {
            "type": "number"
          }
        },
        "required": [
          "engine",
          "columns",
          "rows",
          "rowCount",
          "ms"
        ],
        "additionalProperties": false
      },
      "GitOverview": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "ok": {
                "type": "boolean",
                "const": true
              },
              "branch": {
                "type": "string"
              },
              "branches": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "shallow": {
                "type": "boolean"
              },
              "writable": {
                "type": "boolean"
              },
              "ahead": {
                "type": "number"
              },
              "behind": {
                "type": "number"
              },
              "changes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/GitChange"
                }
              },
              "commits": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/GitCommit"
                }
              }
            },
            "required": [
              "ok",
              "branch",
              "branches",
              "shallow",
              "writable",
              "ahead",
              "behind",
              "changes",
              "commits"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "ok": {
                "type": "boolean",
                "const": false
              },
              "reason": {
                "type": "string",
                "enum": [
                  "no_repo",
                  "no_pod",
                  "no_git",
                  "not_a_repo",
                  "failed"
                ]
              }
            },
            "required": [
              "ok",
              "reason"
            ],
            "additionalProperties": false
          }
        ]
      },
      "GitChange": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "staged": {
            "type": "boolean"
          },
          "add": {
            "type": "number"
          },
          "del": {
            "type": "number"
          }
        },
        "required": [
          "code",
          "path",
          "staged",
          "add",
          "del"
        ],
        "additionalProperties": false
      },
      "GitCommit": {
        "type": "object",
        "properties": {
          "sha": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "author": {
            "type": "string"
          },
          "date": {
            "type": "string"
          }
        },
        "required": [
          "sha",
          "subject",
          "author",
          "date"
        ],
        "additionalProperties": false
      },
      "GitPatch": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "ok": {
                "type": "boolean",
                "const": true
              },
              "commit": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/GitCommit"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "files": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/GitFile"
                }
              },
              "patch": {
                "type": "string"
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": [
              "ok",
              "commit",
              "files",
              "patch",
              "truncated"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "ok": {
                "type": "boolean",
                "const": false
              },
              "reason": {
                "type": "string",
                "enum": [
                  "no_repo",
                  "no_pod",
                  "no_git",
                  "not_a_repo",
                  "failed"
                ]
              }
            },
            "required": [
              "ok",
              "reason"
            ],
            "additionalProperties": false
          }
        ]
      },
      "GitFile": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "add": {
            "type": "number"
          },
          "del": {
            "type": "number"
          }
        },
        "required": [
          "path",
          "status",
          "add",
          "del"
        ],
        "additionalProperties": false
      },
      "StatusFrame": {
        "type": "object",
        "properties": {
          "ts": {
            "type": "number"
          },
          "status": {
            "$ref": "#/components/schemas/ServiceStatus"
          },
          "services": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "status": {
                  "$ref": "#/components/schemas/ServiceStatus"
                }
              },
              "required": [
                "name",
                "status"
              ],
              "additionalProperties": false
            }
          },
          "waitingForCapacity": {
            "type": "boolean",
            "const": true
          },
          "waitingSince": {
            "type": "number"
          },
          "deploying": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "since": {
                "type": "number"
              }
            },
            "required": [
              "id",
              "since"
            ],
            "additionalProperties": false
          },
          "ipv6": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ts",
          "status",
          "services"
        ],
        "additionalProperties": false
      },
      "InstanceMetrics": {
        "type": "object",
        "properties": {
          "ts": {
            "type": "number"
          },
          "cpu": {
            "type": "object",
            "properties": {
              "used": {
                "type": "number"
              }
            },
            "required": [
              "used"
            ],
            "additionalProperties": false
          },
          "memory": {
            "type": "object",
            "properties": {
              "used": {
                "type": "number"
              }
            },
            "required": [
              "used"
            ],
            "additionalProperties": false
          },
          "components": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "cpu": {
                  "type": "number"
                },
                "memory": {
                  "type": "number"
                }
              },
              "required": [
                "cpu",
                "memory"
              ],
              "additionalProperties": false
            }
          },
          "disk": {
            "type": "object",
            "properties": {
              "used": {
                "type": "number"
              },
              "capacity": {
                "type": "number"
              }
            },
            "required": [
              "used",
              "capacity"
            ],
            "additionalProperties": false
          },
          "network": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "rxBytesPerSec": {
                    "type": "number"
                  },
                  "txBytesPerSec": {
                    "type": "number"
                  }
                },
                "required": [
                  "rxBytesPerSec",
                  "txBytesPerSec"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "requestsPerSec": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ts",
          "cpu",
          "memory",
          "components",
          "disk",
          "network",
          "requestsPerSec"
        ],
        "additionalProperties": false
      },
      "ActiveDeployFrame": {
        "type": "object",
        "properties": {
          "ts": {
            "type": "number"
          },
          "deploy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Deploy"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ts",
          "deploy"
        ],
        "additionalProperties": false
      },
      "DeployLogSnapshot": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "snapshot"
          },
          "log": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "building",
              "live",
              "deployed",
              "failed"
            ]
          },
          "final": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "kind",
          "log",
          "status"
        ],
        "additionalProperties": false
      },
      "Var": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "isSecret": {
            "type": "boolean"
          },
          "kind": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "key",
          "value",
          "isSecret",
          "kind",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ImportVarsResult": {
        "type": "object",
        "properties": {
          "added": {
            "type": "number"
          },
          "skipped": {
            "type": "number"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "added",
          "skipped",
          "errors"
        ],
        "additionalProperties": false
      },
      "Domain": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "host": {
            "type": "string"
          },
          "isPrimary": {
            "type": "boolean"
          },
          "redirectTo": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "port": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "host",
          "isPrimary",
          "redirectTo",
          "port",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "CertStatus": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "pending",
              "failed",
              "none"
            ]
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "host",
          "status"
        ],
        "additionalProperties": false
      },
      "ServiceLogs": {
        "type": "object",
        "properties": {
          "container": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "ok",
              "no-pod"
            ]
          },
          "logs": {
            "type": "string"
          }
        },
        "required": [
          "container",
          "state",
          "logs"
        ],
        "additionalProperties": false
      },
      "ComponentService": {
        "type": "object",
        "properties": {
          "podName": {
            "type": "string"
          },
          "containerName": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "ready": {
            "type": "boolean"
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "waiting",
              "terminated",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "restartCount": {
            "type": "number"
          },
          "ports": {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "startedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "podName",
          "containerName",
          "image",
          "ready",
          "state",
          "restartCount",
          "ports",
          "startedAt"
        ],
        "additionalProperties": false
      },
      "VolumeInfo": {
        "type": "object",
        "properties": {
          "instanceId": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/MountKind"
          },
          "name": {
            "type": "string"
          },
          "mountPath": {
            "type": "string"
          },
          "component": {
            "type": "string"
          },
          "capacityBytes": {
            "type": "number"
          },
          "usedBytes": {
            "type": "number"
          },
          "fileCount": {
            "type": "number"
          }
        },
        "required": [
          "instanceId",
          "kind",
          "name",
          "mountPath",
          "component",
          "capacityBytes",
          "usedBytes",
          "fileCount"
        ],
        "additionalProperties": false
      },
      "WorkspaceBilling": {
        "type": "object",
        "properties": {
          "quota": {
            "$ref": "#/components/schemas/ResourceQuota"
          },
          "usage": {
            "$ref": "#/components/schemas/ResourceQuota"
          },
          "billable": {
            "$ref": "#/components/schemas/ResourceQuota"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceLine"
            }
          },
          "monthlyCents": {
            "type": "number"
          },
          "thisMonthCents": {
            "type": "number"
          },
          "dueTodayCents": {
            "type": "number"
          },
          "nextMonthCents": {
            "type": "number"
          },
          "hasSubscription": {
            "type": "boolean"
          },
          "free": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "currentPeriodEnd": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string"
          },
          "portalAvailable": {
            "type": "boolean"
          },
          "paymentMethod": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentMethodSource": {
            "$ref": "#/components/schemas/PaymentMethodSource"
          }
        },
        "required": [
          "quota",
          "usage",
          "billable",
          "lines",
          "monthlyCents",
          "thisMonthCents",
          "dueTodayCents",
          "nextMonthCents",
          "hasSubscription",
          "free",
          "status",
          "currentPeriodEnd",
          "currency",
          "portalAvailable",
          "paymentMethod",
          "paymentMethodSource"
        ],
        "additionalProperties": false
      },
      "PriceLine": {
        "type": "object",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/ResourceKey"
          },
          "amount": {
            "type": "number"
          },
          "units": {
            "type": "number"
          },
          "cents": {
            "type": "number"
          },
          "rateCents": {
            "type": "number"
          }
        },
        "required": [
          "key",
          "amount",
          "units",
          "cents",
          "rateCents"
        ],
        "additionalProperties": false
      },
      "ResourceKey": {
        "type": "string",
        "enum": [
          "cpu",
          "memory",
          "storage"
        ]
      },
      "PaymentMethod": {
        "type": "object",
        "properties": {
          "brand": {
            "type": "string"
          },
          "last4": {
            "type": "string"
          },
          "expMonth": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "expYear": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "brand",
          "last4",
          "expMonth",
          "expYear"
        ],
        "additionalProperties": false
      },
      "PaymentMethodSource": {
        "type": "string",
        "enum": [
          "workspace",
          "account",
          "none"
        ]
      },
      "Member": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "image": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "developer",
              "viewer"
            ]
          },
          "joinedAt": {
            "type": "string"
          }
        },
        "required": [
          "userId",
          "name",
          "email",
          "image",
          "role",
          "joinedAt"
        ],
        "additionalProperties": false
      },
      "Invitation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "invitedBy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InvitationActor"
              },
              {
                "type": "null"
              }
            ]
          },
          "link": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "role",
          "invitedBy",
          "link",
          "expiresAt",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "InvitationActor": {
        "type": "object",
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "email"
        ],
        "additionalProperties": false
      },
      "WorkspaceVolume": {
        "type": "object",
        "properties": {
          "instanceId": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/MountKind"
          },
          "name": {
            "type": "string"
          },
          "mountPath": {
            "type": "string"
          },
          "component": {
            "type": "string"
          },
          "capacityBytes": {
            "type": "number"
          },
          "usedBytes": {
            "type": "number"
          },
          "fileCount": {
            "type": "number"
          },
          "slug": {
            "type": "string"
          },
          "appName": {
            "type": "string"
          },
          "env": {
            "$ref": "#/components/schemas/EnvId"
          },
          "region": {
            "type": "string"
          }
        },
        "required": [
          "instanceId",
          "kind",
          "name",
          "mountPath",
          "component",
          "capacityBytes",
          "usedBytes",
          "fileCount",
          "slug",
          "appName",
          "env",
          "region"
        ],
        "additionalProperties": false
      },
      "GithubIntegration": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "externalId": {
            "type": "string"
          },
          "accountLogin": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "accountType": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "installedBy": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "provider",
          "externalId",
          "accountLogin",
          "accountType",
          "installedBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "SsoConnection": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "clientId": {
            "type": "string"
          }
        },
        "required": [
          "domain",
          "issuer",
          "clientId"
        ],
        "additionalProperties": false
      },
      "GithubRepo": {
        "type": "object",
        "properties": {
          "fullName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "private": {
            "type": "boolean"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultBranch": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "fullName",
          "name",
          "private",
          "description",
          "defaultBranch",
          "url"
        ],
        "additionalProperties": false
      },
      "TokenView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "scope": {
            "$ref": "#/components/schemas/TokenScope"
          },
          "prefix": {
            "type": "string"
          },
          "workspaceId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "scope",
          "prefix",
          "workspaceId",
          "lastUsedAt",
          "expiresAt",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "AccountBilling": {
        "type": "object",
        "properties": {
          "portalAvailable": {
            "type": "boolean"
          },
          "paymentMethod": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              },
              {
                "type": "null"
              }
            ]
          },
          "workspaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountWorkspaceBilling"
            }
          },
          "monthlyCents": {
            "type": "number"
          },
          "thisMonthCents": {
            "type": "number"
          },
          "dueTodayCents": {
            "type": "number"
          },
          "nextMonthCents": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invoice"
            }
          }
        },
        "required": [
          "portalAvailable",
          "paymentMethod",
          "workspaces",
          "monthlyCents",
          "thisMonthCents",
          "dueTodayCents",
          "nextMonthCents",
          "currency",
          "invoices"
        ],
        "additionalProperties": false
      },
      "AccountWorkspaceBilling": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "quota": {
            "$ref": "#/components/schemas/ResourceQuota"
          },
          "billable": {
            "$ref": "#/components/schemas/ResourceQuota"
          },
          "monthlyCents": {
            "type": "number"
          },
          "status": {
            "type": "string"
          },
          "currentPeriodEnd": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentMethod": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentMethodSource": {
            "$ref": "#/components/schemas/PaymentMethodSource"
          }
        },
        "required": [
          "slug",
          "name",
          "quota",
          "billable",
          "monthlyCents",
          "status",
          "currentPeriodEnd",
          "paymentMethod",
          "paymentMethodSource"
        ],
        "additionalProperties": false
      },
      "Invoice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created": {
            "type": "string"
          },
          "amount": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "number",
          "created",
          "amount",
          "currency",
          "status",
          "url"
        ],
        "additionalProperties": false
      },
      "UserBillingState": {
        "type": "object",
        "properties": {
          "hasPaymentMethod": {
            "type": "boolean"
          }
        },
        "required": [
          "hasPaymentMethod"
        ],
        "additionalProperties": false
      },
      "NotificationPrefs": {
        "type": "object",
        "properties": {
          "deploys": {
            "description": "Deploy result emails: off, failures only, failures plus the deploy that fixes one, or every deploy. An app's first live deploy is always emailed",
            "$ref": "#/components/schemas/DeployEmails"
          },
          "tickets": {
            "type": "boolean"
          },
          "replies": {
            "type": "boolean"
          },
          "incidents": {
            "type": "boolean"
          },
          "billing": {
            "type": "boolean"
          },
          "weekly": {
            "type": "boolean"
          },
          "product": {
            "type": "boolean"
          }
        },
        "required": [
          "deploys",
          "tickets",
          "replies",
          "incidents",
          "billing",
          "weekly",
          "product"
        ],
        "additionalProperties": false
      },
      "SecurityState": {
        "type": "object",
        "properties": {
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "phoneVerified": {
            "type": "boolean"
          },
          "mfaEnabled": {
            "type": "boolean"
          },
          "smsAvailable": {
            "type": "boolean"
          }
        },
        "required": [
          "phone",
          "phoneVerified",
          "mfaEnabled",
          "smsAvailable"
        ],
        "additionalProperties": false
      },
      "TicketSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "updatedAt": {
            "type": "string"
          },
          "lastMessage": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "user",
                      "agent",
                      "system"
                    ]
                  },
                  "body": {
                    "type": "string"
                  }
                },
                "required": [
                  "role",
                  "body"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "unread": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "userId",
          "subject",
          "topic",
          "status",
          "updatedAt",
          "lastMessage",
          "unread"
        ],
        "additionalProperties": false
      },
      "Ticket": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TicketMessage"
            }
          }
        },
        "required": [
          "id",
          "subject",
          "topic",
          "status",
          "createdAt",
          "updatedAt",
          "messages"
        ],
        "additionalProperties": false
      },
      "TicketMessage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "user",
              "agent",
              "system"
            ]
          },
          "body": {
            "type": "string"
          },
          "authorName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "mine": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "role",
          "body",
          "authorName",
          "mine",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "TicketThread": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TicketMessage"
            }
          }
        },
        "required": [
          "status",
          "messages"
        ],
        "additionalProperties": false
      },
      "SlugCheck": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "suffixed": {
            "type": "boolean"
          }
        },
        "required": [
          "slug",
          "suffixed"
        ],
        "additionalProperties": false
      },
      "TemplateList": {
        "type": "object",
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Template"
            }
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "name",
                "count"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "templates",
          "total",
          "categories"
        ],
        "additionalProperties": false
      },
      "Template": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "hint": {
            "type": "string"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "installs": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "category": {
            "type": "string"
          },
          "services": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "image": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "role": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "image",
                "role"
              ],
              "additionalProperties": false
            }
          },
          "quota": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ResourceQuota"
              },
              {
                "type": "null"
              }
            ]
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "rating": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "ratings": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "updatedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "slug",
          "name",
          "description",
          "hint",
          "version",
          "installs",
          "category",
          "services",
          "quota",
          "icon",
          "rating",
          "ratings",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "TemplateReview": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "author": {
            "type": "string"
          },
          "rating": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "body": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "mine": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "author",
          "rating",
          "body",
          "createdAt",
          "mine"
        ],
        "additionalProperties": false
      },
      "Pricing": {
        "type": "object",
        "properties": {
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Plan"
            }
          },
          "freeAllowance": {
            "$ref": "#/components/schemas/ResourceQuota"
          },
          "currency": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          }
        },
        "required": [
          "plans",
          "freeAllowance",
          "currency",
          "available"
        ],
        "additionalProperties": false
      },
      "Plan": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "cpu": {
            "type": "number"
          },
          "memory": {
            "type": "number"
          },
          "storage": {
            "type": "number"
          },
          "priceCents": {
            "type": "number"
          }
        },
        "required": [
          "name",
          "cpu",
          "memory",
          "storage",
          "priceCents"
        ],
        "additionalProperties": false
      },
      "InvitationDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "developer",
              "viewer"
            ]
          },
          "expiresAt": {
            "type": "string"
          },
          "workspace": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "hueA": {
                "type": "number"
              },
              "hueB": {
                "type": "number"
              },
              "appCount": {
                "type": "number"
              },
              "memberCount": {
                "type": "number"
              }
            },
            "required": [
              "slug",
              "name",
              "hueA",
              "hueB",
              "appCount",
              "memberCount"
            ],
            "additionalProperties": false
          },
          "invitedBy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InvitationActor"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "email",
          "role",
          "expiresAt",
          "workspace",
          "invitedBy"
        ],
        "additionalProperties": false
      },
      "ScaleBodyOutput": {
        "type": "object",
        "properties": {
          "cpu": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 4,
            "multipleOf": 0.25
          },
          "memory": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 4,
            "multipleOf": 0.25
          },
          "volumes": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 30
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1024
            }
          }
        },
        "required": [
          "cpu",
          "memory"
        ],
        "additionalProperties": false
      },
      "SourceOutput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "git"
              },
              "repoUrl": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "branch": {
                "type": "string",
                "maxLength": 255
              },
              "subdir": {
                "type": "string",
                "maxLength": 255
              },
              "autoDeploy": {
                "type": "boolean"
              },
              "branchTracking": {
                "$ref": "#/components/schemas/BranchTrackingOutput"
              },
              "profiles": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                }
              }
            },
            "required": [
              "type",
              "repoUrl"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "upload"
              },
              "uploadId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "subdir": {
                "type": "string",
                "maxLength": 255
              },
              "profiles": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                }
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "catalog"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "profiles": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$"
                }
              }
            },
            "required": [
              "type",
              "name"
            ],
            "additionalProperties": false
          }
        ],
        "type": "object"
      },
      "BranchTrackingOutput": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "all",
              "match"
            ]
          },
          "pattern": {
            "type": "string",
            "maxLength": 255
          }
        },
        "required": [
          "mode"
        ],
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "cloady": {
        "type": "http",
        "scheme": "bearer",
        "description": "Personal API token (cldy_…)"
      }
    }
  }
}
