{
  "openapi": "3.1.0",
  "info": {
    "title": "Linora API",
    "version": "v1",
    "description": "Public versioned API (ADR 0022), generated from shared/src/api.ts by tools/gen-openapi.mjs. Do not edit. Ops and presence also flow over the realtime WebSocket /v1/realtime?file=<fileId> (protocol 3, shared/src/messages.ts + codec.ts); mint its token with POST /v1/realtime/token. Authorization metadata: x-linora-scope (PAT scope), x-linora-role (minimum project role), x-linora-tier (answering tier).",
    "x-protocol-version": 3
  },
  "externalDocs": {
    "description": "Linora docs: guides, architecture and the design of this API",
    "url": "https://pathikdevani.github.io/linora/"
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "tags": [
    {
      "name": "auth"
    },
    {
      "name": "tokens"
    },
    {
      "name": "projects"
    },
    {
      "name": "members"
    },
    {
      "name": "files"
    },
    {
      "name": "pages"
    },
    {
      "name": "content"
    },
    {
      "name": "queries"
    }
  ],
  "paths": {
    "/v1/auth/signup": {
      "post": {
        "operationId": "signup",
        "summary": "Create an account and start a session.",
        "tags": [
          "auth"
        ],
        "x-linora-tier": "api",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignupReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": []
      }
    },
    "/v1/auth/login": {
      "post": {
        "operationId": "login",
        "summary": "Start a session (sets the linora_session cookie).",
        "tags": [
          "auth"
        ],
        "x-linora-tier": "api",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": []
      }
    },
    "/v1/auth/logout": {
      "post": {
        "operationId": "logout",
        "summary": "End the current session.",
        "tags": [
          "auth"
        ],
        "x-linora-tier": "api",
        "responses": {
          "204": {
            "description": "Done."
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": []
          }
        ]
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "me",
        "summary": "Current user.",
        "tags": [
          "auth"
        ],
        "x-linora-tier": "api",
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": []
          }
        ]
      }
    },
    "/v1/realtime/token": {
      "post": {
        "operationId": "realtimeToken",
        "summary": "Mint a short-lived signed token for the realtime WebSocket of one file.",
        "tags": [
          "auth"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:read",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeTokenReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeTokenRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      }
    },
    "/v1/me/sessions": {
      "get": {
        "operationId": "listSessions",
        "summary": "Your active browser sessions (browser session only).",
        "tags": [
          "auth"
        ],
        "x-linora-tier": "api",
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SessionDto"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": []
          }
        ]
      }
    },
    "/v1/me/sessions/{sessionId}": {
      "delete": {
        "operationId": "revokeSession",
        "summary": "Sign out one of your sessions (its realtime sockets are closed). Revoking the current one also clears its cookies.",
        "tags": [
          "auth"
        ],
        "x-linora-tier": "api",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done."
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": []
          }
        ]
      }
    },
    "/v1/me/sessions/revoke-others": {
      "post": {
        "operationId": "revokeOtherSessions",
        "summary": "Sign out every session except the current one.",
        "tags": [
          "auth"
        ],
        "x-linora-tier": "api",
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokeOtherSessionsRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": []
          }
        ]
      }
    },
    "/v1/tokens": {
      "get": {
        "operationId": "listTokens",
        "summary": "Personal access tokens.",
        "tags": [
          "tokens"
        ],
        "x-linora-tier": "api",
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TokenDto"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": []
          }
        ]
      },
      "post": {
        "operationId": "createToken",
        "summary": "Create a scoped personal access token (agents, scripts, MCP).",
        "tags": [
          "tokens"
        ],
        "x-linora-tier": "api",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTokenReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateTokenRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": []
          }
        ]
      }
    },
    "/v1/tokens/{tokenId}": {
      "delete": {
        "operationId": "revokeToken",
        "summary": "Revoke a token (open sockets minted from it are closed).",
        "tags": [
          "tokens"
        ],
        "x-linora-tier": "api",
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done."
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": []
          }
        ]
      }
    },
    "/v1/projects": {
      "get": {
        "operationId": "listProjects",
        "summary": "Projects you are a member of.",
        "tags": [
          "projects"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:read",
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProjectDto"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      },
      "post": {
        "operationId": "createProject",
        "summary": "Create a project (you become owner).",
        "tags": [
          "projects"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "projects:admin",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDto"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "projects:admin"
            ]
          }
        ]
      }
    },
    "/v1/projects/{projectId}": {
      "patch": {
        "operationId": "updateProject",
        "summary": "Rename a project.",
        "tags": [
          "projects"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "projects:admin",
        "x-linora-role": "owner",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDto"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "projects:admin"
            ]
          }
        ]
      },
      "delete": {
        "operationId": "deleteProject",
        "summary": "Delete a project (soft delete).",
        "tags": [
          "projects"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "projects:admin",
        "x-linora-role": "owner",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done."
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "projects:admin"
            ]
          }
        ]
      }
    },
    "/v1/projects/{projectId}/members": {
      "get": {
        "operationId": "listMembers",
        "summary": "Project members.",
        "tags": [
          "members"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MemberDto"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      },
      "post": {
        "operationId": "addMember",
        "summary": "Add an existing user by email.",
        "tags": [
          "members"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "projects:admin",
        "x-linora-role": "owner",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddMemberReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemberDto"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "projects:admin"
            ]
          }
        ]
      }
    },
    "/v1/projects/{projectId}/members/{userId}": {
      "patch": {
        "operationId": "updateMember",
        "summary": "Change a member role.",
        "tags": [
          "members"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "projects:admin",
        "x-linora-role": "owner",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMemberReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemberDto"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "projects:admin"
            ]
          }
        ]
      },
      "delete": {
        "operationId": "removeMember",
        "summary": "Remove a member (their sockets are closed).",
        "tags": [
          "members"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "projects:admin",
        "x-linora-role": "owner",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done."
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "projects:admin"
            ]
          }
        ]
      }
    },
    "/v1/projects/{projectId}/audit": {
      "get": {
        "operationId": "listAudit",
        "summary": "Membership and permission audit log.",
        "tags": [
          "members"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "projects:admin",
        "x-linora-role": "owner",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512,
              "description": "Opaque paging cursor."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AuditEntryDto"
                      }
                    },
                    "nextCursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 512,
                          "description": "Opaque paging cursor."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "entries",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "projects:admin"
            ]
          }
        ]
      }
    },
    "/v1/projects/{projectId}/files": {
      "get": {
        "operationId": "listFiles",
        "summary": "Files in a project.",
        "tags": [
          "files"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FileDto"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      },
      "post": {
        "operationId": "createFile",
        "summary": "Create a file with one empty page.",
        "tags": [
          "files"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:write",
        "x-linora-role": "editor",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFileReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDetailRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:write"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}": {
      "get": {
        "operationId": "getFile",
        "summary": "File with its pages.",
        "tags": [
          "files"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDetailRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateFile",
        "summary": "Rename a file.",
        "tags": [
          "files"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:write",
        "x-linora-role": "editor",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFileReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDto"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:write"
            ]
          }
        ]
      },
      "delete": {
        "operationId": "deleteFile",
        "summary": "Delete a file (soft delete).",
        "tags": [
          "files"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:write",
        "x-linora-role": "editor",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done."
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:write"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/client-ids": {
      "post": {
        "operationId": "allocClientId",
        "summary": "Allocate a clientId (node id space) for HTTP batches that create nodes.",
        "tags": [
          "files"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:write",
        "x-linora-role": "editor",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientIdRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:write"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages": {
      "post": {
        "operationId": "createPage",
        "summary": "Add a page.",
        "tags": [
          "pages"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:write",
        "x-linora-role": "editor",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePageReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageDto"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:write"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}": {
      "patch": {
        "operationId": "updatePage",
        "summary": "Rename or reorder a page.",
        "tags": [
          "pages"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:write",
        "x-linora-role": "editor",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePageReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageDto"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:write"
            ]
          }
        ]
      },
      "delete": {
        "operationId": "deletePage",
        "summary": "Delete a page (a file keeps at least one).",
        "tags": [
          "pages"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:write",
        "x-linora-role": "editor",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done."
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:write"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}/snapshot": {
      "get": {
        "operationId": "snapshot",
        "summary": "Binary page snapshot (gzip; headers X-Linora-Seq, ETag). Then subscribe over the realtime API with sinceSeq.",
        "tags": [
          "content"
        ],
        "x-linora-tier": "api",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Binary body.",
            "content": {
              "application/vnd.linora.snapshot": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/vnd.linora.snapshot",
                  "description": "Canonical page snapshot, served with Content-Encoding: gzip (headers X-Linora-Seq, ETag)."
                }
              }
            }
          },
          "304": {
            "description": "Not modified (If-None-Match matched the ETag)."
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}/ops": {
      "post": {
        "operationId": "applyOps",
        "summary": "Apply a batch of ops through the realtime pipeline (validated, sequenced, journaled, broadcast).",
        "tags": [
          "content"
        ],
        "x-linora-tier": "realtime",
        "x-linora-scope": "files:write",
        "x-linora-role": "editor",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyOpsReq"
              }
            },
            "application/vnd.linora.ops": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/vnd.linora.ops",
                "description": "codec.ts op list; clientGrant/clientSeq in X-Linora-Client-Grant / X-Linora-Client-Seq headers."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyOpsRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:write"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}/summary": {
      "get": {
        "operationId": "summary",
        "summary": "Counts by type, bounds, top-level frames.",
        "tags": [
          "queries"
        ],
        "x-linora-tier": "docworker",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "topLevelLimit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "minSeq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Read-your-writes: wait (<= 2 s) until the doc worker has applied this seq, else 503 + Retry-After."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SummaryRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}/outline": {
      "get": {
        "operationId": "outline",
        "summary": "Depth/size-limited text outline of the layer tree.",
        "tags": [
          "queries"
        ],
        "x-linora-tier": "docworker",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "root",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,8}:\\d{1,9}$",
              "description": "Node id \"client:counter\", e.g. \"3:1042\"."
            }
          },
          {
            "name": "depth",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 32
            }
          },
          {
            "name": "maxNodes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512,
              "description": "Opaque paging cursor."
            }
          },
          {
            "name": "minSeq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Read-your-writes: wait (<= 2 s) until the doc worker has applied this seq, else 503 + Retry-After."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutlineRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}/nodes/get": {
      "post": {
        "operationId": "getNodes",
        "summary": "Nodes by id with field selection and optional descendants.",
        "tags": [
          "queries"
        ],
        "x-linora-tier": "docworker",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetNodesReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeTableRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}/nodes/search": {
      "post": {
        "operationId": "searchNodes",
        "summary": "Find nodes by name, type, text, region or ancestor, paged.",
        "tags": [
          "queries"
        ],
        "x-linora-tier": "docworker",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchNodesReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeTableRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}/changes": {
      "get": {
        "operationId": "changes",
        "summary": "Ids created/changed/deleted since a seq.",
        "tags": [
          "queries"
        ],
        "x-linora-tier": "docworker",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Page sequence number."
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangesRes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      }
    },
    "/v1/files/{fileId}/pages/{pageId}/render": {
      "get": {
        "operationId": "render",
        "summary": "PNG or SVG of nodes or a region.",
        "tags": [
          "queries"
        ],
        "x-linora-tier": "docworker",
        "x-linora-scope": "files:read",
        "x-linora-role": "viewer",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "ids",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Comma-separated node ids."
            }
          },
          {
            "name": "x",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "y",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "w",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "h",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "maxSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 64,
              "maximum": 2048
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "png",
                "svg"
              ]
            }
          },
          {
            "name": "minSeq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Read-your-writes: wait (<= 2 s) until the doc worker has applied this seq, else 503 + Retry-After."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Binary body.",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "image/png"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "image/svg+xml"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        },
        "security": [
          {
            "session": []
          },
          {
            "pat": [
              "files:read"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AddMemberReq": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "editor",
              "viewer"
            ]
          }
        },
        "required": [
          "email",
          "role"
        ],
        "additionalProperties": false
      },
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "bad_request",
              "unauthorized",
              "forbidden",
              "not_found",
              "conflict",
              "email_taken",
              "invalid_credentials",
              "rate_limited",
              "too_large",
              "unavailable",
              "internal"
            ]
          },
          "message": {
            "type": "string"
          },
          "fields": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        },
        "required": [
          "error",
          "message"
        ],
        "additionalProperties": false
      },
      "ApplyOpsReq": {
        "type": "object",
        "properties": {
          "ops": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JsonOp"
            },
            "minItems": 1,
            "maxItems": 50000
          },
          "clientGrant": {
            "type": "string",
            "description": "Required when the batch CREATEs nodes (from POST .../client-ids)."
          },
          "clientSeq": {
            "type": "integer",
            "minimum": 1,
            "description": "Idempotency: resending the same (grant, clientSeq) returns the original result."
          }
        },
        "required": [
          "ops"
        ],
        "additionalProperties": false
      },
      "ApplyOpsRes": {
        "type": "object",
        "properties": {
          "seq": {
            "type": "integer",
            "minimum": 0,
            "description": "Page sequence number."
          },
          "applied": {
            "type": "integer"
          },
          "rejected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Rejected"
            }
          }
        },
        "required": [
          "seq",
          "applied",
          "rejected"
        ],
        "additionalProperties": false
      },
      "AuditEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "action": {
            "type": "string",
            "description": "e.g. member.add, member.role, member.remove, token.create, token.revoke, project.delete, file.delete"
          },
          "target": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "detail": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "id",
          "at",
          "actor",
          "action",
          "target",
          "detail"
        ],
        "additionalProperties": false
      },
      "ChangesRes": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "minimum": 0,
            "description": "Page sequence number."
          },
          "created": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeIdStr"
            }
          },
          "changed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeIdStr"
            }
          },
          "deleted": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeIdStr"
            }
          },
          "authors": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "required": [
          "pageId",
          "seq",
          "created",
          "changed",
          "deleted",
          "authors",
          "truncated"
        ],
        "additionalProperties": false
      },
      "ClientIdRes": {
        "type": "object",
        "properties": {
          "clientId": {
            "type": "integer"
          },
          "clientGrant": {
            "type": "string",
            "description": "Pass with HTTP op batches that CREATE nodes (ids must be \"<clientId>:<n>\")."
          }
        },
        "required": [
          "clientId",
          "clientGrant"
        ],
        "additionalProperties": false
      },
      "CreateFileReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "CreatePageReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "afterPageId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "CreateProjectReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "CreateTokenReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "files:read",
                "files:write",
                "projects:admin"
              ]
            },
            "minItems": 1
          },
          "projectIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 100
          },
          "expiresInDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          }
        },
        "required": [
          "name",
          "scopes"
        ],
        "additionalProperties": false
      },
      "CreateTokenRes": {
        "type": "object",
        "properties": {
          "token": {
            "$ref": "#/components/schemas/TokenDto"
          },
          "secret": {
            "type": "string",
            "description": "Shown once: \"linora_pat_...\" . Only its hash is stored."
          }
        },
        "required": [
          "token",
          "secret"
        ],
        "additionalProperties": false
      },
      "FileDetailRes": {
        "type": "object",
        "properties": {
          "file": {
            "$ref": "#/components/schemas/FileDto"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "editor",
              "viewer"
            ]
          },
          "pages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PageDto"
            }
          }
        },
        "required": [
          "file",
          "role",
          "pages"
        ],
        "additionalProperties": false
      },
      "FileDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "projectId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "thumbnailUrl": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "projectId",
          "name",
          "createdAt",
          "updatedAt",
          "thumbnailUrl"
        ],
        "additionalProperties": false
      },
      "GetNodesReq": {
        "type": "object",
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeIdStr"
            },
            "minItems": 1,
            "maxItems": 10000
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "id",
                "type",
                "name",
                "parent",
                "key",
                "bounds",
                "x",
                "y",
                "width",
                "height",
                "rotation",
                "fill",
                "stroke",
                "strokeWidth",
                "cornerRadius",
                "opacity",
                "visible",
                "locked",
                "clipContent",
                "text",
                "fontSize",
                "fontWeight",
                "textAlign",
                "lineHeight",
                "textSizing",
                "points",
                "childCount",
                "all"
              ]
            },
            "maxItems": 32
          },
          "childDepth": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "cursor": {
            "type": "string",
            "maxLength": 512,
            "description": "Opaque paging cursor."
          },
          "minSeq": {
            "type": "integer",
            "minimum": 0,
            "description": "Read-your-writes: wait (<= 2 s) until the doc worker has applied this seq, else 503 + Retry-After."
          }
        },
        "required": [
          "ids"
        ],
        "additionalProperties": false
      },
      "JsonCreateOp": {
        "type": "object",
        "properties": {
          "op": {
            "const": "create"
          },
          "id": {
            "$ref": "#/components/schemas/NodeIdStr"
          },
          "type": {
            "type": "string",
            "enum": [
              "frame",
              "group",
              "rect",
              "ellipse",
              "line",
              "arrow",
              "polygon",
              "star",
              "path",
              "text"
            ]
          },
          "parent": {
            "$ref": "#/components/schemas/NodeIdStr"
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "props": {
            "type": "object",
            "additionalProperties": {},
            "maxProperties": 64
          }
        },
        "required": [
          "op",
          "id",
          "type",
          "parent",
          "key"
        ],
        "additionalProperties": false
      },
      "JsonDeleteOp": {
        "type": "object",
        "properties": {
          "op": {
            "const": "delete"
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeIdStr"
            },
            "minItems": 1,
            "maxItems": 50000
          }
        },
        "required": [
          "op",
          "ids"
        ],
        "additionalProperties": false
      },
      "JsonOp": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/JsonCreateOp"
          },
          {
            "anyOf": [
              {
                "$ref": "#/components/schemas/JsonSetOp"
              },
              {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/JsonDeleteOp"
                  },
                  {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/JsonTransformOp"
                      },
                      {
                        "$ref": "#/components/schemas/JsonSetGeometryOp"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "JsonSetGeometryOp": {
        "type": "object",
        "properties": {
          "op": {
            "const": "setGeometry"
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeIdStr"
            },
            "minItems": 1,
            "maxItems": 50000
          },
          "x": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 1,
            "maxItems": 50000,
            "description": "x: one value per id, in ids order."
          },
          "y": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 1,
            "maxItems": 50000,
            "description": "y: one value per id, in ids order."
          },
          "w": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 1,
            "maxItems": 50000,
            "description": "width: one value per id, in ids order."
          },
          "h": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 1,
            "maxItems": 50000,
            "description": "height: one value per id, in ids order."
          },
          "rotation": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 1,
            "maxItems": 50000,
            "description": "rotation (radians): one value per id, in ids order."
          }
        },
        "required": [
          "op",
          "ids"
        ],
        "additionalProperties": false
      },
      "JsonSetOp": {
        "type": "object",
        "properties": {
          "op": {
            "const": "set"
          },
          "id": {
            "$ref": "#/components/schemas/NodeIdStr"
          },
          "props": {
            "type": "object",
            "additionalProperties": {},
            "maxProperties": 64
          }
        },
        "required": [
          "op",
          "id",
          "props"
        ],
        "additionalProperties": false
      },
      "JsonTransformOp": {
        "type": "object",
        "properties": {
          "op": {
            "const": "transform"
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeIdStr"
            },
            "minItems": 1,
            "maxItems": 50000
          },
          "dx": {
            "type": "number"
          },
          "dy": {
            "type": "number"
          }
        },
        "required": [
          "op",
          "ids",
          "dx",
          "dy"
        ],
        "additionalProperties": false
      },
      "LoginReq": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254
          },
          "password": {
            "type": "string",
            "maxLength": 256
          }
        },
        "required": [
          "email",
          "password"
        ],
        "additionalProperties": false
      },
      "MemberDto": {
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "email": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "email",
              "name"
            ],
            "additionalProperties": false
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "editor",
              "viewer"
            ]
          },
          "addedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "user",
          "role",
          "addedAt"
        ],
        "additionalProperties": false
      },
      "MeRes": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/UserDto"
          }
        },
        "required": [
          "user"
        ],
        "additionalProperties": false
      },
      "NodeIdStr": {
        "type": "string",
        "pattern": "^\\d{1,8}:\\d{1,9}$",
        "description": "Node id \"client:counter\", e.g. \"3:1042\"."
      },
      "NodeTableRes": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "minimum": 0,
            "description": "Page sequence number."
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {}
            }
          },
          "total": {
            "type": "integer"
          },
          "truncated": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512,
                "description": "Opaque paging cursor."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "pageId",
          "seq",
          "columns",
          "rows",
          "total",
          "truncated",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "OutlineRes": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "minimum": 0,
            "description": "Page sequence number."
          },
          "outline": {
            "type": "string",
            "description": "One line per node: `<indent><id> <type> \"<name>\" x,y wxh` (+ ` [+N: 3 rect, 2 text]` when collapsed)."
          },
          "truncated": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512,
                "description": "Opaque paging cursor."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "pageId",
          "seq",
          "outline",
          "truncated",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "PageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "fileId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "sortKey": {
            "type": "string"
          },
          "seq": {
            "type": "integer",
            "minimum": 0,
            "description": "Page sequence number."
          },
          "nodeCount": {
            "type": "integer",
            "description": "As of the last snapshot."
          }
        },
        "required": [
          "id",
          "fileId",
          "name",
          "sortKey",
          "seq",
          "nodeCount"
        ],
        "additionalProperties": false
      },
      "ProjectDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "editor",
              "viewer"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "role",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "RealtimeTokenReq": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "fileId"
        ],
        "additionalProperties": false
      },
      "RealtimeTokenRes": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "description": "wss URL for this file (routes to the owning realtime instance)."
          }
        },
        "required": [
          "token",
          "expiresAt",
          "url"
        ],
        "additionalProperties": false
      },
      "Rejected": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "reason": {
            "type": "string"
          },
          "hint": {
            "type": "string"
          }
        },
        "required": [
          "index",
          "reason",
          "hint"
        ],
        "additionalProperties": false
      },
      "RevokeOtherSessionsRes": {
        "type": "object",
        "properties": {
          "revoked": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "revoked"
        ],
        "additionalProperties": false
      },
      "SearchNodesReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "nameRegex": {
            "type": "string",
            "maxLength": 200
          },
          "types": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "frame",
                "group",
                "rect",
                "ellipse",
                "line",
                "arrow",
                "polygon",
                "star",
                "path",
                "text"
              ]
            }
          },
          "text": {
            "type": "string",
            "maxLength": 200
          },
          "region": {
            "type": "object",
            "properties": {
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              },
              "w": {
                "type": "number",
                "minimum": 0
              },
              "h": {
                "type": "number",
                "minimum": 0
              },
              "mode": {
                "type": "string",
                "enum": [
                  "intersects",
                  "contains"
                ]
              }
            },
            "required": [
              "x",
              "y",
              "w",
              "h"
            ],
            "additionalProperties": false
          },
          "within": {
            "type": "string",
            "pattern": "^\\d{1,8}:\\d{1,9}$",
            "description": "Node id \"client:counter\", e.g. \"3:1042\"."
          },
          "maxDepth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 64
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "id",
                "type",
                "name",
                "parent",
                "key",
                "bounds",
                "x",
                "y",
                "width",
                "height",
                "rotation",
                "fill",
                "stroke",
                "strokeWidth",
                "cornerRadius",
                "opacity",
                "visible",
                "locked",
                "clipContent",
                "text",
                "fontSize",
                "fontWeight",
                "textAlign",
                "lineHeight",
                "textSizing",
                "points",
                "childCount",
                "all"
              ]
            },
            "maxItems": 32
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "cursor": {
            "type": "string",
            "maxLength": 512,
            "description": "Opaque paging cursor."
          },
          "minSeq": {
            "type": "integer",
            "minimum": 0,
            "description": "Read-your-writes: wait (<= 2 s) until the doc worker has applied this seq, else 503 + Retry-After."
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "SessionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "current": {
            "type": "boolean",
            "description": "The session making this request."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastSeenAt": {
            "type": "string",
            "format": "date-time",
            "description": "Updated at most once an hour."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "userAgent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "ip": {
            "anyOf": [
              {
                "type": "string",
                "description": "Client address at sign-in."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "current",
          "createdAt",
          "lastSeenAt",
          "expiresAt",
          "userAgent",
          "ip"
        ],
        "additionalProperties": false
      },
      "SignupReq": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "password": {
            "type": "string",
            "minLength": 8,
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "email",
          "password",
          "name"
        ],
        "additionalProperties": false
      },
      "SummaryRes": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "minimum": 0,
            "description": "Page sequence number."
          },
          "nodeCount": {
            "type": "integer"
          },
          "bounds": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "minItems": 4,
                "maxItems": 4,
                "description": "[x, y, w, h], page space."
              },
              {
                "type": "null"
              }
            ]
          },
          "countsByType": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "topLevel": {
            "$ref": "#/components/schemas/NodeTableRes"
          }
        },
        "required": [
          "pageId",
          "seq",
          "nodeCount",
          "bounds",
          "countsByType",
          "topLevel"
        ],
        "additionalProperties": false
      },
      "TokenDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "files:read",
                "files:write",
                "projects:admin"
              ]
            }
          },
          "projectIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Empty = all of the user's projects."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "scopes",
          "projectIds",
          "createdAt",
          "lastUsedAt",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "UpdateFileReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "UpdateMemberReq": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "editor",
              "viewer"
            ]
          }
        },
        "required": [
          "role"
        ],
        "additionalProperties": false
      },
      "UpdatePageReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "afterPageId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "UpdateProjectReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "UserDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "email",
          "name",
          "createdAt"
        ],
        "additionalProperties": false
      }
    },
    "responses": {
      "E400": {
        "description": "Invalid request (schema, format, Content-Type or query parameters); `fields` names the offending paths.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "E401": {
        "description": "Missing, invalid, expired or revoked credentials.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "E403": {
        "description": "Authenticated but not allowed: PAT scope, project role, session-only route, or CSRF/Origin check failed.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "E404": {
        "description": "Not found, or not visible to the caller (non-member, foreign tenant, PAT allow-list).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "E409": {
        "description": "Conflict with the current state (duplicate, last owner, limits).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "E413": {
        "description": "Body larger than the route limit.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "E429": {
        "description": "Rate limited; see Retry-After.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "E503": {
        "description": "Temporarily unavailable (dependency down, load shedding); see Retry-After.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "session": {
        "type": "apiKey",
        "in": "cookie",
        "name": "linora_session",
        "description": "Browser session (HttpOnly, SameSite=Lax; \"__Host-linora_session\" in production). Every non-GET request must also send X-CSRF-Token (from the X-CSRF-Token response header of signup/login/me, or the linora_csrf cookie) and an allowed Origin."
      },
      "pat": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "linora_pat_<43 base64url chars>",
        "description": "Personal access token with scopes files:read, files:write, projects:admin and an optional project allow-list. Cannot manage tokens or log out."
      }
    }
  }
}
