{
  "openapi": "3.1.0",
  "info": {
    "title": "CourtBriefly API",
    "version": "1.0.0",
    "description": "Full application operations for personal integrations. Authenticate with a scoped personal API token. API and MCP share account permissions and existing plan, storage, and AI allowances. 120 integration requests/minute/account across all tokens. Browser authentication and provider webhooks are not personal-token operations."
  },
  "servers": [
    {
      "url": "https://app.courtbriefly.com/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "personalToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "cc_live_…"
      }
    }
  },
  "paths": {
    "/account": {
      "get": {
        "operationId": "get_account",
        "tags": [
          "account"
        ],
        "summary": "GET /account",
        "description": "GET /api/account — the signed-in user's account summary.\nPlan / token figures are placeholders until billing (Stripe) is wired up.\n\nRequired permission: account:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "account:read"
      }
    },
    "/account/security": {
      "get": {
        "operationId": "get_account_security",
        "tags": [
          "account"
        ],
        "summary": "GET /account/security",
        "description": "Run the same account operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: account:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "account:read"
      },
      "post": {
        "operationId": "post_account_security",
        "tags": [
          "account"
        ],
        "summary": "POST /account/security",
        "description": "Run the same account operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: account:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "setup",
                      "enable",
                      "disable",
                      "revoke-sessions"
                    ]
                  },
                  "password": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "required": [
                  "action",
                  "password"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "account:write"
      }
    },
    "/account/terms": {
      "get": {
        "operationId": "get_account_terms",
        "tags": [
          "account"
        ],
        "summary": "GET /account/terms",
        "description": "Read the current terms and required consent version for the selected residence state.\n\nRequired permission: account:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "residenceState",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "account:read"
      },
      "post": {
        "operationId": "post_account_terms",
        "tags": [
          "account"
        ],
        "summary": "POST /account/terms",
        "description": "Record the user's explicit acceptance after they review the terms. Body: accepted=true, version, residenceState. Never infer consent.\n\nRequired permission: account:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "accepted": {
                    "const": true,
                    "description": "Only send after the user explicitly accepts the returned terms."
                  },
                  "version": {
                    "type": "string",
                    "description": "Current version from GET /account/terms."
                  },
                  "residenceState": {
                    "type": "string"
                  }
                },
                "required": [
                  "accepted",
                  "version",
                  "residenceState"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "account:write"
      }
    },
    "/assistant/chat": {
      "post": {
        "operationId": "post_assistant_chat",
        "tags": [
          "assistant"
        ],
        "summary": "POST /assistant/chat",
        "description": "POST /api/assistant/chat — { caseId, messages: [{role, text}] } Optional courtCaseId supplies validated current-case context for case-specific searches and creations; it does not grant additional permissions.\n\nRequired permission: *. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "messages": {},
                  "timeZone": {},
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "*"
      }
    },
    "/assistant/deletions/{id}/confirm": {
      "post": {
        "operationId": "post_assistant_deletions_by_id_confirm",
        "tags": [
          "assistant"
        ],
        "summary": "POST /assistant/deletions/{id}/confirm",
        "description": "Permanently delete the exact unchanged asset in a single-use proposal. Call only after the human confirms its displayed label. Requires the proposing user; rechecks permissions, expiry, asset fingerprint and archived-matter restrictions. The built-in AI cannot invoke this endpoint.\n\nRequired permission: *. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirmed": {
                    "const": true
                  }
                },
                "required": [
                  "confirmed"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "*"
      }
    },
    "/assistant/deletions": {
      "post": {
        "operationId": "post_assistant_deletions",
        "tags": [
          "assistant"
        ],
        "summary": "POST /assistant/deletions",
        "description": "Prepare deletion of one document (including attachments/history) or evidence item. Does not delete. Present label to the user and obtain explicit confirmation before calling the confirmation endpoint. Proposal expires after 10 minutes.\n\nRequired permission: *. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 150
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "document",
                      "evidence"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 150
                  }
                },
                "required": [
                  "caseId",
                  "kind",
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "*"
      }
    },
    "/attorney-notes": {
      "get": {
        "operationId": "get_attorney_notes",
        "tags": [
          "attorney-notes"
        ],
        "summary": "GET /attorney-notes",
        "description": "Attorney work-product notes on a case (caseId), optionally one item\n(category + itemId). Returns only notes you may read: your own; notes your\nfirm team shared with you on this matter; and, for the case owner, notes an\nattorney released to them. format=markdown downloads your own notes.\n\nRequired permission: attorney-notes:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "attorney-notes:read"
      },
      "post": {
        "operationId": "post_attorney_notes",
        "tags": [
          "attorney-notes"
        ],
        "summary": "POST /attorney-notes",
        "description": "create: a private note on the case or one item you can see (invited\nattorneys, advocates and firm staff; not the case owner). update / delete:\nyour own notes. sharedWithFirm shares a note with your assigned firm team on\nthis matter. release: show a note to the client (the case owner) and include\nit in their Case Bundle; withdraw: stop showing it (copies they already\ndownloaded can't be recalled). Notes are never visible to other members.\n\nRequired permission: attorney-notes:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "create"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "body": {
                        "type": "string",
                        "maxLength": 20000
                      },
                      "category": {
                        "type": "string",
                        "maxLength": 40
                      },
                      "itemId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "sharedWithFirm": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "action",
                      "caseId",
                      "body"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "update"
                      },
                      "noteId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "body": {
                        "type": "string",
                        "maxLength": 20000
                      },
                      "sharedWithFirm": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "action",
                      "noteId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "delete"
                      },
                      "noteId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "noteId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "release"
                      },
                      "noteId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "noteId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "withdraw"
                      },
                      "noteId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "noteId"
                    ],
                    "additionalProperties": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "attorney-notes:write"
      }
    },
    "/billing/cancel": {
      "post": {
        "operationId": "post_billing_cancel",
        "tags": [
          "billing"
        ],
        "summary": "POST /billing/cancel",
        "description": "POST /api/billing/cancel — cancel or resume a subscription without leaving\nthe app (Account → Billing → Cancel → Confirm).\n  { action: \"cancel\", subscriptionId?, reason? }  card trial: ends on its date,\n     never charged; paid plan: stops at the end of the paid period. `reason`\n     is the optional \"why?\" answer (skippable).\n  { action: \"resume\", subscriptionId? }  turn renewal back on before the end.\n     In the native app this returns { url } for the Stripe billing portal\n     instead (no charge commitments from the WebView; docs/MOBILE_PAYMENTS.md).\nsubscriptionId (our Subscription id from /api/billing/status) is needed only\nwhen the account has more than one live subscription.\n\nRequired permission: billing:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "cancel",
                      "resume"
                    ]
                  },
                  "subscriptionId": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "too_expensive",
                      "unused",
                      "missing_features",
                      "too_complex",
                      "other"
                    ]
                  }
                },
                "required": [
                  "action"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:write"
      }
    },
    "/billing/checkout": {
      "post": {
        "operationId": "post_billing_checkout",
        "tags": [
          "billing"
        ],
        "summary": "POST /billing/checkout",
        "description": "POST /api/billing/checkout\n  subscription: { plan, interval: \"month\"|\"year\" }\n  card trial:   { plan: \"suite\", interval, trial: true, firstChargeAt, timeZone, disclosureText }\n                (new accounts only, one per account — lib/cardTrial.ts; the\n                last three echo the terms shown next to the button; 409\n                code \"terms_changed\" returns a fresh `offer` to show instead)\n  one-time:     { kind, quantity?, caseId? }\n  optional source: plans_page | paywall_<code> | marketing | native (analytics)\nReturns { url } — the Stripe Checkout URL to redirect to. Choosing a suite\ntier while holding a lower plan (single-tool plans, or Full Suite when buying\nFull Suite Max) returns a Stripe page that converts the existing plan instead\n(no second subscription); buying a plan the account already has, or a lower\none than it holds, is refused with 409.\n\nRequired permission: billing:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source": {},
                  "returnTo": {},
                  "plan": {},
                  "interval": {},
                  "trial": {},
                  "firstChargeAt": {},
                  "timeZone": {},
                  "disclosureText": {},
                  "kind": {},
                  "quantity": {},
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "documentId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:write"
      }
    },
    "/billing/invoices": {
      "get": {
        "operationId": "get_billing_invoices",
        "tags": [
          "billing"
        ],
        "summary": "GET /billing/invoices",
        "description": "GET /api/billing/invoices — the customer's last 12 Stripe invoices for the\nBilling tab. Returns an empty list (never an error) when the user has no Stripe\ncustomer yet, so the UI can render a clean \"no invoices\" state.\n\nRequired permission: billing:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:read"
      }
    },
    "/billing/portal": {
      "post": {
        "operationId": "post_billing_portal",
        "tags": [
          "billing"
        ],
        "summary": "POST /billing/portal",
        "description": "POST /api/billing/portal — open the Stripe Billing Portal for the current user.\nReturns { url }.\n\nRequired permission: billing:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:write"
      }
    },
    "/billing/refund": {
      "post": {
        "operationId": "post_billing_refund",
        "tags": [
          "billing"
        ],
        "summary": "POST /billing/refund",
        "description": "The buyer explicitly requests a full refund. No staff document review or reason\nis required. Persist the request before Stripe so ambiguous failures can retry.\n  { purchaseId }      Court Document Package, within 14 days of payment\n  { subscriptionId }  \"forgot to cancel\": a card trial's first charge, within\n                      7 days of it; also cancels the plan (lib/firstChargeRefund.ts)\n\nRequired permission: billing:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subscriptionId": {},
                  "purchaseId": {},
                  "find": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:write"
      }
    },
    "/billing/status": {
      "get": {
        "operationId": "get_billing_status",
        "tags": [
          "billing"
        ],
        "summary": "GET /billing/status",
        "description": "GET /api/billing/status — current entitlements + usage for the billing UI.\nCard trial (lib/cardTrial.ts): trial.card / trial.cancelAtPeriodEnd /\ntrial.firstCharge describe a running card trial; trialOffer says whether the\naccount may still start its one trial; each subscription carries its id (for\n/api/billing/cancel and the first-charge refund) and its refund window.\n\nRequired permission: billing:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:read"
      }
    },
    "/billing/upgrade": {
      "post": {
        "operationId": "post_billing_upgrade",
        "tags": [
          "billing"
        ],
        "summary": "POST /billing/upgrade",
        "description": "POST /api/billing/upgrade { plan?: \"suite\" | \"suite_max\" } — in-place upgrade\nto a suite tier (default \"suite\", the Full Suite).\n  - From single-product plan(s): keep the user's FIRST active single-plan\n    subscription and swap its Stripe line item to the target price (same\n    interval, prorated). Any OTHER active single-plan subscriptions are set to\n    cancel at period end so the user isn't double-billed but keeps access until\n    the period they've paid for ends.\n  - To Full Suite Max from the Full Suite: swap the Full Suite subscription's\n    line item to the Max price (same interval, prorated).\nThe local Subscription.plan is flipped optimistically; the webhook\n(customer.subscription.updated) is the source of truth and will reconfirm it.\n\nRequired permission: billing:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plan": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:write"
      }
    },
    "/billing/workspace-seat": {
      "post": {
        "operationId": "post_billing_workspace_seat",
        "tags": [
          "billing"
        ],
        "summary": "POST /billing/workspace-seat",
        "description": "POST /api/billing/workspace-seat — add one $25/mo workspace seat.\nIf the user already has a workspace subscription, bump its quantity (prorated);\notherwise start one via Checkout and return the URL to redirect to.\n\nRequired permission: billing:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:write"
      },
      "delete": {
        "operationId": "delete_billing_workspace_seat",
        "tags": [
          "billing"
        ],
        "summary": "DELETE /billing/workspace-seat",
        "description": "DELETE /api/billing/workspace-seat — release one seat. Refuses if the user is\nstill using more workspaces than the reduced allowance would permit.\n\nRequired permission: billing:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "billing:write"
      }
    },
    "/case-closed": {
      "get": {
        "operationId": "get_case_closed",
        "tags": [
          "case-closed"
        ],
        "summary": "GET /case-closed",
        "description": "Case Closed status. With caseId: whether the paid Case Closed purchase is on\nthat case, unused purchases, and whether the case is closed (read-only).\nWithout caseId: every case you own with its Case Closed state.\n\nRequired permission: case-closed:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "case-closed:read"
      },
      "post": {
        "operationId": "post_case_closed",
        "tags": [
          "case-closed"
        ],
        "summary": "POST /case-closed",
        "description": "close: make a case you own read-only (\"dormant\") using its paid Case Closed\npurchase (an unused purchase is bound to the case). Reading, exports and the\nCase Bundle keep working on any plan, forever. Answers 402 without a\npurchase. reopen: end read-only mode; writes follow your plan's limits again.\n\nRequired permission: case-closed:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "close"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "caseId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "reopen"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "caseId"
                    ],
                    "additionalProperties": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "case-closed:write"
      }
    },
    "/case": {
      "get": {
        "operationId": "get_case",
        "tags": [
          "case"
        ],
        "summary": "GET /case",
        "description": "GET /api/case — the case for the ACTIVE CONTEXT (set by the top-left switcher):\n  * workspace context → the user's own case in that workspace (created lazily).\n  * shared context     → the case an owner shared with this user, returned as a\n    collaborator-scoped shell. The layout is identical; permissions simply\n    blank out what hasn't been shared (fail-closed).\n\nRequired permission: case:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "case:read"
      }
    },
    "/case/update": {
      "post": {
        "operationId": "post_case_update",
        "tags": [
          "case"
        ],
        "summary": "POST /case/update",
        "description": "POST /api/case/update — { caseId, caption?, role?, caseNumbers?: [{number,type,court}], keyDates?: [{date,label,kind}] }\ncaseNumbers/keyDates are full-replace arrays when present.\n\nRequired permission: case:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseNumbers": {},
                  "keyDates": {},
                  "caption": {},
                  "role": {},
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "case:write"
      }
    },
    "/collaboration/restore": {
      "post": {
        "operationId": "post_collaboration_restore",
        "tags": [
          "collaboration"
        ],
        "summary": "POST /collaboration/restore",
        "description": "Run the same collaboration operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: collaboration:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "category": {
                    "type": "string"
                  },
                  "fileId": {
                    "type": "string"
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "collaboration:write"
      }
    },
    "/collaboration": {
      "get": {
        "operationId": "get_collaboration",
        "tags": [
          "collaboration"
        ],
        "summary": "GET /collaboration",
        "description": "Run the same collaboration operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: collaboration:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "collaboration:read"
      },
      "post": {
        "operationId": "post_collaboration",
        "tags": [
          "collaboration"
        ],
        "summary": "POST /collaboration",
        "description": "Run the same collaboration operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: collaboration:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "request"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "recipientUserId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "instructions": {
                        "type": "string",
                        "maxLength": 10000
                      },
                      "dueAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "action",
                      "caseId",
                      "recipientUserId",
                      "title"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "submit"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "recipientUserId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "requestId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "items": {},
                      "allowReshare": {
                        "type": "boolean"
                      },
                      "includeFirmTeam": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "action",
                      "caseId",
                      "recipientUserId",
                      "title",
                      "items"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "review"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "submissionId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "clarification",
                          "reviewed",
                          "approved"
                        ]
                      },
                      "note": {
                        "type": "string",
                        "maxLength": 10000
                      }
                    },
                    "required": [
                      "action",
                      "caseId",
                      "submissionId",
                      "status"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "message"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "audience": {
                        "type": "string",
                        "enum": [
                          "internal",
                          "recipients"
                        ]
                      },
                      "recipientUserIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 150
                        },
                        "maxItems": 50
                      },
                      "body": {
                        "type": "string",
                        "maxLength": 10000,
                        "minLength": 1
                      }
                    },
                    "required": [
                      "action",
                      "caseId",
                      "audience",
                      "body"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "notify-read"
                      },
                      "notificationId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "notificationId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "remind"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "requestId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "caseId",
                      "requestId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "connect-firm"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "items": {}
                    },
                    "required": [
                      "action",
                      "caseId",
                      "firmId",
                      "items"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "accept-connection"
                      },
                      "connectionId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "connectionId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "request-sponsor"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "caseId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "accept-sponsor"
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "caseId"
                    ],
                    "additionalProperties": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "collaboration:write"
      }
    },
    "/comms/decode": {
      "post": {
        "operationId": "post_comms_decode",
        "tags": [
          "comms"
        ],
        "summary": "POST /comms/decode",
        "description": "Comms Guard incoming decode: { message, context? } → the parts that need an\nanswer, the bait you can leave alone (exact quotes), and a calm draft reply\nwith [placeholders]. One AI operation. Not stored; log the message yourself.\n\nRequired permission: comms:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8000
                  },
                  "context": {
                    "type": "string",
                    "maxLength": 8000
                  }
                },
                "required": [
                  "message"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "comms:write"
      }
    },
    "/comms/draft": {
      "post": {
        "operationId": "post_comms_draft",
        "tags": [
          "comms"
        ],
        "summary": "POST /comms/draft",
        "description": "POST /api/comms/draft\n{ caseId, contactId, channel: \"email\"|\"sms\", intent, includeCase?, documentIds?, evidenceIds? }\n\nRequired permission: comms:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "channel": {},
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "contactId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "intent": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "includeCase": {},
                  "documentIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "evidenceIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "comms:write"
      }
    },
    "/comms/pull-imported": {
      "post": {
        "operationId": "post_comms_pull_imported",
        "tags": [
          "comms"
        ],
        "summary": "POST /comms/pull-imported",
        "description": "POST /api/comms/pull-imported — { caseId, contactId }\nLinks previously-imported messages whose participant matches this contact\n(by name, or by email) into the contact's threads, so they're available as\ncontext and show in the conversation. Returns how many were linked.\n\nRequired permission: comms:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "contactId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "comms:write"
      }
    },
    "/contacts": {
      "get": {
        "operationId": "get_contacts",
        "tags": [
          "contacts"
        ],
        "summary": "GET /contacts",
        "description": "GET /api/contacts?caseId= — people for this case, with message counts.\n\nRequired permission: contacts:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "contacts:read"
      },
      "post": {
        "operationId": "post_contacts",
        "tags": [
          "contacts"
        ],
        "summary": "POST /contacts",
        "description": "POST /api/contacts — { caseId, name, relationship?, email?, phone?, notes? }\n\nRequired permission: contacts:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "relationship": {},
                  "email": {},
                  "phone": {},
                  "notes": {},
                  "fields": {},
                  "courtCaseIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "contacts:write"
      },
      "patch": {
        "operationId": "patch_contacts",
        "tags": [
          "contacts"
        ],
        "summary": "PATCH /contacts",
        "description": "PATCH /api/contacts?id= — { name?, relationship?, email?, phone?, notes? }\n\nRequired permission: contacts:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "relationship": {},
                  "email": {},
                  "phone": {},
                  "notes": {},
                  "fields": {},
                  "courtCaseIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "contacts:write"
      },
      "delete": {
        "operationId": "delete_contacts",
        "tags": [
          "contacts"
        ],
        "summary": "DELETE /contacts",
        "description": "DELETE /api/contacts?id= — messages keep their history (contactId set null).\n\nRequired permission: contacts:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "contacts:write"
      }
    },
    "/court-cases": {
      "get": {
        "operationId": "get_court_cases",
        "tags": [
          "court-cases"
        ],
        "summary": "GET /court-cases",
        "description": "GET /api/court-cases?caseId=\n\nRequired permission: court-cases:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "court-cases:read"
      },
      "post": {
        "operationId": "post_court_cases",
        "tags": [
          "court-cases"
        ],
        "summary": "POST /court-cases",
        "description": "POST /api/court-cases — { caseId, number, title?, type?, court?, judge? }\n\nRequired permission: court-cases:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "state": {},
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "number": {},
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "type": {},
                  "court": {},
                  "judge": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "court-cases:write"
      },
      "patch": {
        "operationId": "patch_court_cases",
        "tags": [
          "court-cases"
        ],
        "summary": "PATCH /court-cases",
        "description": "PATCH /api/court-cases?id= — { number?, title?, type?, court?, judge? }\n\nRequired permission: court-cases:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "state": {},
                  "number": {},
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "type": {},
                  "court": {},
                  "judge": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "court-cases:write"
      },
      "delete": {
        "operationId": "delete_court_cases",
        "tags": [
          "court-cases"
        ],
        "summary": "DELETE /court-cases",
        "description": "DELETE /api/court-cases?id=\n\nRequired permission: court-cases:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "court-cases:write"
      }
    },
    "/deadlines": {
      "get": {
        "operationId": "get_deadlines",
        "tags": [
          "deadlines"
        ],
        "summary": "GET /deadlines",
        "description": "GET /api/deadlines — the deadline templates and how each counts its date with your planning timing\n(Reminder rules → timing). Templates: subpoena and discovery_serve count back from a hearing;\ndiscovery_responses_due and discovery_respond count forward from the date served.\n\nRequired permission: deadlines:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "deadlines:read"
      },
      "post": {
        "operationId": "post_deadlines",
        "tags": [
          "deadlines"
        ],
        "summary": "POST /deadlines",
        "description": "POST /api/deadlines — add a deadline. With a template the date is worked out for you: subpoena / discovery_serve\nneed hearingId; discovery_responses_due / discovery_respond need anchorDate (the date served). Without a template,\nsend title + due. Optional: dueTime, title/body overrides, leadDays/responseDays overrides for this item only,\nreminderDays (custom days before; otherwise your deadline rules apply), followUpDays, courtCaseId.\npreview: true returns the computed deadline without saving. The saved item is a to-do of kind \"deadline\".\n\nRequired permission: deadlines:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "template": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "subpoena",
                          "discovery_serve",
                          "discovery_responses_due",
                          "discovery_respond"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "hearingId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "anchorDate": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "due": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dueTime": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "body": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 20000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "courtCaseId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "leadDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "responseDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reminderDays": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 365
                    },
                    "maxItems": 15
                  },
                  "followUpDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "preview": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "caseId"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "deadlines:write"
      }
    },
    "/developer/tokens": {
      "get": {
        "operationId": "get_developer_tokens",
        "tags": [
          "tokens"
        ],
        "summary": "GET /developer/tokens",
        "description": "Run the same tokens operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: tokens:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "tokens:read"
      },
      "post": {
        "operationId": "post_developer_tokens",
        "tags": [
          "tokens"
        ],
        "summary": "POST /developer/tokens",
        "description": "Run the same tokens operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: tokens:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "tokens:write"
      },
      "patch": {
        "operationId": "patch_developer_tokens",
        "tags": [
          "tokens"
        ],
        "summary": "PATCH /developer/tokens",
        "description": "Run the same tokens operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: tokens:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {}
                  },
                  "expiresAt": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "tokens:write"
      },
      "delete": {
        "operationId": "delete_developer_tokens",
        "tags": [
          "tokens"
        ],
        "summary": "DELETE /developer/tokens",
        "description": "Run the same tokens operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: tokens:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "tokens:write"
      }
    },
    "/document-templates/{id}/reviewer": {
      "post": {
        "operationId": "post_document_templates_by_id_reviewer",
        "tags": [
          "document-templates"
        ],
        "summary": "POST /document-templates/{id}/reviewer",
        "description": "Run the same document-templates operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: document-templates:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "document-templates:write"
      }
    },
    "/documents/{id}/court/preview": {
      "post": {
        "operationId": "post_documents_by_id_court_preview",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents/{id}/court/preview",
        "description": "Run the same documents operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/documents/{id}/court": {
      "get": {
        "operationId": "get_documents_by_id_court",
        "tags": [
          "documents"
        ],
        "summary": "GET /documents/{id}/court",
        "description": "Run the same documents operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: documents:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:read"
      },
      "patch": {
        "operationId": "patch_documents_by_id_court",
        "tags": [
          "documents"
        ],
        "summary": "PATCH /documents/{id}/court",
        "description": "Run the same documents operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedHash": {},
                  "review": {},
                  "settings": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      },
      "post": {
        "operationId": "post_documents_by_id_court",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents/{id}/court",
        "description": "Run the same documents operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedHash": {},
                  "signatureMode": {},
                  "pngDataUrl": {},
                  "esignConsent": {},
                  "signatureMethod": {},
                  "saveSignature": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/documents/{id}/export": {
      "get": {
        "operationId": "get_documents_by_id_export",
        "tags": [
          "documents"
        ],
        "summary": "GET /documents/{id}/export",
        "description": "Run the same documents operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: documents:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:read"
      },
      "post": {
        "operationId": "post_documents_by_id_export",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents/{id}/export",
        "description": "Final court exports are explicit POSTs: review and signing must match the\nexact snapshot rendered, and the download fails if its audit write fails.\nFormats (lib/courtApiTypes.ts CourtExportRequest): pdf | docx | packet need an\ne-signature on the revision; \"print-to-sign\" is the final, unwatermarked copy\nwith a blank line for a handwritten signature (no e-signature needed);\npacket/package may lead with the attached signed scan of this revision\n(leadSource \"signed-scan\", which replaces the e-signature; it is also the\ndefault when the revision has a current scan and no e-signature). \"package\" is a ZIP\n(signed paper, exhibit packet, exported cover sheets/forms as separate files,\na mechanical checklist). Every format needs the entitlement (402).\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "format": {},
                  "leadSource": {},
                  "includeExhibitList": {},
                  "expectedHash": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/documents/{id}/extract": {
      "post": {
        "operationId": "post_documents_by_id_extract",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents/{id}/extract",
        "description": "POST /api/documents/[id]/extract — re-run deterministic text extraction (no AI)\non the document's uploaded file, replacing the body with the extracted text.\nbody: { fileId? }  (defaults to the document's first file)\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/documents/{id}/versions": {
      "get": {
        "operationId": "get_documents_by_id_versions",
        "tags": [
          "documents"
        ],
        "summary": "GET /documents/{id}/versions",
        "description": "List prior text versions, newest first. Requires document edit permission; view-only shares do not expose historical text. GET ?versionId= returns one full snapshot; ?before= is the nextCursor from a preceding page.\n\nRequired permission: documents:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "versionId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:read"
      },
      "post": {
        "operationId": "post_documents_by_id_versions",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents/{id}/versions",
        "description": "Restore a prior title/body/record-notes snapshot. Saves current text as another version; preserves attachments and sharing, clears signatures/review, and returns 409 if the document changed. Storage quota applies.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "versionId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 150
                  },
                  "expectedUpdatedAt": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "versionId",
                  "expectedUpdatedAt"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/documents/draft": {
      "post": {
        "operationId": "post_documents_draft",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents/draft",
        "description": "Run the same documents operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "instructions": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "documentId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "templateId": {},
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "genericAcknowledged": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/documents/files/{id}/restore": {
      "post": {
        "operationId": "post_documents_files_by_id_restore",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents/files/{id}/restore",
        "description": "Run the same documents operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "acceptMismatch": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/documents/files/{id}": {
      "get": {
        "operationId": "get_documents_files_by_id",
        "tags": [
          "documents"
        ],
        "summary": "GET /documents/files/{id}",
        "description": "GET /api/documents/files/[id] — stream an uploaded document file (access-checked).\n  ?preview=1 — browser-renderable image (HEIC/HEIF → cached JPEG; others as stored).\nPreviews, and downloads by anyone but the case owner, have photo/video location\nmetadata removed; the owner's download is the raw original.\n\nRequired permission: documents:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "preview",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:read"
      }
    },
    "/documents": {
      "get": {
        "operationId": "get_documents",
        "tags": [
          "documents"
        ],
        "summary": "GET /documents",
        "description": "GET /api/documents?caseId=&courtCaseId=  (scope-aware)\n\nRequired permission: documents:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "folderId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:read"
      },
      "post": {
        "operationId": "post_documents",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents",
        "description": "POST /api/documents — { caseId, courtCaseId?, title, kind?, body?, templateId? }\nOwner/attorney always; a collaborator may contribute if granted EDIT on the\nwhole documents category (two-way sharing). When `templateId` is given the\nbody/kind/title are built here from a family-court template merged with the\ncase's real data (caption, court file, next hearing, contacts), so the created\ndocument already carries filled-in merge values.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "body": {},
                  "templateId": {},
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "folderId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kind": {},
                  "genericAcknowledged": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      },
      "patch": {
        "operationId": "patch_documents",
        "tags": [
          "documents"
        ],
        "summary": "PATCH /documents",
        "description": "PATCH /api/documents?id=  — owner/attorney, or a collaborator with EDIT on this doc.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "body": {},
                  "kind": {},
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "folderId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {},
                  "filedDate": {},
                  "expectedUpdatedAt": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      },
      "delete": {
        "operationId": "delete_documents",
        "tags": [
          "documents"
        ],
        "summary": "DELETE /documents",
        "description": "DELETE /api/documents?id=  — needs edit permission. Deletes the document's\nattached files and the exports generated from it from storage too\n(lib/itemDeletion.ts). 423 under a legal hold.\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/documents/upload": {
      "post": {
        "operationId": "post_documents_upload",
        "tags": [
          "documents"
        ],
        "summary": "POST /documents/upload",
        "description": "POST /api/documents/upload — multipart: caseId + files[] (+ optional paths[]\nparallel to files[] to preserve a dropped folder structure). One Document per\nfile, with the file attached and its text extracted deterministically (no AI).\n\nRequired permission: documents:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string"
                  },
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  },
                  "recordingConsent": {
                    "type": "string"
                  },
                  "paths": {
                    "type": "string"
                  },
                  "folderId": {
                    "type": "string"
                  },
                  "courtCaseId": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "documents:write"
      }
    },
    "/evidence/{id}/extract": {
      "post": {
        "operationId": "post_evidence_by_id_extract",
        "tags": [
          "evidence"
        ],
        "summary": "POST /evidence/{id}/extract",
        "description": "POST /api/evidence/[id]/extract — extract text/context from the item's first\nextractable file (image -> vision, pdf -> document, text -> verbatim).\n\nRequired permission: evidence:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:write"
      }
    },
    "/evidence/{id}": {
      "get": {
        "operationId": "get_evidence_by_id",
        "tags": [
          "evidence"
        ],
        "summary": "GET /evidence/{id}",
        "description": "Run the same evidence operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: evidence:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:read"
      },
      "patch": {
        "operationId": "patch_evidence_by_id",
        "tags": [
          "evidence"
        ],
        "summary": "PATCH /evidence/{id}",
        "description": "PATCH /api/evidence/[id]\nbody: { description?, eventDate?, eventDateApproximate?, priority?, exhibitNumber?,\n        userText?, userVerified?, issueIds?: string[], tagNames?: string[] }\n\nRequired permission: evidence:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "folderId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "issueIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "courtCaseIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "hearingIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tagNames": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "eventDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "eventDateApproximate": {},
                  "priority": {},
                  "exhibitNumber": {},
                  "userText": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "userVerified": {},
                  "source": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:write"
      },
      "delete": {
        "operationId": "delete_evidence_by_id",
        "tags": [
          "evidence"
        ],
        "summary": "DELETE /evidence/{id}",
        "description": "DELETE /api/evidence/[id] — permanently remove an evidence item.\nNeeds edit permission (destructive). Cascades to its files + audit log + m2m\njoins, and queues its stored originals and previews for deletion\n(lib/itemDeletion.ts: removed once no other row shares the content-addressed\nobject). Refused with 423 under a legal hold, 403 on a closed/archived case.\n\nRequired permission: evidence:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:write"
      }
    },
    "/evidence/{id}/transcribe": {
      "post": {
        "operationId": "post_evidence_by_id_transcribe",
        "tags": [
          "evidence"
        ],
        "summary": "POST /evidence/{id}/transcribe",
        "description": "POST /api/evidence/[id]/transcribe — speech-to-text for an audio/video file.\nbody: { fileId? }  (defaults to the item's first transcribable file)\n\nRequired permission: evidence:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:write"
      }
    },
    "/evidence/extract-bulk": {
      "post": {
        "operationId": "post_evidence_extract_bulk",
        "tags": [
          "evidence"
        ],
        "summary": "POST /evidence/extract-bulk",
        "description": "POST /api/evidence/extract-bulk\n{ caseId, ids?: string[], onlyMissing?: boolean }\n  - ids given      -> extract those items\n  - no ids         -> all items in the case\n  - onlyMissing    -> skip items that already have aiText\nReturns { processed, skipped, failed, updated: EvidenceItem[] }.\n\nRequired permission: evidence:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ids": {},
                  "onlyMissing": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:write"
      }
    },
    "/evidence/restore-bulk": {
      "post": {
        "operationId": "post_evidence_restore_bulk",
        "tags": [
          "evidence"
        ],
        "summary": "POST /evidence/restore-bulk",
        "description": "Run the same evidence operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: evidence:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string"
                  },
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:write"
      }
    },
    "/evidence": {
      "get": {
        "operationId": "get_evidence",
        "tags": [
          "evidence"
        ],
        "summary": "GET /evidence",
        "description": "GET /api/evidence?caseId=&q=&issueId=&priority=&tag=\n\nRequired permission: evidence:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "issueId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "folderId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:read"
      },
      "post": {
        "operationId": "post_evidence",
        "tags": [
          "evidence"
        ],
        "summary": "POST /evidence",
        "description": "POST /api/evidence — multipart form: caseId + files[]. One evidence item per file.\n\nRequired permission: evidence:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string"
                  },
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  },
                  "paths": {
                    "type": "string"
                  },
                  "recordingConsent": {
                    "type": "string"
                  },
                  "folderId": {
                    "type": "string"
                  },
                  "courtCaseId": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "evidence:write"
      }
    },
    "/export/case-bundle/download": {
      "get": {
        "operationId": "get_export_case_bundle_download",
        "tags": [
          "export"
        ],
        "summary": "GET /export/case-bundle/download",
        "description": "Download one part of the owner's Case Bundle (caseId, tier, part). Parts:\n\"records\" (ZIP: README, manifest.json, every record as JSON and CSV,\ndocuments, SHA256SUMS; tier=case_closed adds unwatermarked PDFs),\n\"exhibits-N\" (tier=case_closed only: exhibit packet PDF volume N) and\n\"originals-N\" (ZIP: original files verified against their recorded SHA-256,\nwith VERIFICATION.txt). Get the part list from /export/case-bundle. Owner only.\n\nRequired permission: export:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "part",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tier",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "export:read"
      }
    },
    "/export/case-bundle": {
      "get": {
        "operationId": "get_export_case_bundle",
        "tags": [
          "export"
        ],
        "summary": "GET /export/case-bundle",
        "description": "List the parts of the owner's Case Bundle for a case (caseId). tier=free is\nevery original, the manifest and every record (any plan, any time);\ntier=case_closed adds the exhibit-ready PDFs and needs the paid Case Closed\npurchase on this case. Omit tier to get the best tier the case has. Each part\nhas an href for /export/case-bundle/download. Owner only.\n\nRequired permission: export:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tier",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "export:read"
      }
    },
    "/export/court-packet": {
      "get": {
        "operationId": "get_export_court_packet",
        "tags": [
          "export"
        ],
        "summary": "GET /export/court-packet",
        "description": "Run the same export operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: export:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "export:read"
      },
      "post": {
        "operationId": "post_export_court_packet",
        "tags": [
          "export"
        ],
        "summary": "POST /export/court-packet",
        "description": "Run the same export operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: export:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "export:write"
      }
    },
    "/export/evidence-index": {
      "get": {
        "operationId": "get_export_evidence_index",
        "tags": [
          "export"
        ],
        "summary": "GET /export/evidence-index",
        "description": "GET /api/export/evidence-index?caseId= — printable HTML (browser → Print → PDF)\n\nRequired permission: export:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "export:read"
      }
    },
    "/export/handoff": {
      "get": {
        "operationId": "get_export_handoff",
        "tags": [
          "export"
        ],
        "summary": "GET /export/handoff",
        "description": "Download the attorney handoff packet for a case (caseId): one PDF with the\ncase summary and upcoming hearings, each issue you defined with your own\nsummary and the evidence tagged to it, the timeline, and the evidence index\nwith SHA-256 fingerprints. No AI. Only records you can download are included.\n\nRequired permission: export:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "export:read"
      }
    },
    "/export/message-log": {
      "get": {
        "operationId": "get_export_message_log",
        "tags": [
          "export"
        ],
        "summary": "GET /export/message-log",
        "description": "GET /api/export/message-log?caseId=&party=&from=&to= — paginated, Bates-stamped printable log.\nFree accounts get a DRAFT-watermarked log and free-trial accounts a TRIAL\ncopy, each with a \"Get a clean copy\" box; paid accounts, or a paid $39\nMessage Log purchase for the case, get it clean. Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: export:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "party",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "checkout",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "conversationParty",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "export:read"
      }
    },
    "/export/timeline": {
      "get": {
        "operationId": "get_export_timeline",
        "tags": [
          "export"
        ],
        "summary": "GET /export/timeline",
        "description": "Download the case timeline (caseId, optional courtCaseId) as a PDF\n(format=pdf, default) or a Word document (format=docx): manual events, dated\nevidence, key dates and hearings, oldest first. Only entries you can\ndownload are included. Free-plan and trial copies carry the plan watermark.\n\nRequired permission: export:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "export:read"
      }
    },
    "/files/{id}/restore": {
      "post": {
        "operationId": "post_files_by_id_restore",
        "tags": [
          "files"
        ],
        "summary": "POST /files/{id}/restore",
        "description": "Run the same files operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: files:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "acceptMismatch": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "files:write"
      }
    },
    "/files/{id}": {
      "get": {
        "operationId": "get_files_by_id",
        "tags": [
          "files"
        ],
        "summary": "GET /files/{id}",
        "description": "GET /api/files/[id] — stream the original file (access-checked).\n  ?preview=1 — return a browser-renderable image. For HEIC/HEIF originals\n               (which Chrome/Firefox can't display) this returns a cached\n               JPEG; other types stream with photo/video location removed.\n               Without it, the case owner gets the raw original (so their\n               download keeps the true file); anyone else gets a copy with\n               photo/video location metadata removed.\nCollaborators need DOWNLOAD permission on the owning evidence item.\n\nRequired permission: files:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "preview",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "files:read"
      }
    },
    "/files/{id}/text": {
      "get": {
        "operationId": "get_files_by_id_text",
        "tags": [
          "files"
        ],
        "summary": "GET /files/{id}/text",
        "description": "GET /api/files/[id]/text — plain-text rendering for files the browser can't show\ninline (currently .docx). Access-checked like the raw file route.\n\nRequired permission: files:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "files:read"
      }
    },
    "/firms/{id}/export": {
      "get": {
        "operationId": "get_firms_by_id_export",
        "tags": [
          "firms"
        ],
        "summary": "GET /firms/{id}/export",
        "description": "Run the same firms operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: firms:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "firms:read"
      }
    },
    "/firms": {
      "get": {
        "operationId": "get_firms",
        "tags": [
          "firms"
        ],
        "summary": "GET /firms",
        "description": "Run the same firms operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: firms:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "firms:read"
      },
      "post": {
        "operationId": "post_firms",
        "tags": [
          "firms"
        ],
        "summary": "POST /firms",
        "description": "Run the same firms operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: firms:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "create"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "action",
                      "name"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "invite-staff"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "role": {
                        "type": "string",
                        "enum": [
                          "admin",
                          "attorney",
                          "staff",
                          "billing"
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "email",
                      "role"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "create-matter"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "assignedUserIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 150
                        },
                        "maxItems": 50
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "title"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "adopt-matter"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "caseId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "assign"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "userIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 150
                        },
                        "maxItems": 50
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "caseId",
                      "userIds"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "remove-staff"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "memberId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "memberId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "external-link"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "url": {
                        "anyOf": [
                          {
                            "const": ""
                          },
                          {
                            "type": "string",
                            "maxLength": 2000
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "caseId",
                      "url"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "archive"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "caseId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "archived": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "caseId",
                      "archived"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "settings"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "retentionDays": {
                        "type": "integer",
                        "minimum": 30,
                        "maximum": 3650
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "name",
                      "retentionDays"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "transfer-owner"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "userId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "firmId",
                      "userId"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "const": "accept-ownership"
                      },
                      "firmId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "action",
                      "firmId"
                    ],
                    "additionalProperties": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "firms:write"
      }
    },
    "/folders": {
      "get": {
        "operationId": "get_folders",
        "tags": [
          "folders"
        ],
        "summary": "GET /folders",
        "description": "GET /api/folders?caseId=&kind=evidence|document — the CALLER's folder tree.\n\nRequired permission: folders:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "folders:read"
      },
      "post": {
        "operationId": "post_folders",
        "tags": [
          "folders"
        ],
        "summary": "POST /folders",
        "description": "POST /api/folders — { caseId, name, parentId?, kind? }  — any member; their tree.\n\nRequired permission: folders:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kind": {},
                  "parentId": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "folders:write"
      },
      "patch": {
        "operationId": "patch_folders",
        "tags": [
          "folders"
        ],
        "summary": "PATCH /folders",
        "description": "PATCH /api/folders?id= — { name } — rename your own folder.\n\nRequired permission: folders:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "folders:write"
      },
      "delete": {
        "operationId": "delete_folders",
        "tags": [
          "folders"
        ],
        "summary": "DELETE /folders",
        "description": "DELETE /api/folders?id=&deleteItems=true|false\n  deleteItems omitted/false → delete the folder (+ its subfolders); items inside\n                              are KEPT (their folderId is set to null).\n  deleteItems=true         → ALSO permanently delete every item in the folder\n                              and all its subfolders (evidence or documents,\n                              per the folder's kind), cascading their files.\n\nRequired permission: folders:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deleteItems",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "folders:write"
      }
    },
    "/hardship/request": {
      "post": {
        "operationId": "post_hardship_request",
        "tags": [
          "hardship"
        ],
        "summary": "POST /hardship/request",
        "description": "Ask for hardship access when you don't have a referral code. Support checks\neligibility only and replies by email to your account address; nobody\nreviews or comments on your case. Don't include case details.\n\nRequired permission: hardship:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organization": {
                    "type": "string",
                    "maxLength": 160
                  },
                  "message": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "message"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hardship:write"
      }
    },
    "/hardship": {
      "get": {
        "operationId": "get_hardship",
        "tags": [
          "hardship"
        ],
        "summary": "GET /hardship",
        "description": "Your hardship access: whether a referral code currently gives this account\ncomplimentary Full Suite, through which organization, and until when.\n\nRequired permission: hardship:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hardship:read"
      },
      "post": {
        "operationId": "post_hardship",
        "tags": [
          "hardship"
        ],
        "summary": "POST /hardship",
        "description": "Redeem a hardship referral code from a domestic-violence organization,\nshelter or legal-aid office: complimentary Full Suite for the code's months,\nno card. One active grant per account; each code once per account.\n\nRequired permission: hardship:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "const": "redeem"
                  },
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  }
                },
                "required": [
                  "action",
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hardship:write"
      }
    },
    "/hearings/{id}/resources": {
      "get": {
        "operationId": "get_hearings_by_id_resources",
        "tags": [
          "hearings"
        ],
        "summary": "GET /hearings/{id}/resources",
        "description": "Run the same hearings operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: hearings:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "browse",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hearings:read"
      },
      "post": {
        "operationId": "post_hearings_by_id_resources",
        "tags": [
          "hearings"
        ],
        "summary": "POST /hearings/{id}/resources",
        "description": "Run the same hearings operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: hearings:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "const": "evidence"
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "const": "document"
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                      },
                      "revision": {
                        "type": "integer"
                      },
                      "role": {
                        "type": "string",
                        "enum": [
                          "subpoena",
                          "our-filing",
                          "their-filing",
                          "order",
                          "other"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "revision",
                      "role"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hearings:write"
      }
    },
    "/hearings": {
      "get": {
        "operationId": "get_hearings",
        "tags": [
          "hearings"
        ],
        "summary": "GET /hearings",
        "description": "GET /api/hearings?caseId=&courtCaseId=\n\nRequired permission: hearings:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hearings:read"
      },
      "post": {
        "operationId": "post_hearings",
        "tags": [
          "hearings"
        ],
        "summary": "POST /hearings",
        "description": "POST /api/hearings — { caseId, courtCaseId, date, time?, purpose?, location?, judge?, continuedFromId? }\n\nRequired permission: hearings:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "date": {},
                  "time": {},
                  "purpose": {},
                  "location": {},
                  "room": {},
                  "judge": {},
                  "continuedFromId": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hearings:write"
      },
      "patch": {
        "operationId": "patch_hearings",
        "tags": [
          "hearings"
        ],
        "summary": "PATCH /hearings",
        "description": "PATCH /api/hearings?id= — { date?, time?, purpose?, status?, outcome?, location?, judge?, ready? }\nready: true marks the hearing prepared, which stops \"you still need to\nprepare\" reminders; false clears it. Factual hearing reminders continue.\n\nRequired permission: hearings:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {},
                  "time": {},
                  "purpose": {},
                  "status": {},
                  "location": {},
                  "room": {},
                  "judge": {},
                  "ready": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hearings:write"
      },
      "delete": {
        "operationId": "delete_hearings",
        "tags": [
          "hearings"
        ],
        "summary": "DELETE /hearings",
        "description": "DELETE /api/hearings?id=\n\nRequired permission: hearings:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "hearings:write"
      }
    },
    "/issues": {
      "post": {
        "operationId": "post_issues",
        "tags": [
          "issues"
        ],
        "summary": "POST /issues",
        "description": "POST /api/issues  { caseId, title, summary? }\n\nRequired permission: issues:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "summary": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "issues:write"
      }
    },
    "/mediation/phrases": {
      "post": {
        "operationId": "post_mediation_phrases",
        "tags": [
          "mediation"
        ],
        "summary": "POST /mediation/phrases",
        "description": "POST /api/mediation/phrases — verbatim \"what to say\" lines from the conversation.\n{ conversation, flow, audience?, otherPartyName?, systemPrompt?, summary?, sessionId? }\nIf sessionId is given, the suggestions are persisted and returned with their ids.\n\nRequired permission: mediation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "conversation": {},
                  "sessionId": {},
                  "flow": {},
                  "audience": {},
                  "otherPartyName": {},
                  "systemPrompt": {},
                  "summary": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "refSpeaker": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:write"
      }
    },
    "/mediation/redo": {
      "post": {
        "operationId": "post_mediation_redo",
        "tags": [
          "mediation"
        ],
        "summary": "POST /mediation/redo",
        "description": "POST /api/mediation/redo — one fresh alternative to a rejected line.\n{ conversation, disliked, audience?, otherPartyName?, systemPrompt?, summary?, sessionId? }\n\nRequired permission: mediation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "conversation": {},
                  "disliked": {},
                  "sessionId": {},
                  "audience": {},
                  "otherPartyName": {},
                  "systemPrompt": {},
                  "summary": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:write"
      }
    },
    "/mediation/session": {
      "get": {
        "operationId": "get_mediation_session",
        "tags": [
          "mediation"
        ],
        "summary": "GET /mediation/session",
        "description": "GET /api/mediation/session?caseId=   → list sessions for a case (newest first)\nGET /api/mediation/session?id=       → one session with transcript + suggestions\n\nRequired permission: mediation:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:read"
      },
      "post": {
        "operationId": "post_mediation_session",
        "tags": [
          "mediation"
        ],
        "summary": "POST /mediation/session",
        "description": "POST /api/mediation/session — start a session\n{ caseId, title?, audience?, otherParty?, systemPrompt?, testMode?, aiModel? }\n\nRequired permission: mediation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "audience": {},
                  "otherParty": {},
                  "systemPrompt": {},
                  "testMode": {},
                  "aiModel": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:write"
      },
      "patch": {
        "operationId": "patch_mediation_session",
        "tags": [
          "mediation"
        ],
        "summary": "PATCH /mediation/session",
        "description": "PATCH /api/mediation/session — update settings / summary / end the session\n{ id, title?, audience?, otherParty?, systemPrompt?, testMode?, summary?, aiModel?, end? }\n\nRequired permission: mediation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {},
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "audience": {},
                  "otherParty": {},
                  "systemPrompt": {},
                  "testMode": {},
                  "summary": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "aiModel": {},
                  "end": {},
                  "endedAt": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:write"
      }
    },
    "/mediation/simulate": {
      "post": {
        "operationId": "post_mediation_simulate",
        "tags": [
          "mediation"
        ],
        "summary": "POST /mediation/simulate",
        "description": "POST /api/mediation/simulate — one in-character line for a Test-mode persona.\n{ role: \"mediator\"|\"other\", label, persona?, conversation, summary?, sessionId? }\nPersists the line as a transcript turn when sessionId is given.\n\nRequired permission: mediation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "role": {},
                  "label": {},
                  "sessionId": {},
                  "persona": {},
                  "conversation": {},
                  "summary": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:write"
      }
    },
    "/mediation/suggestion": {
      "patch": {
        "operationId": "patch_mediation_suggestion",
        "tags": [
          "mediation"
        ],
        "summary": "PATCH /mediation/suggestion",
        "description": "PATCH /api/mediation/suggestion — mark a suggested line as used/unused.\n{ id, used }\n\nRequired permission: mediation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {},
                  "used": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:write"
      }
    },
    "/mediation/tts": {
      "post": {
        "operationId": "post_mediation_tts",
        "tags": [
          "mediation"
        ],
        "summary": "POST /mediation/tts",
        "description": "POST /api/mediation/tts — speak a line in a chosen ElevenLabs voice.\n{ text, voiceId? } → { audioBase64, mime, voiceId }\n\nRequired permission: mediation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {},
                  "voiceId": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:write"
      }
    },
    "/mediation/utterance": {
      "post": {
        "operationId": "post_mediation_utterance",
        "tags": [
          "mediation"
        ],
        "summary": "POST /mediation/utterance",
        "description": "POST /api/mediation/utterance — append one or more transcript turns.\n{ sessionId, utterances: [{speaker, text, role?, source?}] }  (or a single {speaker,text,...})\n\nRequired permission: mediation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sessionId": {},
                  "utterances": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "mediation:write"
      }
    },
    "/messages/analyze": {
      "post": {
        "operationId": "post_messages_analyze",
        "tags": [
          "messages"
        ],
        "summary": "POST /messages/analyze",
        "description": "POST /api/messages/analyze — { caseId, question, party?, from?, to? }\nRuns the user's question across the (filtered) message archive. Findings cite\nmessage numbers (MSG-xxxxx, matching the export's Bates numbering for the same filter).\nIn a conversation, tags the AI proposes are saved as SUGGESTIONS\n(Message.aiTagSuggestionsJson, lib/tagSuggestions.ts), never as tags: the\nperson accepts or rejects them (/api/messages/tag-suggestions). Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "question": {},
                  "party": {},
                  "from": {},
                  "to": {},
                  "conversation": {},
                  "history": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      }
    },
    "/messages/bulk": {
      "post": {
        "operationId": "post_messages_bulk",
        "tags": [
          "messages"
        ],
        "summary": "POST /messages/bulk",
        "description": "POST /api/messages/bulk — bulk operations on imported messages\n{ caseId, op: \"set-direction-by-party\", party, direction }   → fix WhatsApp \"my name\" attribution\n{ caseId, op: \"delete-batch\", batch }                        → undo an import Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "op": {},
                  "party": {},
                  "direction": {},
                  "batch": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      }
    },
    "/messages/check": {
      "post": {
        "operationId": "post_messages_check",
        "tags": [
          "messages"
        ],
        "summary": "POST /messages/check",
        "description": "POST /api/messages/check — { draft, context? } → AI review (not stored; storing happens on send)\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "draft": {},
                  "context": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      }
    },
    "/messages/import": {
      "post": {
        "operationId": "post_messages_import",
        "tags": [
          "messages"
        ],
        "summary": "POST /messages/import",
        "description": "POST /api/messages/import — multipart: caseId, file, attest=yes\n  optional: platform (sms|whatsapp|facebook|instagram|email|other), selfName, otherName, device\nOwn-device/own-account attestation is REQUIRED (see LEGAL_AND_COMPLIANCE.md §6). Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string"
                  },
                  "courtCaseId": {
                    "type": "string"
                  },
                  "attest": {
                    "type": "string"
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "platform": {
                    "type": "string"
                  },
                  "selfName": {
                    "type": "string"
                  },
                  "otherName": {
                    "type": "string"
                  },
                  "device": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      }
    },
    "/messages/imports/{id}": {
      "get": {
        "operationId": "get_messages_imports_by_id",
        "tags": [
          "messages"
        ],
        "summary": "GET /messages/imports/{id}",
        "description": "Run the same messages operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: messages:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:read"
      }
    },
    "/messages": {
      "get": {
        "operationId": "get_messages",
        "tags": [
          "messages"
        ],
        "summary": "GET /messages",
        "description": "GET /api/messages?caseId=&party=&q=&direction=&source=  (scope-aware) Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: messages:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "party",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "device",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "conversationParty",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:read"
      },
      "post": {
        "operationId": "post_messages",
        "tags": [
          "messages"
        ],
        "summary": "POST /messages",
        "description": "POST /api/messages — log a message (Comms Guard \"mark as sent\" / manual entry)\n{ caseId, direction, channel?, party?, body, draftBody?, aiFlagsJson?, aiSuggestion?, aiModel?, sentAt?, source? }\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "body": {},
                  "direction": {},
                  "channel": {},
                  "party": {},
                  "contactId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "draftBody": {},
                  "aiFlagsJson": {},
                  "aiSuggestion": {},
                  "aiModel": {},
                  "sentAt": {},
                  "source": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      },
      "patch": {
        "operationId": "patch_messages",
        "tags": [
          "messages"
        ],
        "summary": "PATCH /messages",
        "description": "PATCH /api/messages?id= — update user-applied tags on a message.\n{ tags: string[] }  → normalized to lowercase, stored as JSON in tagsJson.\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tags": {},
                  "tagsJson": {},
                  "aiTagSuggestionsJson": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      }
    },
    "/messages/search": {
      "get": {
        "operationId": "get_messages_search",
        "tags": [
          "messages"
        ],
        "summary": "GET /messages/search",
        "description": "Search returns positions in the complete visible conversation, not just the\ncurrently loaded page. The reader can jump to any match without hiding context. Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: messages:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "conversationParty",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:read"
      }
    },
    "/messages/tag-suggestions": {
      "post": {
        "operationId": "post_messages_tag_suggestions",
        "tags": [
          "messages"
        ],
        "summary": "POST /messages/tag-suggestions",
        "description": "POST /api/messages/tag-suggestions — accept or reject AI-suggested tags\n(lib/tagSuggestions.ts). { caseId, action: \"accept\"|\"reject\", messageId?, tags?, conversation?, courtCaseId? }\n  messageId            → that message (only `tags`, if given)\n  conversation (no id) → every message in the conversation (\"Accept all\" / \"Reject all\")\nAccepted suggestions become the message's tags; rejected ones are dropped.\nNeeds edit permission on each message; others are skipped and counted.\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 150
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "accept",
                      "reject"
                    ]
                  },
                  "messageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 150
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 80
                    },
                    "maxItems": 20
                  },
                  "conversation": {
                    "type": "object",
                    "properties": {
                      "party": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "channel": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "party",
                      "channel"
                    ],
                    "additionalProperties": true
                  },
                  "courtCaseId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "caseId",
                  "action"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      }
    },
    "/messages/threads": {
      "get": {
        "operationId": "get_messages_threads",
        "tags": [
          "messages"
        ],
        "summary": "GET /messages/threads",
        "description": "Run the same messages operation available in the application. Existing account permissions, validation and usage limits apply. Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: messages:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:read"
      },
      "patch": {
        "operationId": "patch_messages_threads",
        "tags": [
          "messages"
        ],
        "summary": "PATCH /messages/threads",
        "description": "Rename labels only: the original participant identity and grouping never change. Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "conversation": {},
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "partyAlias": {},
                  "selfAlias": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      },
      "delete": {
        "operationId": "delete_messages_threads",
        "tags": [
          "messages"
        ],
        "summary": "DELETE /messages/threads",
        "description": "Run the same messages operation available in the application. Existing account permissions, validation and usage limits apply. Optional courtCaseId narrows this operation to one court case within caseId (the workspace). Omit it for the full workspace. Import assigns new messages to that case; old imports remain unassigned. Existing permissions, scopes and quotas still apply.\n\nRequired permission: messages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "conversation": {},
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "messages:write"
      }
    },
    "/notifications/preferences": {
      "get": {
        "operationId": "get_notifications_preferences",
        "tags": [
          "notifications"
        ],
        "summary": "GET /notifications/preferences",
        "description": "Get your notification preferences (channels, categories, time zone, discreet mode, weekly summary email, reminder rules) and registered devices.\nweeklyDigest: opt-in weekly \"Your weekly summary is ready\" email (off by default; generic text, details only after sign-in).\nrules: reminderHour (local hour for day-based reminders); hearing.days/hours before a hearing; prep.enabled/days for\n\"you still need to prepare\" reminders until a hearing is marked ready; deadline/todo days before + overdueDays after;\nreminder.days for personal reminders; timedLeadMinutes before items with a time; timing = deadline-template planning defaults.\n\nRequired permission: notifications:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "notifications:read"
      },
      "put": {
        "operationId": "put_notifications_preferences",
        "tags": [
          "notifications"
        ],
        "summary": "PUT /notifications/preferences",
        "description": "Update notification preferences. Send only the fields to change; unknown time zones are ignored. rules merges\nfield-by-field (a day list replaces that list). resetRules: true restores the default reminder rules first.\n\nRequired permission: notifications:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pushEnabled": {
                    "type": "boolean"
                  },
                  "emailEnabled": {
                    "type": "boolean"
                  },
                  "discreet": {
                    "type": "boolean"
                  },
                  "weeklyDigest": {
                    "type": "boolean"
                  },
                  "timeZone": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "categories": {
                    "type": "object",
                    "properties": {
                      "hearing_reminder": {
                        "type": "object",
                        "properties": {
                          "push": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      },
                      "hearing_prep": {
                        "type": "object",
                        "properties": {
                          "push": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      },
                      "deadline": {
                        "type": "object",
                        "properties": {
                          "push": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      },
                      "todo_due": {
                        "type": "object",
                        "properties": {
                          "push": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      },
                      "message": {
                        "type": "object",
                        "properties": {
                          "push": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      },
                      "sharing": {
                        "type": "object",
                        "properties": {
                          "push": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      },
                      "billing": {
                        "type": "object",
                        "properties": {
                          "push": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      },
                      "general": {
                        "type": "object",
                        "properties": {
                          "push": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "additionalProperties": true
                  },
                  "rules": {
                    "type": "object",
                    "properties": {
                      "reminderHour": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 23
                      },
                      "hearing": {
                        "type": "object",
                        "properties": {
                          "days": {
                            "type": "array",
                            "items": {
                              "minimum": 0,
                              "maximum": 365
                            },
                            "maxItems": 15
                          },
                          "hours": {
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 72
                            },
                            "maxItems": 15
                          }
                        },
                        "additionalProperties": true
                      },
                      "prep": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean"
                          },
                          "days": {
                            "type": "array",
                            "items": {
                              "minimum": 0,
                              "maximum": 365
                            },
                            "maxItems": 15
                          }
                        },
                        "additionalProperties": true
                      },
                      "deadline": {
                        "type": "object",
                        "properties": {
                          "days": {
                            "type": "array",
                            "items": {
                              "minimum": 0,
                              "maximum": 365
                            },
                            "maxItems": 15
                          },
                          "overdueDays": {
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 60
                            },
                            "maxItems": 15
                          }
                        },
                        "additionalProperties": true
                      },
                      "todo": {
                        "type": "object",
                        "properties": {
                          "days": {
                            "type": "array",
                            "items": {
                              "minimum": 0,
                              "maximum": 365
                            },
                            "maxItems": 15
                          },
                          "overdueDays": {
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 60
                            },
                            "maxItems": 15
                          }
                        },
                        "additionalProperties": true
                      },
                      "reminder": {
                        "type": "object",
                        "properties": {
                          "days": {
                            "type": "array",
                            "items": {
                              "minimum": 0,
                              "maximum": 365
                            },
                            "maxItems": 15
                          }
                        },
                        "additionalProperties": true
                      },
                      "timedLeadMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1440
                      },
                      "timing": {
                        "type": "object",
                        "properties": {
                          "subpoenaLeadDays": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 365
                          },
                          "discoveryResponseDays": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 365
                          },
                          "discoveryFollowUpDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 365
                          },
                          "followUpGraceDays": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 365
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "additionalProperties": true
                  },
                  "resetRules": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "notifications:write"
      }
    },
    "/notifications/read": {
      "post": {
        "operationId": "post_notifications_read",
        "tags": [
          "notifications"
        ],
        "summary": "POST /notifications/read",
        "description": "Mark notifications as read: { ids: [...] } for specific ones, or { all: true } for everything.\n\nRequired permission: notifications:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 200
                  },
                  "all": {
                    "const": true
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "notifications:write"
      }
    },
    "/notifications": {
      "get": {
        "operationId": "get_notifications",
        "tags": [
          "notifications"
        ],
        "summary": "GET /notifications",
        "description": "List your latest 50 in-app notifications, newest first, with the total unread count.\n\nRequired permission: notifications:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "notifications:read"
      }
    },
    "/notifications/vapid": {
      "get": {
        "operationId": "get_notifications_vapid",
        "tags": [
          "notifications"
        ],
        "summary": "GET /notifications/vapid",
        "description": "Get the Web Push VAPID public key used to subscribe this browser. publicKey\nis null when browser push is not configured on this server.\n\nRequired permission: notifications:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "notifications:read"
      }
    },
    "/packages/{id}": {
      "get": {
        "operationId": "get_packages_by_id",
        "tags": [
          "packages"
        ],
        "summary": "GET /packages/{id}",
        "description": "Run the same packages operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: packages:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "download",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "packages:read"
      },
      "post": {
        "operationId": "post_packages_by_id",
        "tags": [
          "packages"
        ],
        "summary": "POST /packages/{id}",
        "description": "Run the same packages operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: packages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "acknowledge",
                      "revoke"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "packages:write"
      }
    },
    "/packages": {
      "post": {
        "operationId": "post_packages",
        "tags": [
          "packages"
        ],
        "summary": "POST /packages",
        "description": "Run the same packages operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: packages:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "purpose": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "items": {},
                  "recipients": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "canDownload": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "userId",
                        "canDownload"
                      ],
                      "additionalProperties": true
                    },
                    "minItems": 1,
                    "maxItems": 50
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "confirmRelease": {
                    "const": true
                  }
                },
                "required": [
                  "caseId",
                  "title",
                  "purpose",
                  "items",
                  "recipients",
                  "expiresAt",
                  "confirmRelease"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "packages:write"
      }
    },
    "/preparation/export": {
      "get": {
        "operationId": "get_preparation_export",
        "tags": [
          "preparation"
        ],
        "summary": "GET /preparation/export",
        "description": "Run the same preparation operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: preparation:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revision",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "audience",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tab",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "preparation:read"
      }
    },
    "/preparation": {
      "get": {
        "operationId": "get_preparation",
        "tags": [
          "preparation"
        ],
        "summary": "GET /preparation",
        "description": "Run the same preparation operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: preparation:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "preparation:read"
      },
      "post": {
        "operationId": "post_preparation",
        "tags": [
          "preparation"
        ],
        "summary": "POST /preparation",
        "description": "Change preparation records, hearing desks, binders, review records, printing, or backups. GET /preparation first and pass its revision for optimistic concurrency. The server validates action-specific records, sources, permissions, and review fingerprints.\n\nRequired permission: preparation:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string"
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "action": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "save",
                          "remove",
                          "complete-desk",
                          "carry-desk",
                          "finish-binder",
                          "duplicate-binder",
                          "review",
                          "print",
                          "import-todos",
                          "restore"
                        ]
                      },
                      "collection": {
                        "type": "string",
                        "enum": [
                          "facts",
                          "decisions",
                          "tasks",
                          "records",
                          "desks",
                          "filings",
                          "references",
                          "relationships",
                          "scenarios",
                          "binders",
                          "dockets",
                          "reviews"
                        ]
                      },
                      "record": {
                        "type": "object",
                        "additionalProperties": true
                      },
                      "id": {
                        "type": "string"
                      },
                      "documentId": {
                        "type": "string"
                      },
                      "workflow": {
                        "type": "string",
                        "enum": [
                          "correspondence",
                          "filing",
                          "hearing"
                        ]
                      },
                      "checks": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "fingerprint": {
                        "type": "string"
                      },
                      "notes": {
                        "type": "string"
                      },
                      "audience": {
                        "type": "string",
                        "enum": [
                          "court",
                          "private"
                        ]
                      },
                      "copies": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100
                      },
                      "tab": {
                        "type": "string"
                      },
                      "data": {
                        "type": "object",
                        "additionalProperties": true
                      },
                      "courtCaseId": {
                        "type": "string",
                        "description": "For import-todos, import only tasks attached to this court case. Omit for all workspace tasks."
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": true
                  }
                },
                "required": [
                  "caseId",
                  "revision",
                  "action"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "preparation:write"
      }
    },
    "/shares/accept": {
      "post": {
        "operationId": "post_shares_accept",
        "tags": [
          "shares"
        ],
        "summary": "POST /shares/accept",
        "description": "POST /api/shares/accept  { token }\nA logged-in user accepts an invite via the emailed token. The signed-in\naccount's email MUST match the invited email (the token alone is not enough),\nso a forwarded link can't attach a stranger's account to the share.\n\nRequired permission: shares:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:write"
      }
    },
    "/shares/comments": {
      "get": {
        "operationId": "get_shares_comments",
        "tags": [
          "shares"
        ],
        "summary": "GET /shares/comments",
        "description": "GET /api/shares/comments?caseId=&category=&itemId=\n\nRequired permission: shares:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:read"
      },
      "post": {
        "operationId": "post_shares_comments",
        "tags": [
          "shares"
        ],
        "summary": "POST /shares/comments",
        "description": "POST /api/shares/comments  { caseId, category, itemId, body }\n\nRequired permission: shares:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "category": {},
                  "itemId": {},
                  "body": {},
                  "slice": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:write"
      }
    },
    "/shares/default": {
      "get": {
        "operationId": "get_shares_default",
        "tags": [
          "shares"
        ],
        "summary": "GET /shares/default",
        "description": "Run the same shares operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: shares:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:read"
      },
      "patch": {
        "operationId": "patch_shares_default",
        "tags": [
          "shares"
        ],
        "summary": "PATCH /shares/default",
        "description": "Run the same shares operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: shares:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "defaultShare": {},
                  "recipientIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:write"
      }
    },
    "/shares/inbox": {
      "get": {
        "operationId": "get_shares_inbox",
        "tags": [
          "shares"
        ],
        "summary": "GET /shares/inbox",
        "description": "GET /api/shares/inbox — cases shared WITH the current user (recipient view).\n\nRequired permission: shares:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:read"
      }
    },
    "/shares/invite": {
      "post": {
        "operationId": "post_shares_invite",
        "tags": [
          "shares"
        ],
        "summary": "POST /shares/invite",
        "description": "POST /api/shares/invite\n  { caseId, email, grants: [{ category, allItems?, itemIds?, permission }] }\nOwner-only. Creates/updates the invitation + per-category grants, links an\nexisting account immediately, and emails the recipient.\n\nRequired permission: shares:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {},
                  "grants": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:write"
      }
    },
    "/shares/item": {
      "get": {
        "operationId": "get_shares_item",
        "tags": [
          "shares"
        ],
        "summary": "GET /shares/item",
        "description": "Run the same shares operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: shares:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:read"
      },
      "post": {
        "operationId": "post_shares_item",
        "tags": [
          "shares"
        ],
        "summary": "POST /shares/item",
        "description": "Run the same shares operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: shares:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "category": {},
                  "permission": {},
                  "recipientIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "itemId": {},
                  "allowReshare": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:write"
      }
    },
    "/shares": {
      "get": {
        "operationId": "get_shares",
        "tags": [
          "shares"
        ],
        "summary": "GET /shares",
        "description": "Run the same shares operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: shares:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:read"
      },
      "patch": {
        "operationId": "patch_shares",
        "tags": [
          "shares"
        ],
        "summary": "PATCH /shares",
        "description": "Run the same shares operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: shares:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "permission": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:write"
      },
      "delete": {
        "operationId": "delete_shares",
        "tags": [
          "shares"
        ],
        "summary": "DELETE /shares",
        "description": "Run the same shares operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: shares:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "inviteId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "shares:write"
      }
    },
    "/support/tickets": {
      "get": {
        "operationId": "get_support_tickets",
        "tags": [
          "support"
        ],
        "summary": "GET /support/tickets",
        "description": "Run the same support operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: support:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "support:read"
      },
      "post": {
        "operationId": "post_support_tickets",
        "tags": [
          "support"
        ],
        "summary": "POST /support/tickets",
        "description": "Run the same support operation available in the application. Existing account permissions, validation and usage limits apply.\n\nRequired permission: support:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "category": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "support:write"
      }
    },
    "/templates/{id}": {
      "get": {
        "operationId": "get_templates_by_id",
        "tags": [
          "templates"
        ],
        "summary": "GET /templates/{id}",
        "description": "Read a blank template's text, notice, and review metadata before creating a document.\n\nRequired permission: templates:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "templates:read"
      }
    },
    "/templates": {
      "get": {
        "operationId": "get_templates",
        "tags": [
          "templates"
        ],
        "summary": "GET /templates",
        "description": "List the blank templates available in the site's template library.\n\nRequired permission: templates:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "templates:read"
      }
    },
    "/timeline": {
      "get": {
        "operationId": "get_timeline",
        "tags": [
          "timeline"
        ],
        "summary": "GET /timeline",
        "description": "GET /api/timeline?caseId=&courtCaseId=\nMerges manual events + evidence event-dates + key dates. With courtCaseId it\nscopes to one court case; without it, the whole matter (\"All cases\").\nOptional comma-separated kinds (event,evidence,keydate,hearing), years (2025,2026),\nand months (01 through 12) combine with AND; values within each filter use OR.\nOmit a filter for all values; an empty string selects none. Invalid values return 400.\n\nRequired permission: timeline:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kinds",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "years",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "months",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "timeline:read"
      },
      "post": {
        "operationId": "post_timeline",
        "tags": [
          "timeline"
        ],
        "summary": "POST /timeline",
        "description": "POST /api/timeline — { caseId, date, title, detail?, dateApproximate?, courtCaseId? }\n\nRequired permission: timeline:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "date": {},
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "detail": {},
                  "dateApproximate": {},
                  "courtCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "timeline:write"
      },
      "delete": {
        "operationId": "delete_timeline",
        "tags": [
          "timeline"
        ],
        "summary": "DELETE /timeline",
        "description": "DELETE /api/timeline?id=\n\nRequired permission: timeline:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "timeline:write"
      }
    },
    "/todos": {
      "get": {
        "operationId": "get_todos",
        "tags": [
          "todos"
        ],
        "summary": "GET /todos",
        "description": "GET /api/todos?caseId=&courtCaseId=\n\nRequired permission: todos:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "todos:read"
      },
      "post": {
        "operationId": "post_todos",
        "tags": [
          "todos"
        ],
        "summary": "POST /todos",
        "description": "POST /api/todos — { caseId, title, body?, due?, dueTime?, kind?, courtCaseId?, hearingId?, useDefaultReminders?, reminderDays?, followUpDays? }\nA hearingId implies its court case; \"General\" = neither set. kind \"deadline\"\nand \"reminder\" items appear in Upcoming and are reminded on the user's rules.\n\nRequired permission: todos:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "body": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 20000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "due": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dueTime": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "task",
                      "deadline",
                      "reminder"
                    ]
                  },
                  "courtCaseId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "hearingId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "useDefaultReminders": {
                    "type": "boolean"
                  },
                  "reminderDays": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 365
                    },
                    "maxItems": 15
                  },
                  "followUpDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "caseId",
                  "title"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "todos:write"
      },
      "patch": {
        "operationId": "patch_todos",
        "tags": [
          "todos"
        ],
        "summary": "PATCH /todos",
        "description": "PATCH /api/todos?id= — { title?, body?, done?, due?, dueTime?, completedAt?, kind?, courtCaseId?, hearingId?, useDefaultReminders?, reminderDays?, followUpDays? }\n\nRequired permission: todos:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "body": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 20000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "done": {
                    "type": "boolean"
                  },
                  "due": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dueTime": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "completedAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "task",
                      "deadline",
                      "reminder"
                    ]
                  },
                  "courtCaseId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "hearingId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "useDefaultReminders": {
                    "type": "boolean"
                  },
                  "reminderDays": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 365
                    },
                    "maxItems": 15
                  },
                  "followUpDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "todos:write"
      },
      "delete": {
        "operationId": "delete_todos",
        "tags": [
          "todos"
        ],
        "summary": "DELETE /todos",
        "description": "DELETE /api/todos?id=\n\nRequired permission: todos:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "todos:write"
      }
    },
    "/upcoming": {
      "get": {
        "operationId": "get_upcoming",
        "tags": [
          "upcoming"
        ],
        "summary": "GET /upcoming",
        "description": "GET /api/upcoming?caseId=&courtCaseId= — the countdown agenda for a workspace: scheduled hearings with days until\neach, whether each is marked ready, and when the next reminder goes out; dated deadlines, reminders and to-dos\n(state overdue|today|upcoming, daysUntil, nextReminderAt); undated open to-dos; items completed in the last 14 days;\ncounts; and your reminder rules. Days are counted in your notification time zone. Optional courtCaseId narrows to one court case.\n\nRequired permission: upcoming:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courtCaseId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "upcoming:read"
      }
    },
    "/workspaces/{id}": {
      "patch": {
        "operationId": "patch_workspaces_by_id",
        "tags": [
          "workspaces"
        ],
        "summary": "PATCH /workspaces/{id}",
        "description": "PATCH /api/workspaces/:id — rename a workspace / set its client label.\n\nRequired permission: workspaces:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "clientName": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "workspaces:write"
      },
      "delete": {
        "operationId": "delete_workspaces_by_id",
        "tags": [
          "workspaces"
        ],
        "summary": "DELETE /workspaces/{id}",
        "description": "DELETE /api/workspaces/:id — archive a workspace (soft delete; frees a seat\nfor billing/seat-count purposes the moment it's hidden). The default workspace\ncan't be archived. Cases are retained on the row and simply hidden from the\nswitcher.\n\nRequired permission: workspaces:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "workspaces:write"
      }
    },
    "/workspaces": {
      "get": {
        "operationId": "get_workspaces",
        "tags": [
          "workspaces"
        ],
        "summary": "GET /workspaces",
        "description": "GET /api/workspaces — everything the switcher needs: the active context, the\nworkspaces you own, the accounts that have shared with you, your seat\nallowance, and whether this brand exposes multi-workspace at all.\n\nRequired permission: workspaces:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "workspaces:read"
      },
      "post": {
        "operationId": "post_workspaces",
        "tags": [
          "workspaces"
        ],
        "summary": "POST /workspaces",
        "description": "POST /api/workspaces — create a new (client) workspace. CourtBriefly only,\nand only within the user's seat allowance (1 free + paid seats). Returns 402\n\"seat_required\" when they need to buy another seat.\n\nRequired permission: workspaces:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "clientName": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "workspaces:write"
      }
    },
    "/workspaces/switch": {
      "post": {
        "operationId": "post_workspaces_switch",
        "tags": [
          "workspaces"
        ],
        "summary": "POST /workspaces/switch",
        "description": "POST /api/workspaces/switch\n  { type: \"workspace\", id }  — switch to a workspace you own\n  { type: \"shared\", id }     — switch to an account that shared cases with you\nSets the active-context cookie (validated server-side, so a forged cookie can\nnever select a tenant you don't belong to).\n\nRequired permission: workspaces:write. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {},
                  "id": {}
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "workspaces:write"
      }
    },
    "/templates/{id}/pdf": {
      "get": {
        "operationId": "get_templates_by_id_pdf",
        "tags": [
          "templates"
        ],
        "summary": "Download a blank court template PDF",
        "description": "Download the same blank PDF preview available in the template library.\n\nRequired permission: templates:read. Uses the same validation, case access checks, plan and usage limits as the site. Uploads: 32 MiB total request, 25 MiB per file, 30 files; JSON: 4 MiB. Document extraction: 64 MiB expanded archives, 2000 entries, 500 PDF pages, 2 million text characters and 15 seconds. Resource violations return 413; busy extraction workers return 429. Request properties below are discovery hints; additional action-specific properties are accepted and validated by the shared handler.",
        "security": [
          {
            "personalToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Case-Context",
            "in": "header",
            "description": "ws:<workspaceId> or matter:<caseId>; validated against your memberships.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result; JSON, text, or file depending on the operation.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "Created"
          },
          "204": {
            "description": "Completed"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired, or revoked token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Plan or usage allowance exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient token scope or account permission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request or document processing resource limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "x-required-scope": "templates:read"
      }
    }
  }
}
