{
  "openapi": "3.0.4",
  "info": {
    "title": "Morph.Cloud.Web",
    "version": "1.0"
  },
  "paths": {
    "/api/1.0/api-keys": {
      "get": {
        "tags": [
          "ApiKeys"
        ],
        "summary": "Lists the keys (masked).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyDto"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "ApiKeys"
        ],
        "summary": "Creates a key and returns the full token once. Denied (403) while impersonating.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResponseDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/1.0/api-keys/{id}": {
      "delete": {
        "tags": [
          "ApiKeys"
        ],
        "summary": "Revokes a key, idempotent.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/1.0/Auth/me": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Returns the current user (or an anonymous DTO when not signed in). \nCreates a user in database on first call",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentUserDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentUserDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentUserDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/1.0/Auth/login/{provider}": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Starts server-side sign-in with Microsoft or Google: redirects to the provider, which\ncomes back to the OIDC callback; the session then lives in an HttpOnly cookie and the\nbrowser lands on returnUrl (a local path only; defaults to /app/).",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/AuthProvider"
            }
          },
          {
            "name": "returnUrl",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/1.0/Auth/logout": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Ends the cookie session. Header-authenticated callers have nothing to end.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/1.0/Auth/usage": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Returns what the caller's tenant holds against its account-level quotas (workflows).\nStorage is reported per space — see `GET /api/spaces/{spaceId}/usage`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TenantUsageDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantUsageDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantUsageDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/1.0/Diagnostics/health": {
      "get": {
        "tags": [
          "Diagnostics"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponseDto"
                }
              }
            }
          }
        },
        "deprecated": true
      }
    },
    "/api/1.0/Diagnostics/isHealthy": {
      "get": {
        "tags": [
          "Diagnostics"
        ],
        "summary": "Load balancer health check. \nReturns error when in deployment is about to start to drain instance from user requests.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponseDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/1.0/Diagnostics/ping": {
      "get": {
        "tags": [
          "Diagnostics"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PingResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PingResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PingResponseDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/1.0/Diagnostics/echo": {
      "post": {
        "tags": [
          "Diagnostics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EchoRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/EchoRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/EchoRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EchoRequestDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EchoRequestDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EchoRequestDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/1.0/Diagnostics/error": {
      "get": {
        "tags": [
          "Diagnostics"
        ],
        "responses": {
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/1.0/Diagnostics/validate": {
      "post": {
        "tags": [
          "Diagnostics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateRequestDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateRequestDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateRequestDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/1.0/Diagnostics/status": {
      "get": {
        "tags": [
          "Diagnostics"
        ],
        "summary": "background sweeper health for this instance.\nState is derived from last-completion time only; errors surface in logs, not here.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BackgroundProcessStatusDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BackgroundProcessStatusDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BackgroundProcessStatusDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/capabilities": {
      "get": {
        "tags": [
          "Storage"
        ],
        "summary": "Returns storage capabilities: the tenant's max file size, path limits (length, segment length,\ndepth), max page size, allowed extensions and upload/download ticket TTLs.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/StorageCapabilitiesDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageCapabilitiesDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageCapabilitiesDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/usage": {
      "get": {
        "tags": [
          "Storage"
        ],
        "summary": "Returns what the space's tenant holds against its storage quota. Tenant-wide: every space of\nthe tenant shares the same quota, so any of its spaces reports the same numbers. Workflow\nusage is account-level — see `GET /api/1.0/auth/usage`.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceUsageDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceUsageDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceUsageDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/uploads/validate": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Asks whether an upload to the given path would be accepted, without starting one. A refusal\nis reported in the body (`ok: false` plus the code), not as an error status — the call\nitself succeeded. Answers only for this moment: a concurrent upload can take the path next.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateStartUploadRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateStartUploadRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateStartUploadRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateStartUploadResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateStartUploadResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateStartUploadResponseDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/uploads": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Starts upload",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartUploadRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/StartUploadRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/StartUploadRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UploadTicketDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadTicketDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadTicketDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/uploads/test-wrapper": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "TEST-ONLY upload wrapper. Uses StartUploadDto + file",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "Path": {
                    "type": "string",
                    "description": "Store-relative destination path, e.g. `reports/2026/q3.dset`."
                  },
                  "Mode": {
                    "$ref": "#/components/schemas/UploadMode"
                  },
                  "Size": {
                    "type": "integer",
                    "description": "Declared byte size of the object being uploaded. Required — drives the ticket and reserves\nthat many bytes of the tenant's storage quota (refused with `QuotaExceeded`, HTTP 507,\nwhen it does not fit). Must not be negative (`InvalidFileSize`) or exceed the tenant's\nmaximum file size (`PayloadTooLarge`; reported as `maxFileSize` by\n`GET /storage/capabilities`), and the bytes that land must match it exactly, or the\ncomplete is refused.",
                    "format": "int64"
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "Path": {
                  "style": "form"
                },
                "Mode": {
                  "style": "form"
                },
                "Size": {
                  "style": "form"
                },
                "file": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TestUploadResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestUploadResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestUploadResponseDto"
                }
              }
            }
          }
        },
        "deprecated": true
      }
    },
    "/api/spaces/{spaceId}/storage/uploads/{uploadId}/complete": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Call this API to notify backend about successful upload completition",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uploadId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteUploadResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteUploadResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteUploadResponseDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/uploads/{uploadId}": {
      "delete": {
        "tags": [
          "Storage"
        ],
        "summary": "Call this API to abort upload and delete pending row",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uploadId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/list": {
      "get": {
        "tags": [
          "Storage"
        ],
        "summary": "Lists the contents of a folder",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "query",
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/FolderListingDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderListingDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderListingDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/files/metadata": {
      "get": {
        "tags": [
          "Storage"
        ],
        "summary": "Obtain a file metadata",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "query",
            "description": "",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/files/download": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Obtain a file presigned url",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/DownloadTicketDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DownloadTicketDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/DownloadTicketDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/files/move": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Moves a file under a new parent folder (which must already exist), keeping its name.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/MoveRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/files/rename": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Renames a file: change its leaf name within the same folder.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RenameRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/files/delete": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Deletes the file at the given path.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/folders": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Creates a folder, materialising any missing parents on the way. The target folder itself must\nnot already exist (409 AlreadyExists); the store root always exists.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PathRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/folders/move": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Moves a folder (and its whole subtree) under a new parent folder, keeping its name. One row\nupdate; nothing under the folder is rewritten. The store root cannot be moved.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/MoveRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/folders/rename": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Renames a folder: change its leaf name within the same parent. The subtree travels with it.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RenameRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageEntryDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/storage/folders/delete": {
      "post": {
        "tags": [
          "Storage"
        ],
        "summary": "Deletes the folder at the given path. Without `recursive` a folder that still holds a\nsubfolder or a file is refused with 409 FolderNotEmpty; with it, the whole subtree goes and\nevery file in it is retired. The store root cannot be deleted.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteFolderRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteFolderRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteFolderRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/1.0/Users": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Admin user search. Filter by email (substring/domain), tier, creation date range and\nrecent-login window; sort by domain+name, workflow count/size, or creation date; page\nwith skip/take.",
        "parameters": [
          {
            "name": "Email",
            "in": "query",
            "description": "Case-insensitive substring match on email. Pass a domain (e.g. `@acme.com`)\nto find everyone from one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Tier",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/UserTier"
            }
          },
          {
            "name": "CreatedFrom",
            "in": "query",
            "description": "Inclusive lower bound on `created_at` (UTC).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "CreatedTo",
            "in": "query",
            "description": "Inclusive upper bound on `created_at` (UTC).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "LastLoginWithinDays",
            "in": "query",
            "description": "Only users whose last login was within this many days of now.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "IncludeTestUsers",
            "in": "query",
            "description": "When false (default) users on the test-account domain are excluded, so the list\nreflects real customers. Set true to include them (e.g. from system tests).",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "OrderBy",
            "in": "query",
            "description": "Sort options for the admin user list. Names bind from the `orderBy` query\nstring parameter (case-insensitive).",
            "schema": {
              "$ref": "#/components/schemas/UserListOrderBy"
            }
          },
          {
            "name": "Skip",
            "in": "query",
            "description": "Number of rows to skip (offset paging).",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "Take",
            "in": "query",
            "description": "Page size. Clamped server-side to [1, 200].",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserListResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserListResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserListResponseDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/1.0/Users/activity": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Per-day activity report over the inclusive [from, to] UTC date range. Defaults to the\nlast 30 days when no range is supplied. Each row: users / sessions / workflows created.\nTest-domain accounts are excluded unless includeTestUsers is set.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "includeTestUsers",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserActivityDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserActivityDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserActivityDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/workflows": {
      "get": {
        "tags": [
          "Workflow"
        ],
        "summary": "Get workflows for space.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sinceToken",
            "in": "query",
            "description": "",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDtoPaginationResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDtoPaginationResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDtoPaginationResponseDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{spaceId}/workflows/{id}": {
      "get": {
        "tags": [
          "Workflow"
        ],
        "summary": "Returns current document or 404 when item was deleted",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Workflow"
        ],
        "summary": "PUT — the one write endpoint, covering BOTH create and update.\n  create with a client-minted ID (PUT, not POST — server validates, never assigns),\n  conditional update via If-Match; mismatch → 409 WITH the current document,\n  Idempotency-Key accepted and logged; MVP backend deliberately ignores it,\n  a write against a tombstone is refused (resurrection prevention)///",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "description": "default is *",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "not implemented, but required",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResponseDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Workflow"
        ],
        "summary": "DELETE — soft delete. A delete is just another versioned, conditional\nmutation: it requires If-Match, bumps serverVersion, and leaves a tombstone.",
        "parameters": [
          {
            "name": "spaceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AdminUserListResponseDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserAdminViewDto"
            },
            "nullable": true
          },
          "total": {
            "type": "integer",
            "description": "Total rows matching the filter, ignoring paging.",
            "format": "int32"
          },
          "skip": {
            "type": "integer",
            "format": "int32"
          },
          "take": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ApiKeyDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Any user provided name or automatically generated",
            "nullable": true,
            "example": "Api Key 2008-06-15 21:15:07Z"
          },
          "masked": {
            "type": "string",
            "description": "Masked api key",
            "nullable": true,
            "example": "emc_ce0c7c1b…431e"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "revokedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Metadata for one API key. Never carries the raw token."
      },
      "AuthProvider": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5
        ],
        "type": "integer",
        "format": "int32"
      },
      "BackgroundProcessStatusDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Sweeper identifier, e.g. `upload-expiry` or `object-deletion`.",
            "nullable": true
          },
          "state": {
            "type": "string",
            "description": "`OK` (completed within the freshness window), `Stale` (overdue), or `Starting` (no run yet).",
            "nullable": true
          },
          "machineName": {
            "type": "string",
            "description": "The instance that produced this snapshot.",
            "nullable": true
          },
          "lastCompletedAt": {
            "type": "string",
            "description": "When the last run finished on this instance; null before the first run.",
            "format": "date-time",
            "nullable": true
          },
          "rowsProcessedLastRun": {
            "type": "integer",
            "description": "Rows the last run processed on this instance.",
            "format": "int32"
          },
          "oldestUnprocessedAt": {
            "type": "string",
            "description": "Oldest row still awaiting this sweeper (global, as of the last run); null when caught up.",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Health of one background sweeper, per responding instance (Morph.Cloud.Web.InternalModels.BackgroundProcessStatusDto.MachineName). With\nmultiple servers the endpoint reflects whichever instance served the request; alerting is driven\nby error logs, this is a spot check. Morph.Cloud.Web.InternalModels.BackgroundProcessStatusDto.State is derived from last-completion time only."
      },
      "BlockReason": {
        "enum": [
          0,
          1,
          2
        ],
        "type": "integer",
        "format": "int32"
      },
      "CompleteUploadResponseDto": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/StorageEntryType"
          },
          "path": {
            "type": "string",
            "description": "Full store-relative path of this entry, in canonical form (no leading slash), so an entry is\naddressable on its own without the caller re-deriving it from a parent path.",
            "nullable": true,
            "example": "reports/2026/q3.dset"
          },
          "name": {
            "type": "string",
            "description": "The leaf name, as stored (original casing).",
            "nullable": true,
            "example": "q3.dset"
          },
          "size": {
            "type": "integer",
            "description": "Stored size in bytes. Files only; null for a folder.",
            "format": "int64",
            "nullable": true
          },
          "eTag": {
            "type": "string",
            "description": "HTTP entity tag (S3 ETag on Cloud) — the file's version identity. Compare it for equality to\ntell \"same version?\", or pass it as `If-None-Match` on the download GET for a\n`304`. Files only; null for a folder.",
            "nullable": true
          },
          "modifiedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "CreateApiKeyRequestDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "When empty, defaults to 'Api Key 2008-06-15 21:15:07Z'",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "description": "Optional expiry. Null = never expires. When set, must be in the future.",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Parameters to create ApiKey"
      },
      "CreateApiKeyResponseDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Api Key Created, visible only once",
            "nullable": true,
            "example": "emc_578d2ff_4a56c48d16b4e298961eea896b7cc1c09b28cdedade46a8fd2c267d98fff0683_811b34b7"
          },
          "key": {
            "$ref": "#/components/schemas/ApiKeyDto"
          }
        },
        "additionalProperties": false,
        "description": "Returned once, at creation. Morph.Cloud.ApiModels.Auth.CreateApiKeyResponseDto.Token is the only time the raw secret is exposed —\nit is not stored and cannot be retrieved again."
      },
      "CurrentUserDto": {
        "type": "object",
        "properties": {
          "isAuthenticated": {
            "type": "boolean"
          },
          "userId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "userName": {
            "type": "string",
            "nullable": true
          },
          "tenantId": {
            "type": "string",
            "description": "UI landing hint, NOT a session context: the user's default tenant (32-char hex id, e.g.\n9722820808604bbeb486f3dc8af1a93a), non-null when authenticated. It tells the client where\nto drop the user on first load — it does not\nlock the session to one tenant. There is no ambient/\"active\" tenant server-side; every\nrequest scopes itself explicitly, either by the resource (a space carries its tenant, so\naccess is checked via space -> tenant membership) or by a {tenantId} in the route for\ntenant-level collections. A user may belong to several tenants; this is just the default\none (user_tenants.is_default), and Morph.Cloud.ApiModels.Users.CurrentUserDto.DefaultSpace is its default space.",
            "nullable": true
          },
          "tier": {
            "$ref": "#/components/schemas/UserTier"
          },
          "canImpersonate": {
            "type": "boolean"
          },
          "impersonatedBy": {
            "type": "string",
            "nullable": true
          },
          "blockReason": {
            "$ref": "#/components/schemas/BlockReason"
          },
          "defaultSpace": {
            "$ref": "#/components/schemas/SpaceDto"
          }
        },
        "additionalProperties": false
      },
      "DeleteFolderRequestDto": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "nullable": true
          },
          "recursive": {
            "type": "boolean",
            "description": "May the delete descend into subfolders? Default false → a folder that still contains a\nsubfolder is refused with 409 FolderNotEmpty. True → the whole subtree is in scope."
          },
          "deleteFiles": {
            "type": "boolean",
            "description": "May the delete destroy file content? Default false → a folder holding files is refused with\n409 FolderNotEmpty, even with Morph.Cloud.ApiModels.Storage.DeleteFolderRequestDto.Recursive set, so emptying a deep tree of\nfolders never silently discards data. True → the files in scope are deleted too.",
            "example": true
          }
        },
        "additionalProperties": false,
        "description": "`POST /folders/delete`."
      },
      "DownloadTicketDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "size": {
            "type": "integer",
            "format": "int64"
          },
          "eTag": {
            "type": "string",
            "description": "HTTP entity tag of the object about to be transferred — the version identity. Pass it as\n`If-None-Match` on the GET to Morph.Cloud.ApiModels.Storage.DownloadTicketDto.Url to get a `304 Not Modified` when the\nclient already has this version.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Short-lived download ticket (`POST /files/download`). The client then issues a plain GET (optionally with a single Range header)."
      },
      "EchoRequestDto": {
        "required": [
          "message"
        ],
        "type": "object",
        "properties": {
          "message": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "FolderListingDto": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "nullable": true
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StorageEntryDto"
            },
            "nullable": true
          },
          "nextCursor": {
            "type": "string",
            "description": "Opaque cursor for the next page, or null at the end.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A page of a folder's contents (keyset-paginated: subfolders first, then files, each group alphabetical)."
      },
      "HealthResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "nullable": true
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "machineName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MoveRequestDto": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "nullable": true
          },
          "newParentPath": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "`POST /files/move` or `/folders/move` — change the parent folder, keeping the leaf\n            name. The destination parent must already exist (create it via `POST /folders` first); a\n            missing parent is a 404."
      },
      "ObjectPutResultDto": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer",
            "description": "HTTP status returned by the object store for the PUT (2xx = the bytes landed).",
            "format": "int32"
          },
          "eTag": {
            "type": "string",
            "description": "ETag header the store returned for the stored object, if any.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Outcome of the raw PUT to the presigned URL, as seen server-side by the round-trip helper."
      },
      "PathRequestDto": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "`POST /files/delete` or `POST /folders` (create) — a single path."
      },
      "PingResponseDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "nullable": true
          },
          "clientIp": {
            "type": "string",
            "description": "The client IP as seen by the server (after X-Forwarded-For unwrapping).\nUseful to sanity-check that the load balancer is forwarding correctly.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      },
      "QuotaUsageDto": {
        "type": "object",
        "properties": {
          "used": {
            "type": "integer",
            "format": "int64",
            "example": 12
          },
          "quota": {
            "type": "integer",
            "format": "int64",
            "example": 50
          }
        },
        "additionalProperties": false,
        "description": "One quota and how much of it is taken."
      },
      "RenameRequestDto": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "nullable": true
          },
          "newName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "`POST /files/rename` or `/folders/rename` — change the leaf name within the same\n            parent. Morph.Cloud.ApiModels.Storage.RenameRequestDto.NewName is a single path segment, not a path."
      },
      "SpaceDto": {
        "required": [
          "id",
          "name",
          "tenantId"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "tenantId": {
            "type": "string",
            "description": "Tenant ids is 32-char hex \"N\" form (no hyphens), e.g. 9722820808604bbeb486f3dc8af1a93a matching the Gateway",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "isDefault": {
            "type": "boolean"
          },
          "serverVersion": {
            "type": "integer",
            "description": "Should be passed back as IfMatch header",
            "format": "int64"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "SpaceUsageDto": {
        "required": [
          "storage"
        ],
        "type": "object",
        "properties": {
          "storage": {
            "$ref": "#/components/schemas/QuotaUsageDto"
          }
        },
        "additionalProperties": false,
        "description": "What a space's tenant holds against its storage quota (`GET /api/spaces/{spaceId}/usage`).\nTenant-wide: every space of a tenant draws on the same quota, so any of its spaces reports the\nsame numbers."
      },
      "StartUploadRequestDto": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Store-relative destination path, e.g. `reports/2026/q3.dset`.",
            "nullable": true
          },
          "mode": {
            "$ref": "#/components/schemas/UploadMode"
          },
          "size": {
            "type": "integer",
            "description": "Declared byte size of the object being uploaded. Required — drives the ticket and reserves\nthat many bytes of the tenant's storage quota (refused with `QuotaExceeded`, HTTP 507,\nwhen it does not fit). Must not be negative (`InvalidFileSize`) or exceed the tenant's\nmaximum file size (`PayloadTooLarge`; reported as `maxFileSize` by\n`GET /storage/capabilities`), and the bytes that land must match it exactly, or the\ncomplete is refused.",
            "format": "int64"
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /storage/uploads`. The target Morph.Cloud.ApiModels.Storage.StartUploadRequestDto.Path travels in the\npayload (not the URL) so there is no percent-encoding ambiguity, no URL length ceiling, and\nUnicode is carried natively."
      },
      "StorageCapabilitiesDto": {
        "type": "object",
        "properties": {
          "backend": {
            "type": "string",
            "nullable": true
          },
          "maxFileSize": {
            "type": "integer",
            "description": "Largest declared size a single upload may have, in bytes. Set per tenant (512 MiB by\ndefault), so spaces of different tenants can report different values.",
            "format": "int64",
            "example": 536870912
          },
          "maxPathLength": {
            "type": "integer",
            "format": "int32"
          },
          "maxSegmentLength": {
            "type": "integer",
            "format": "int32"
          },
          "maxDepth": {
            "type": "integer",
            "format": "int32"
          },
          "maxPageSize": {
            "type": "integer",
            "format": "int32"
          },
          "allowedExtensions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Allowed extensions",
            "nullable": true
          },
          "uploadTicketTtlSeconds": {
            "type": "integer",
            "format": "int32"
          },
          "downloadTicketTtlSeconds": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "Storage limits for a space (`GET /storage/capabilities`), so one connector build adapts to\nCloud vs Hub — and to the space's tenant plan — without a release. Reported, not just documented.\n            \nDeliberately NOT reported, because they are guaranteed invariants across every backend we ship\n(so a client must never branch on them): single-range GET is always supported, multi-range never\nis, conditional GET (ETag / If-None-Match) is always supported, and paths are always\ncase-insensitive for collisions. Resumable upload is likewise always off in v1."
      },
      "StorageEntryDto": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/StorageEntryType"
          },
          "path": {
            "type": "string",
            "description": "Full store-relative path of this entry, in canonical form (no leading slash), so an entry is\naddressable on its own without the caller re-deriving it from a parent path.",
            "nullable": true,
            "example": "reports/2026/q3.dset"
          },
          "name": {
            "type": "string",
            "description": "The leaf name, as stored (original casing).",
            "nullable": true,
            "example": "q3.dset"
          },
          "size": {
            "type": "integer",
            "description": "Stored size in bytes. Files only; null for a folder.",
            "format": "int64",
            "nullable": true
          },
          "eTag": {
            "type": "string",
            "description": "HTTP entity tag (S3 ETag on Cloud) — the file's version identity. Compare it for equality to\ntell \"same version?\", or pass it as `If-None-Match` on the download GET for a\n`304`. Files only; null for a folder.",
            "nullable": true
          },
          "modifiedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false,
        "description": "A file or a folder — the one shape every storage call answers an entry with: each row of\n`GET /list`, `GET /files/metadata`, file rename/move and upload complete (always\nMorph.Cloud.ApiModels.Storage.StorageEntryType.File), and folder create/rename/move (always\nMorph.Cloud.ApiModels.Storage.StorageEntryType.Folder). A folder answer is deliberately not a\nMorph.Cloud.ApiModels.Storage.FolderListingDto: a rename says nothing about what the folder contains, and\nanswering with a page of contents would make every rename pay for a listing."
      },
      "StorageEntryType": {
        "enum": [
          "Folder",
          "File"
        ],
        "type": "string",
        "description": "Kind of a listing entry. Serialized as its PascalCase name (`Folder` / `File`)."
      },
      "StorageErrorCode": {
        "enum": [
          "InvalidFileSize",
          "PathInvalid",
          "Unauthenticated",
          "CredentialExpired",
          "Forbidden",
          "NotFound",
          "AlreadyExists",
          "FolderNotEmpty",
          "Conflict",
          "UploadIncomplete",
          "UploadExpired",
          "PayloadTooLarge",
          "ContentRejected",
          "QuotaExceeded",
          "NotSupported"
        ],
        "type": "string",
        "description": "Stable error identifier carried in the storage error envelope\n(`error.code`). Compared for equality by clients; never parsed or ordered."
      },
      "TenantUsageDto": {
        "required": [
          "workflows"
        ],
        "type": "object",
        "properties": {
          "workflows": {
            "$ref": "#/components/schemas/QuotaUsageDto"
          }
        },
        "additionalProperties": false,
        "description": "What the caller's tenant holds against its account-level quotas (`GET /api/1.0/auth/usage`)."
      },
      "TestUploadResponseDto": {
        "type": "object",
        "properties": {
          "startResponse": {
            "$ref": "#/components/schemas/UploadTicketDto"
          },
          "uploadResponse": {
            "$ref": "#/components/schemas/ObjectPutResultDto"
          },
          "completeResponse": {
            "$ref": "#/components/schemas/CompleteUploadResponseDto"
          }
        },
        "additionalProperties": false,
        "description": "Combined result of `POST /storage/uploads/test-wrapper` — the test-only endpoint that performs start → PUT\n→ complete in one server-side call. Carries each underlying step's response so the whole flow is\ninspectable from one request."
      },
      "UploadMode": {
        "enum": [
          "Create",
          "Overwrite"
        ],
        "type": "string",
        "description": "How a start-upload request treats a pre-existing file at the target path.\nStored lowercase in the DB (see CloudDbContext); serialized as its PascalCase\nname on the wire (JsonStringEnumConverter, case-insensitive on read)."
      },
      "UploadTicketDto": {
        "type": "object",
        "properties": {
          "uploadId": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string",
            "description": "Presigned URL to PUT the bytes to.",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "maxBytes": {
            "type": "integer",
            "description": "The declared size: the only object size the complete will accept.",
            "format": "int64"
          }
        },
        "additionalProperties": false,
        "description": "Response of start-upload: an opaque presigned URL the client PUTs the bytes to directly. Not\ncached — an identical retried start re-mints an equivalent ticket (presigning is local, no S3\nround trip). The client sends the raw body with no extra headers."
      },
      "UserActivityDto": {
        "type": "object",
        "properties": {
          "day": {
            "type": "string",
            "format": "date"
          },
          "usersCreated": {
            "type": "integer",
            "format": "int32"
          },
          "sessionsCreated": {
            "type": "integer",
            "format": "int32"
          },
          "workflowsCreated": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "One row of the activity report: counts of entities created on a single calendar day (UTC)."
      },
      "UserAdminViewDto": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "userEmail": {
            "type": "string",
            "nullable": true
          },
          "userName": {
            "type": "string",
            "nullable": true
          },
          "tier": {
            "$ref": "#/components/schemas/UserTier"
          },
          "blockReason": {
            "$ref": "#/components/schemas/BlockReason"
          },
          "defaultSpace": {
            "$ref": "#/components/schemas/SpaceDto"
          },
          "workflowsCount": {
            "type": "integer",
            "format": "int32"
          },
          "workflowQuota": {
            "type": "integer",
            "description": "Workflow quota of the user's default tenant; null when the user has none. Compare with\nMorph.Cloud.ApiModels.Users.UserAdminViewDto.WorkflowsCount, which counts the user's live workflows.",
            "format": "int32",
            "nullable": true,
            "example": 50
          },
          "storageUsedBytes": {
            "type": "integer",
            "description": "Bytes used against the storage quota of the user's default tenant: committed files at\ntheir stored size plus uploads in progress at their declared size.",
            "format": "int64",
            "example": 52428800
          },
          "storageQuotaBytes": {
            "type": "integer",
            "description": "Storage quota of the user's default tenant; null when the user has none.",
            "format": "int64",
            "nullable": true,
            "example": 104857600
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastLoginAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UserListOrderBy": {
        "enum": [
          "DomainThenName",
          "WorkflowsCountDesc",
          "CreationAsc",
          "CreationDesc",
          "StorageUsedDesc"
        ],
        "type": "string",
        "description": "Sort options for the admin user list. Names bind from the `orderBy` query\nstring parameter (case-insensitive)."
      },
      "UserTier": {
        "enum": [
          0,
          1,
          2
        ],
        "type": "integer",
        "format": "int32"
      },
      "ValidateRequestDto": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "minLength": 1,
            "type": "string"
          },
          "age": {
            "maximum": 150,
            "minimum": 1,
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ValidateStartUploadRequestDto": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Store-relative destination path, e.g. `reports/2026/q3.dset`.",
            "nullable": true
          },
          "mode": {
            "$ref": "#/components/schemas/UploadMode"
          },
          "size": {
            "type": "integer",
            "description": "Declared byte size of the object being uploaded. Required — drives the ticket and reserves\nthat many bytes of the tenant's storage quota (refused with `QuotaExceeded`, HTTP 507,\nwhen it does not fit). Must not be negative (`InvalidFileSize`) or exceed the tenant's\nmaximum file size (`PayloadTooLarge`; reported as `maxFileSize` by\n`GET /storage/capabilities`), and the bytes that land must match it exactly, or the\ncomplete is refused.",
            "format": "int64"
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /storage/uploads/validate` — ask whether an upload to\nMorph.Cloud.ApiModels.Storage.StartUploadRequestDto.Path would be accepted, before a run spends the time\nproducing the data. Nothing is written and no ticket is minted. Same fields as a start; a\ncaller that does not know its size yet may omit it (read as 0), which passes the size and\nquota checks — every other rule still applies."
      },
      "ValidateStartUploadResponseDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "True when an upload start for this path, mode and size would be accepted right now."
          },
          "path": {
            "type": "string",
            "description": "Canonical form of the requested path. Null when the path could not be normalized at all.",
            "nullable": true
          },
          "wouldOverwrite": {
            "type": "boolean",
            "description": "True when the path holds an active file that Morph.Cloud.ApiModels.Storage.UploadMode.Overwrite would retire —\nthe \"this run replaces existing data\" warning. Always false under\nMorph.Cloud.ApiModels.Storage.UploadMode.Create, where an occupant is a refusal rather than a warning."
          },
          "code": {
            "$ref": "#/components/schemas/StorageErrorCode"
          },
          "message": {
            "type": "string",
            "description": "The message the refused call would have carried. Null when Morph.Cloud.ApiModels.Storage.ValidateStartUploadResponseDto.Ok.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Verdict of `POST /storage/uploads/validate`. Always answered with 200, including a refusal: \"would this\npath be accepted?\" has an answer either way, and returning the refusal's own status would be\nindistinguishable from the validate call itself having failed."
      },
      "WorkflowDto": {
        "required": [
          "payload",
          "payloadVersion"
        ],
        "type": "object",
        "properties": {
          "payloadVersion": {
            "type": "string",
            "nullable": true
          },
          "payload": { },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WorkflowResponseDto": {
        "required": [
          "createdBy",
          "payload",
          "payloadVersion",
          "spaceId",
          "updatedBy"
        ],
        "type": "object",
        "properties": {
          "payloadVersion": {
            "type": "string",
            "nullable": true
          },
          "payload": { },
          "name": {
            "type": "string",
            "nullable": true
          },
          "spaceId": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "string",
            "description": "Workflow Id",
            "nullable": true
          },
          "serverVersion": {
            "type": "integer",
            "description": "Should be passed back as IfMatch header",
            "format": "int64"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdBy": {
            "type": "string",
            "nullable": true
          },
          "updatedBy": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WorkflowResponseDtoPaginationResponseDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowResponseDto"
            },
            "description": "Items to return",
            "nullable": true
          },
          "sinceToken": {
            "type": "string",
            "description": "Filled whenever we reached last page of pagination. Should be used by frontend to sync changes from server",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "TestUser": {
        "type": "apiKey",
        "description": "Test user, e.g. alice@test2026.test",
        "name": "X-Test-User",
        "in": "header"
      },
      "TestSecret": {
        "type": "apiKey",
        "description": "Shared TestAuth secret",
        "name": "X-Test-Secret",
        "in": "header"
      },
      "Bearer": {
        "type": "http",
        "description": "Paste an Entra ID access token (no 'Bearer ' prefix). Tokens expire after ~60 min.",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "ActAs": {
        "type": "apiKey",
        "description": "Admin impersonation target email. Only honoured when the Bearer principal is on the admin allowlist.",
        "name": "X-Act-As",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "TestUser": [ ],
      "TestSecret": [ ],
      "Bearer": [ ],
      "ActAs": [ ]
    }
  ],
  "tags": [
    {
      "name": "ApiKeys",
      "description": "API keys management used by the EasyMorph Desktop connector"
    },
    {
      "name": "Auth"
    },
    {
      "name": "Diagnostics"
    },
    {
      "name": "Storage",
      "description": "Upload flow: start → presigned PUT → complete/abort. \nDownload flow: begin → presigned GET"
    },
    {
      "name": "Users"
    },
    {
      "name": "Workflow"
    }
  ]
}