{ "openapi": "3.1.0", "info": { "title": "hose-use API & MCP Tools Specification", "version": "0.5.1", "description": "Unified Enterprise SaaS API, CLI, and MCP Specification for Ekuaibao (合思/易快报), EASO, and Piper Workflows." }, "servers": [ { "url": "http://localhost:3000", "description": "Local hose-use CLI / MCP Runtime Gateway" } ], "tags": [ { "name": "Auth & SSO", "description": "统一认证、多账号管理与 30 天 Token 自动无感续杯" }, { "name": "Corps & Tenancy", "description": "多企业租户管理与工作空间切换" }, { "name": "Platforms", "description": "自建应用检索与实例枚举" }, { "name": "Workflows", "description": "跨自建应用工作流聚合检索、DSL 图谱与启停" }, { "name": "Bills & Documents", "description": "费控单据、报销借款单、发票明细与 DataLink 实体字典" }, { "name": "Probe & Diagnostics", "description": "会话有效性与 EASO 鉴权连通性诊断" } ], "paths": { "/api/auth/login": { "post": { "tags": [ "Auth & SSO" ], "summary": "纯 API 账密自动全流程登录", "description": "自动拉取公钥进行 RSA PKCS#1 加密,发起统一认证中心握手并批量获取名下所有企业身份。", "operationId": "authLogin", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "phone", "password" ], "properties": { "phone": { "type": "string", "description": "登录手机号", "example": "17718556446" }, "password": { "type": "string", "description": "登录明文密码 (由客户端自动完成 RSA 加密)" }, "autoSwitch": { "type": "boolean", "description": "是否自动切换到首个企业", "default": true } } } } } }, "responses": { "200": { "description": "登录成功", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "totalCorps": { "type": "integer" }, "activeCorp": { "type": "object", "properties": { "corpId": { "type": "string", "description": "企业唯一标识" }, "corpName": { "type": "string", "description": "企业名称" }, "staffId": { "type": "string", "description": "员工身份 ID" }, "accountId": { "type": "string", "description": "归属账号手机号" } } } } } } } }, "401": { "description": "账密错误或鉴权失败", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "操作失败原因" } } } } } } } } }, "/api/auth/status": { "get": { "tags": [ "Auth & SSO" ], "summary": "查看当前登录与活跃企业状态", "description": "查询本地或无状态下的当前账号、工作企业与凭证有效期。", "operationId": "authStatus", "responses": { "200": { "description": "状态正常", "content": { "application/json": { "schema": { "type": "object", "properties": { "loggedIn": { "type": "boolean" }, "activeCorpId": { "type": "string" }, "activeCorpName": { "type": "string" }, "totalAccounts": { "type": "integer" }, "totalCorps": { "type": "integer" } } } } } } } } }, "/api/auth/refresh": { "post": { "tags": [ "Auth & SSO" ], "summary": "批量刷新企业 30 天 AccessToken", "description": "自动无感为当前账号名下的所有企业租户更新最新 30 天访问令牌。", "operationId": "authRefresh", "responses": { "200": { "description": "刷新完成", "content": { "application/json": { "schema": { "type": "object", "properties": { "refreshed": { "type": "integer" }, "total": { "type": "integer" } } } } } } } } }, "/api/corps": { "get": { "tags": [ "Corps & Tenancy" ], "summary": "列出当前账号名下所有已配置企业租户", "description": "支持单账号管理多家企业与同一企业下的多员工身份分层展示。", "operationId": "listCorps", "responses": { "200": { "description": "企业租户列表", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "corpId": { "type": "string", "description": "企业唯一标识" }, "corpName": { "type": "string", "description": "企业名称" }, "staffId": { "type": "string", "description": "员工身份 ID" }, "accountId": { "type": "string", "description": "归属账号手机号" } } } } } } } } } }, "/api/corps/switch": { "post": { "tags": [ "Corps & Tenancy" ], "summary": "切换当前工作企业", "description": "在有状态模式下切换并记忆工作企业,后续操作自动以该企业身份执行。", "operationId": "switchCorp", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "corpId" ], "properties": { "corpId": { "type": "string", "description": "目标企业 ID 或身份 ID (corpId@accountId)" } } } } } }, "responses": { "200": { "description": "切换成功", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "activeCorp": { "type": "object", "properties": { "corpId": { "type": "string", "description": "企业唯一标识" }, "corpName": { "type": "string", "description": "企业名称" }, "staffId": { "type": "string", "description": "员工身份 ID" }, "accountId": { "type": "string", "description": "归属账号手机号" } } } } } } } } } } }, "/api/platforms": { "get": { "tags": [ "Platforms" ], "summary": "查询企业下所有启用的自建应用", "description": "枚举当前企业已配置的自建应用及 EASO 平台实例。", "operationId": "listPlatforms", "parameters": [ { "name": "corpId", "in": "query", "required": false, "schema": { "type": "string" }, "description": "目标企业 ID (未指定时使用默认工作企业)" } ], "responses": { "200": { "description": "自建应用列表", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "自建应用 ID" }, "name": { "type": "string", "description": "自建应用名称" }, "code": { "type": "string", "description": "应用编码" }, "status": { "type": "string", "description": "应用状态" } } } } } } } } } }, "/api/workflows": { "get": { "tags": [ "Workflows" ], "summary": "跨自建应用汇总查看全部工作流", "description": "自动遍历当前企业下所有自建应用,聚合返回全量工作流列表及运行状态。", "operationId": "listAllWorkflows", "parameters": [ { "name": "corpId", "in": "query", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "聚合工作流列表", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "工作流 ID" }, "name": { "type": "string", "description": "工作流名称" }, "platformId": { "type": "string", "description": "归属自建应用 ID" }, "platformName": { "type": "string", "description": "归属自建应用名称" }, "state": { "type": "integer", "description": "1: 启用, 0: 停用" }, "updatedAt": { "type": "string" } } } } } } } } } }, "/api/workflows/find": { "get": { "tags": [ "Workflows" ], "summary": "按节点类型递归搜索工作流", "description": "递归解析所有工作流的 DSL 节点图谱,检索包含特定任务类型(如 code-js2, loop, sql 等)的工作流。", "operationId": "findWorkflowsByTask", "parameters": [ { "name": "task", "in": "query", "required": true, "schema": { "type": "string" }, "example": "code-js2", "description": "目标节点任务类型" }, { "name": "corpId", "in": "query", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "匹配的工作流列表", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "工作流 ID" }, "name": { "type": "string", "description": "工作流名称" }, "platformId": { "type": "string", "description": "归属自建应用 ID" }, "platformName": { "type": "string", "description": "归属自建应用名称" }, "state": { "type": "integer", "description": "1: 启用, 0: 停用" }, "updatedAt": { "type": "string" } } } } } } } } } }, "/api/workflows/{pipelineId}": { "get": { "tags": [ "Workflows" ], "summary": "获取单个工作流详情与节点结构", "description": "查询指定工作流的完整节点链、输入输出参数映射与触发器配置。", "operationId": "getWorkflowDetail", "parameters": [ { "name": "pipelineId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "工作流 ID" } ], "responses": { "200": { "description": "工作流详情", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "state": { "type": "integer" }, "nodes": { "type": "array", "items": { "type": "object" }, "description": "工作流节点列表 (code-js2, loop, sql 等)" }, "links": { "type": "array", "items": { "type": "object" } } } } } } } } } }, "/api/workflows/{pipelineId}/toggle": { "put": { "tags": [ "Workflows" ], "summary": "启用或停用工作流", "description": "切换工作流的运行开关(1: 启用, 0: 停用)。", "operationId": "toggleWorkflow", "parameters": [ { "name": "pipelineId", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "state" ], "properties": { "state": { "type": "integer", "enum": [ 0, 1 ], "description": "目标状态 (1=启用, 0=停用)" } } } } } }, "responses": { "200": { "description": "状态切换成功", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "state": { "type": "integer" } } } } } } } } }, "/api/bills": { "get": { "tags": [ "Bills & Documents" ], "summary": "检索费用单据与发票明细列表", "description": "查询企业名下的费用单据、报销单、借款单与发票列表,支持按单号、阶段、状态过滤。", "operationId": "listBills", "parameters": [ { "name": "code", "in": "query", "required": false, "description": "按单据编号/单号过滤(如 jO1it3cIufDjNS)", "schema": { "type": "string" } }, { "name": "keyword", "in": "query", "required": false, "description": "按关键字搜索标题、名称或内容", "schema": { "type": "string" } }, { "name": "stage", "in": "query", "required": false, "description": "按业务阶段过滤(expense 报销, loan 借款, payment 付款)", "schema": { "type": "string" } }, { "name": "state", "in": "query", "required": false, "description": "按审批/支付状态过滤(paid 已支付, approving 审批中, draft 草稿)", "schema": { "type": "string" } }, { "name": "count", "in": "query", "required": false, "description": "返回条数限制", "schema": { "type": "integer", "default": 20 } } ], "responses": { "200": { "description": "格式化后的单据列表", "content": { "application/json": { "schema": { "type": "object", "properties": { "total": { "type": "integer" }, "returned": { "type": "integer" }, "items": { "type": "array", "items": { "type": "object", "properties": { "billId": { "type": "string", "description": "单据 ID" }, "billCode": { "type": "string", "description": "单据业务编号 (单号)" }, "billName": { "type": "string", "description": "单据名称" }, "title": { "type": "string", "description": "单据标题" }, "stage": { "type": "string", "description": "业务阶段 (如 expense, loan, payment)" }, "state": { "type": "string", "description": "审批/支付状态 (如 paid, approving, draft)" }, "amount": { "type": "string", "description": "格式化金额 (如 ¥100.00 CNY)" }, "submitterId": { "type": "string", "description": "提交人员 ID" }, "submitDate": { "type": "string", "description": "提交时间" }, "corporationId": { "type": "string", "description": "归属企业 ID" }, "details": { "type": "object", "description": "DataLink 字段字典还原后的中文字段键值对" } } } } } } } } } } } }, "/api/bills/{code}": { "get": { "tags": [ "Bills & Documents" ], "summary": "根据单号或 ID 查询单据结构化详情", "description": "自动结合 DataLink 字段字典将代码字段还原为业务中文字段。", "operationId": "getBillByCode", "parameters": [ { "name": "code", "in": "path", "required": true, "description": "单据编号(如 n0GMIM0dkQmKbS)或单据 ID(如 ID01TRzg7HMLcb)", "schema": { "type": "string" } } ], "responses": { "200": { "description": "单据详情列表", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "billId": { "type": "string", "description": "单据 ID" }, "billCode": { "type": "string", "description": "单据业务编号 (单号)" }, "billName": { "type": "string", "description": "单据名称" }, "title": { "type": "string", "description": "单据标题" }, "stage": { "type": "string", "description": "业务阶段 (如 expense, loan, payment)" }, "state": { "type": "string", "description": "审批/支付状态 (如 paid, approving, draft)" }, "amount": { "type": "string", "description": "格式化金额 (如 ¥100.00 CNY)" }, "submitterId": { "type": "string", "description": "提交人员 ID" }, "submitDate": { "type": "string", "description": "提交时间" }, "corporationId": { "type": "string", "description": "归属企业 ID" }, "details": { "type": "object", "description": "DataLink 字段字典还原后的中文字段键值对" } } } } } } } } } }, "/api/bills/schema": { "get": { "tags": [ "Bills & Documents" ], "summary": "获取单据实体与数据模型字典", "description": "获取企业全部表单实体、中文字段 Label 与类型定义。", "operationId": "getBillSchemas", "responses": { "200": { "description": "实体模型字典", "content": { "application/json": { "schema": { "type": "object", "properties": { "totalEntities": { "type": "integer" }, "entities": { "type": "array", "items": { "type": "object" } } } } } } } } } }, "/api/probe": { "get": { "tags": [ "Probe & Diagnostics" ], "summary": "诊断当前企业鉴权与接口连通性", "description": "依次校验企业主站 Session Cookie、EASO 换票握手与自建应用接口可访问性。", "operationId": "probeCorp", "parameters": [ { "name": "corpId", "in": "query", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "诊断报告", "content": { "application/json": { "schema": { "type": "object", "properties": { "corpId": { "type": "string" }, "corpName": { "type": "string" }, "mainSession": { "type": "boolean", "description": "主站会话是否有效" }, "easoToken": { "type": "boolean", "description": "EASO 平台 Token 是否有效" }, "platformsReachable": { "type": "boolean", "description": "自建应用接口是否可访问" } } } } } } } } } }, "components": { "schemas": { "ErrorResponse": { "type": "object", "properties": { "error": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "操作失败原因" } } }, "AuthLoginRequest": { "type": "object", "required": [ "phone", "password" ], "properties": { "phone": { "type": "string", "description": "登录手机号", "example": "17718556446" }, "password": { "type": "string", "description": "登录明文密码 (由客户端自动完成 RSA 加密)" }, "autoSwitch": { "type": "boolean", "description": "是否自动切换到首个企业", "default": true } } }, "AuthStatusResponse": { "type": "object", "properties": { "loggedIn": { "type": "boolean" }, "activeCorpId": { "type": "string" }, "activeCorpName": { "type": "string" }, "totalAccounts": { "type": "integer" }, "totalCorps": { "type": "integer" } } }, "CorpConfig": { "type": "object", "properties": { "corpId": { "type": "string", "description": "企业唯一标识" }, "corpName": { "type": "string", "description": "企业名称" }, "staffId": { "type": "string", "description": "员工身份 ID" }, "accountId": { "type": "string", "description": "归属账号手机号" } } }, "PlatformItem": { "type": "object", "properties": { "id": { "type": "string", "description": "自建应用 ID" }, "name": { "type": "string", "description": "自建应用名称" }, "code": { "type": "string", "description": "应用编码" }, "status": { "type": "string", "description": "应用状态" } } }, "WorkflowSummary": { "type": "object", "properties": { "id": { "type": "string", "description": "工作流 ID" }, "name": { "type": "string", "description": "工作流名称" }, "platformId": { "type": "string", "description": "归属自建应用 ID" }, "platformName": { "type": "string", "description": "归属自建应用名称" }, "state": { "type": "integer", "description": "1: 启用, 0: 停用" }, "updatedAt": { "type": "string" } } }, "WorkflowDetail": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "state": { "type": "integer" }, "nodes": { "type": "array", "items": { "type": "object" }, "description": "工作流节点列表 (code-js2, loop, sql 等)" }, "links": { "type": "array", "items": { "type": "object" } } } }, "ProbeResult": { "type": "object", "properties": { "corpId": { "type": "string" }, "corpName": { "type": "string" }, "mainSession": { "type": "boolean", "description": "主站会话是否有效" }, "easoToken": { "type": "boolean", "description": "EASO 平台 Token 是否有效" }, "platformsReachable": { "type": "boolean", "description": "自建应用接口是否可访问" } } }, "FormattedBill": { "type": "object", "properties": { "billId": { "type": "string", "description": "单据 ID" }, "billCode": { "type": "string", "description": "单据业务编号 (单号)" }, "billName": { "type": "string", "description": "单据名称" }, "title": { "type": "string", "description": "单据标题" }, "stage": { "type": "string", "description": "业务阶段 (如 expense, loan, payment)" }, "state": { "type": "string", "description": "审批/支付状态 (如 paid, approving, draft)" }, "amount": { "type": "string", "description": "格式化金额 (如 ¥100.00 CNY)" }, "submitterId": { "type": "string", "description": "提交人员 ID" }, "submitDate": { "type": "string", "description": "提交时间" }, "corporationId": { "type": "string", "description": "归属企业 ID" }, "details": { "type": "object", "description": "DataLink 字段字典还原后的中文字段键值对" } } } } } }