{
  "openapi": "3.1.0",
  "info": {
    "title": "Vecaria API",
    "version": "1.0.0",
    "description": "CAD/GIS/point-cloud/PCB/BIM/PDF tools API. Session cookie for user endpoints; API tokens (vk_…) for server integrations/MCP. Response envelope: { ok, data } or { ok:false, error:{code,message} }."
  },
  "servers": [
    {
      "url": "https://vecaria.com"
    }
  ],
  "tags": [
    {
      "name": "system"
    },
    {
      "name": "tools"
    },
    {
      "name": "config"
    },
    {
      "name": "files"
    },
    {
      "name": "batch"
    },
    {
      "name": "workflows"
    },
    {
      "name": "tokens"
    },
    {
      "name": "account"
    },
    {
      "name": "mcp"
    }
  ],
  "components": {
    "securitySchemes": {
      "cookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "better-auth.session_token"
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "vk_<token>"
      }
    }
  },
  "paths": {
    "/api/health": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Health check",
        "operationId": "get_api_health",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/status": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Public status page",
        "operationId": "get_status",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/config/public": {
      "get": {
        "tags": [
          "config"
        ],
        "summary": "Public site config (whitelisted keys)",
        "operationId": "get_api_config_public",
        "parameters": [
          {
            "name": "keys",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/config/flags": {
      "get": {
        "tags": [
          "config"
        ],
        "summary": "Public feature flags",
        "operationId": "get_api_config_flags",
        "parameters": [
          {
            "name": "keys",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/config/thresholds": {
      "get": {
        "tags": [
          "config"
        ],
        "summary": "Public thresholds",
        "operationId": "get_api_config_thresholds",
        "parameters": [
          {
            "name": "keys",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/config/tools-index": {
      "get": {
        "tags": [
          "tools"
        ],
        "summary": "Lightweight tool index",
        "operationId": "get_api_config_tools_index",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/tools/lookup": {
      "get": {
        "tags": [
          "tools"
        ],
        "summary": "Look up tools by slugs",
        "operationId": "get_api_tools_lookup",
        "parameters": [
          {
            "name": "slugs",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/tools/{slug}": {
      "post": {
        "tags": [
          "tools"
        ],
        "summary": "Execute a tool on uploaded files (Idempotency-Key supported)",
        "operationId": "post_api_tools_slug",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/presign-upload": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Presign an upload (returns url or multipart)",
        "operationId": "post_api_files_presign_upload",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "size": {
                    "type": "integer"
                  },
                  "checksum": {
                    "type": "string"
                  },
                  "jobType": {
                    "type": "string"
                  },
                  "createJob": {
                    "type": "boolean"
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/confirm": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Confirm uploaded file (magic check)",
        "operationId": "post_api_files_confirm",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/jobs-latest": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "Latest job for a file",
        "operationId": "get_api_files_jobs_latest",
        "parameters": [
          {
            "name": "fileId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/import-url": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Import a file from a URL into R2 (SSRF-guarded)",
        "operationId": "post_api_files_import_url",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "jobType": {
                    "type": "string"
                  },
                  "createJob": {
                    "type": "boolean"
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "List my files",
        "operationId": "get_api_files",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Create a job from uploaded fileIds",
        "operationId": "post_api_files",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "fileIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/{fileId}": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "File detail",
        "operationId": "get_api_files_fileId",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "delete": {
        "tags": [
          "files"
        ],
        "summary": "Delete a file",
        "operationId": "delete_api_files_fileId",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/download/{fileId}": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "Stream a file (auth)",
        "operationId": "get_api_files_download_fileId",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/presign-download": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Presign download URL",
        "operationId": "post_api_files_presign_download",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/multipart/part": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Presign a multipart part URL",
        "operationId": "post_api_files_multipart_part",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {
                    "type": "string"
                  },
                  "uploadId": {
                    "type": "string"
                  },
                  "partNumber": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/multipart/complete": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Complete a multipart upload",
        "operationId": "post_api_files_multipart_complete",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {
                    "type": "string"
                  },
                  "uploadId": {
                    "type": "string"
                  },
                  "parts": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/files/multipart/abort": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Abort a multipart upload",
        "operationId": "post_api_files_multipart_abort",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {
                    "type": "string"
                  },
                  "uploadId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/jobs/{jobId}": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "Job status / output",
        "operationId": "get_api_jobs_jobId",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch/settings": {
      "get": {
        "tags": [
          "batch"
        ],
        "summary": "Batch limits/settings",
        "operationId": "get_api_batch_settings",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch/estimate": {
      "post": {
        "tags": [
          "batch"
        ],
        "summary": "Estimate batch credits",
        "operationId": "post_api_batch_estimate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileCount": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch": {
      "post": {
        "tags": [
          "batch"
        ],
        "summary": "Create batch job",
        "operationId": "post_api_batch",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "fileIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "params": {
                    "type": "object"
                  },
                  "name": {
                    "type": "string"
                  },
                  "engine": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "get": {
        "tags": [
          "batch"
        ],
        "summary": "List my batches",
        "operationId": "get_api_batch",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch/{id}": {
      "get": {
        "tags": [
          "batch"
        ],
        "summary": "Batch detail",
        "operationId": "get_api_batch_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch/{id}/cancel": {
      "post": {
        "tags": [
          "batch"
        ],
        "summary": "Cancel batch",
        "operationId": "post_api_batch_id_cancel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch/{id}/retry": {
      "post": {
        "tags": [
          "batch"
        ],
        "summary": "Retry failed items",
        "operationId": "post_api_batch_id_retry",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch/{id}/events": {
      "get": {
        "tags": [
          "batch"
        ],
        "summary": "Batch progress SSE",
        "operationId": "get_api_batch_id_events",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch/{id}/zip": {
      "get": {
        "tags": [
          "batch"
        ],
        "summary": "Download batch ZIP (cached)",
        "operationId": "get_api_batch_id_zip",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/batch/presets": {
      "get": {
        "tags": [
          "batch"
        ],
        "summary": "List presets",
        "operationId": "get_api_batch_presets",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "batch"
        ],
        "summary": "Create preset",
        "operationId": "post_api_batch_presets",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/validate": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Validate a graph",
        "operationId": "post_api_workflows_validate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "graphJson": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows": {
      "get": {
        "tags": [
          "workflows"
        ],
        "summary": "List workflows",
        "operationId": "get_api_workflows",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Create workflow",
        "operationId": "post_api_workflows",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "graphJson": {
                    "type": "string"
                  },
                  "paramsJson": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/catalog": {
      "get": {
        "tags": [
          "workflows"
        ],
        "summary": "Server/VPS executable operation catalog",
        "operationId": "get_api_workflows_catalog",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/{id}": {
      "put": {
        "tags": [
          "workflows"
        ],
        "summary": "Update workflow",
        "operationId": "put_api_workflows_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "delete": {
        "tags": [
          "workflows"
        ],
        "summary": "Delete workflow",
        "operationId": "delete_api_workflows_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/{id}/estimate": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Estimate run cost",
        "operationId": "post_api_workflows_id_estimate",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/{id}/run": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Run workflow",
        "operationId": "post_api_workflows_id_run",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/runs/{runId}": {
      "get": {
        "tags": [
          "workflows"
        ],
        "summary": "Run detail + steps + pending approvals",
        "operationId": "get_api_workflows_runs_runId",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/runs/{runId}/retry": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Retry run",
        "operationId": "post_api_workflows_runs_runId_retry",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/runs/{runId}/replay": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Replay run with same inputs",
        "operationId": "post_api_workflows_runs_runId_replay",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/{id}/versions": {
      "get": {
        "tags": [
          "workflows"
        ],
        "summary": "List workflow versions",
        "operationId": "get_api_workflows_id_versions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/{id}/versions/{versionId}/restore": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Restore a workflow version",
        "operationId": "post_api_workflows_id_versions_versionId_restore",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "versionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/runs/{runId}/approve": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Approve/reject a run",
        "operationId": "post_api_workflows_runs_runId_approve",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/templates": {
      "get": {
        "tags": [
          "workflows"
        ],
        "summary": "List templates (built-in + mine)",
        "operationId": "get_api_workflows_templates",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Save personal template",
        "operationId": "post_api_workflows_templates",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/templates/{id}": {
      "delete": {
        "tags": [
          "workflows"
        ],
        "summary": "Delete personal template",
        "operationId": "delete_api_workflows_templates_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/{id}/triggers": {
      "get": {
        "tags": [
          "workflows"
        ],
        "summary": "List triggers",
        "operationId": "get_api_workflows_id_triggers",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "summary": "Create/update trigger",
        "operationId": "put_api_workflows_id_triggers",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/workflows/{id}/hook": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Webhook trigger (HMAC or legacy secret)",
        "operationId": "post_api_workflows_id_hook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/tokens": {
      "get": {
        "tags": [
          "tokens"
        ],
        "summary": "List my API tokens",
        "operationId": "get_api_tokens",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "tokens"
        ],
        "summary": "Create API token (plaintext once)",
        "operationId": "post_api_tokens",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expiresAt": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/tokens/{id}": {
      "delete": {
        "tags": [
          "tokens"
        ],
        "summary": "Revoke token",
        "operationId": "delete_api_tokens_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/account/export": {
      "get": {
        "tags": [
          "account"
        ],
        "summary": "Export my data (JSON)",
        "operationId": "get_api_account_export",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/account/delete-data": {
      "post": {
        "tags": [
          "account"
        ],
        "summary": "Delete all my data",
        "operationId": "post_api_account_delete_data",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/pro/quota": {
      "get": {
        "tags": [
          "account"
        ],
        "summary": "My quota for a feature",
        "operationId": "get_api_pro_quota",
        "parameters": [
          {
            "name": "feature",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "tags": [
          "mcp"
        ],
        "summary": "MCP JSON-RPC (initialize/tools/list/tools/call)",
        "operationId": "post_api_mcp",
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "responses": {
          "200": {
            "description": "Envelope { ok: true, data }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    }
  }
}