{ "openapi": "3.1.0", "info": { "title": "Hose / Ekuaibao Downstream Native API", "version": "1.0.0", "description": "Raw downstream Ekuaibao (合思/易快报), EASO, and Piper business API contracts." }, "servers": [ { "url": "https://app.ekuaibao.com", "description": "合思/易快报主站与统一认证中心" }, { "url": "https://easo.ekuaibao.com", "description": "合思 EASO 开放平台网关" }, { "url": "https://piper.ekuaibao.com", "description": "合思 Piper 工作流与集成网关" } ], "tags": [ { "name": "SSO & Security", "description": "统一认证中心、RSA 公钥密码加密与多企业身份切换" }, { "name": "EASO & Piper Auth", "description": "开放平台 OAuth2 免登握手、换票与 Token 自动刷新" }, { "name": "Platforms & Apps", "description": "自建应用列表与集成检索" }, { "name": "Workflows & Pipelines", "description": "跨应用工作流聚合、运行日志、节点详情与启停" }, { "name": "Bills & Invoices", "description": "费控单据、报销单、借款单、发票与 DataLink 实体字典" }, { "name": "Jobs & Execution", "description": "工作流任务运行实例与调试" }, { "name": "Staffs & Webhooks", "description": "企业通讯录人员与 Webhook 触发配置" } ], "paths": { "/api/v2/invoice/search": { "post": { "tags": [ "Bills & Invoices" ], "summary": "检索企业费用单据与发票池", "description": "检索企业名下的费用单据、报销借款单、发票与审批流记录,支持分页与阶段过滤。", "operationId": "rawSearchInvoices", "parameters": [ { "name": "corporationId", "in": "query", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "limit": { "type": "object", "properties": { "start": { "type": "integer", "default": 0 }, "count": { "type": "integer", "default": 50 } } } } } } } }, "responses": { "200": { "description": "单据列表响应", "content": { "application/json": { "schema": { "type": "object", "properties": { "count": { "type": "integer" }, "items": { "type": "array", "items": { "type": "object" } } } } } } } } } }, "/api/v2/invoice": { "post": { "tags": [ "Bills & Invoices" ], "summary": "批量按 ID 精确获取单据详情", "description": "根据单据物理 ID 列表批量拉取完整的表单数据与状态。", "operationId": "rawGetInvoicesByIds", "parameters": [ { "name": "corporationId", "in": "query", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "type": "array", "items": { "type": "string" } } } } } } }, "responses": { "200": { "description": "单据详情列表", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object" } } } } } } } } } }, "/api/v2/datalink/entity/search": { "post": { "tags": [ "Bills & Invoices" ], "summary": "查询 DataLink 实体定义与字段字典", "description": "获取企业全部单据实体模型、字段 Label 中文映射与类型定义。", "operationId": "rawSearchEntities", "parameters": [ { "name": "corporationId", "in": "query", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "limit": { "type": "object", "properties": { "start": { "type": "integer", "default": 0 }, "count": { "type": "integer", "default": 100 } } } } } } } }, "responses": { "200": { "description": "实体定义字典", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object" } } } } } } } } } }, "/api/common/security/getPublicKey": { "post": { "tags": [ "SSO & Security" ], "summary": "获取统一认证中心 RSA 公钥", "description": "获取用于登录密码加密的 RSA Public Key 模数与指数 (PKCS#1)。", "operationId": "getPublicKey", "responses": { "200": { "description": "RSA 公钥响应", "content": { "application/json": { "schema": { "type": "object", "properties": { "value": { "type": "object", "properties": { "publicKey": { "type": "string", "description": "RSA 公钥字符串" }, "modulus": { "type": "string", "description": "RSA Modulus" }, "exponent": { "type": "string", "description": "RSA Exponent" } } } } } } } } } } }, "/api/common/login/verifyPhone": { "post": { "tags": [ "SSO & Security" ], "summary": "手机号与加密密码纯 API 登录", "description": "使用 RSA 加密后的密码和手机号发起统一认证,换取全企业 AccessToken 与 Session Cookie。", "operationId": "loginVerifyPhone", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "phone", "password" ], "properties": { "phone": { "type": "string", "description": "手机号" }, "password": { "type": "string", "description": "RSA 加密后的密码密文" }, "countryCode": { "type": "string", "default": "+86" } } } } } }, "responses": { "200": { "description": "登录成功并下发凭证", "content": { "application/json": { "schema": { "type": "object", "properties": { "value": { "type": "object", "properties": { "accessToken": { "type": "string", "description": "全局访问令牌" }, "user": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "phone": { "type": "string" } } } } } } } } } } } } }, "/api/common/user/corporations": { "get": { "tags": [ "SSO & Security" ], "summary": "获取账号名下可访问企业列表", "description": "拉取当前已登录账号授权的所有企业租户及其 Staff 身份。", "operationId": "listCorporations", "responses": { "200": { "description": "企业与身份列表", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/CorporationItem" } } } } } } } } } }, "/api/common/user/corporations/{corpId}/switch": { "post": { "tags": [ "SSO & Security" ], "summary": "切换工作企业上下文", "description": "切换当前会话至指定企业租户,并签发该企业的专属 Session。", "operationId": "switchCorporation", "parameters": [ { "name": "corpId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "目标企业 ID" } ], "responses": { "200": { "description": "切换结果", "content": { "application/json": { "schema": { "type": "object", "properties": { "value": { "type": "object", "properties": { "activeCorpId": { "type": "string" }, "staffId": { "type": "string" } } } } } } } } } } }, "/api/open/oauth2/auth": { "post": { "tags": [ "EASO & Piper Auth" ], "summary": "EASO 换票 Step 1: 获取授权码", "description": "使用主站会话 Cookie 和 appKey 获取临时 code。", "operationId": "easoGetAuthCode", "responses": { "200": { "description": "临时授权码", "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "string", "description": "临时授权码" } } } } } } } } }, "/api/open/oauth2/token": { "post": { "tags": [ "EASO & Piper Auth" ], "summary": "EASO 换票 Step 2: 换取 AccessToken", "description": "使用授权码 code 换取平台接口访问 Token 与 RefreshToken。", "operationId": "easoGetToken", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "code", "appKey", "appSecret" ], "properties": { "code": { "type": "string" }, "appKey": { "type": "string" }, "appSecret": { "type": "string" }, "grant_type": { "type": "string", "default": "authorization_code" } } } } } }, "responses": { "200": { "description": "平台 Token 响应", "content": { "application/json": { "schema": { "type": "object", "properties": { "access_token": { "type": "string" }, "refresh_token": { "type": "string" }, "expires_in": { "type": "integer" } } } } } } } } }, "/api/open/oauth2/user_info": { "get": { "tags": [ "EASO & Piper Auth" ], "summary": "EASO 换票 Step 3: 获取当前开放平台用户信息", "description": "使用 AccessToken 获取当前用户的 openId 与企业绑定身份。", "operationId": "easoGetUserInfo", "responses": { "200": { "description": "用户信息", "content": { "application/json": { "schema": { "type": "object", "properties": { "openId": { "type": "string" }, "corpId": { "type": "string" }, "name": { "type": "string" } } } } } } } } }, "/api/open/oauth2/token/refresh": { "post": { "tags": [ "EASO & Piper Auth" ], "summary": "EASO 令牌无感刷新", "description": "使用 refresh_token 换取新的 30 天 accessToken。", "operationId": "easoRefreshToken", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "refresh_token" ], "properties": { "refresh_token": { "type": "string" }, "grant_type": { "type": "string", "default": "refresh_token" } } } } } }, "responses": { "200": { "description": "新 Token", "content": { "application/json": { "schema": { "type": "object", "properties": { "access_token": { "type": "string" }, "refresh_token": { "type": "string" }, "expires_in": { "type": "integer" } } } } } } } } }, "/api/v2/datalink/platform/search": { "get": { "tags": [ "Platforms & Apps" ], "summary": "获取企业自建应用列表", "description": "查询指定企业下已启用的自建应用与平台实例列表。", "operationId": "searchPlatforms", "parameters": [ { "name": "corpId", "in": "query", "required": true, "schema": { "type": "string" }, "description": "企业 ID" }, { "name": "scope", "in": "query", "schema": { "type": "string", "default": "enable" } } ], "responses": { "200": { "description": "应用列表", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/PlatformItem" } } } } } } } } } }, "/api/easo/pipelines/logs": { "get": { "tags": [ "Workflows & Pipelines" ], "summary": "获取应用下的工作流列表与日志", "description": "按自建应用 ID 分页查询名下的工作流及最近执行日志。", "operationId": "listWorkflowsByPlatform", "parameters": [ { "name": "platformId", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "number", "in": "query", "schema": { "type": "integer", "default": 1 } }, { "name": "pageSize", "in": "query", "schema": { "type": "integer", "default": 20 } } ], "responses": { "200": { "description": "工作流分页列表", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/WorkflowPageData" }, "code": { "type": "string", "example": "SUCCESS" }, "message": { "type": "string", "example": "成功" } } } } } }, "400": { "description": "请求参数错误或鉴权异常", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "未授权或 Token 已失效", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/easo/stats": { "get": { "tags": [ "Workflows & Pipelines" ], "summary": "获取工作流运行统计", "description": "统计指定应用下工作流的成功、失败及总触发次数。", "operationId": "getWorkflowStats", "parameters": [ { "name": "platformId", "in": "query", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "工作流运行统计", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/WorkflowStatsData" }, "code": { "type": "string", "example": "SUCCESS" }, "message": { "type": "string", "example": "成功" } } } } } }, "400": { "description": "请求参数错误或鉴权异常", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "未授权或 Token 已失效", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/easo/charge": { "get": { "tags": [ "Workflows & Pipelines" ], "summary": "获取工作流配额与计费信息", "description": "查询当前企业工作流运行调用次数与配额剩余。", "operationId": "getWorkflowCharge", "responses": { "200": { "description": "配额信息", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/WorkflowChargeData" }, "code": { "type": "string", "example": "SUCCESS" }, "message": { "type": "string", "example": "成功" } } } } } }, "400": { "description": "请求参数错误或鉴权异常", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "未授权或 Token 已失效", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/easo/pipelines/{pipelineId}": { "get": { "tags": [ "Workflows & Pipelines" ], "summary": "获取工作流详情与 DSL 节点图", "description": "查询指定工作流的完整配置、触发器与节点链路图谱(code-js2, loop, sql 等)。", "operationId": "getWorkflowDetail", "parameters": [ { "name": "pipelineId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "工作流完整详情", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/WorkflowDetailData" }, "code": { "type": "string", "example": "SUCCESS" }, "message": { "type": "string", "example": "成功" } } } } } }, "400": { "description": "请求参数错误或鉴权异常", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "未授权或 Token 已失效", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/easo/pipelines/state/{pipelineId}": { "put": { "tags": [ "Workflows & Pipelines" ], "summary": "启用或停用工作流", "description": "切换工作流运行状态(1: 启用, 0: 停用)。", "operationId": "toggleWorkflowState", "parameters": [ { "name": "pipelineId", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "state", "in": "query", "required": true, "schema": { "type": "integer", "enum": [ 0, 1 ] } } ], "responses": { "200": { "description": "状态更新成功" } } } }, "/api/easo/jobs/running": { "get": { "tags": [ "Jobs & Execution" ], "summary": "获取运行中的任务实例", "description": "查询工作流正在执行的调试(DEBUG)或生产(PROD)任务列表。", "operationId": "listRunningJobs", "parameters": [ { "name": "pipelineId", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "runType", "in": "query", "schema": { "type": "string", "enum": [ "DEBUG", "PROD" ], "default": "DEBUG" } } ], "responses": { "200": { "description": "任务实例列表", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowJobItem" } }, "code": { "type": "string", "example": "SUCCESS" }, "message": { "type": "string", "example": "成功" } } } } } }, "400": { "description": "请求参数错误或鉴权异常", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "未授权或 Token 已失效", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/easo/dsl/all": { "get": { "tags": [ "Workflows & Pipelines" ], "summary": "获取企业全部 DSL 规则配置", "description": "查询企业下所有生效的 DSL 脚本规则。", "operationId": "listAllDsl", "responses": { "200": { "description": "DSL 规则列表", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowDslItem" } }, "code": { "type": "string", "example": "SUCCESS" }, "message": { "type": "string", "example": "成功" } } } } } }, "400": { "description": "请求参数错误或鉴权异常", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "未授权或 Token 已失效", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/easo/common/staffs": { "get": { "tags": [ "Staffs & Webhooks" ], "summary": "获取企业员工通讯录列表", "description": "查询企业内部或外部员工名单,用于工作流执行人与节点通知映射。", "operationId": "listCommonStaffs", "parameters": [ { "name": "external", "in": "query", "schema": { "type": "boolean", "default": false } } ], "responses": { "200": { "description": "员工列表", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/StaffItem" } }, "code": { "type": "string", "example": "SUCCESS" }, "message": { "type": "string", "example": "成功" } } } } } }, "400": { "description": "请求参数错误或鉴权异常", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "未授权或 Token 已失效", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/webhook/{pipelineId}": { "get": { "tags": [ "Staffs & Webhooks" ], "summary": "获取工作流 Webhook 触发配置", "description": "查询指定工作流的 Webhook URL 入口与密钥配置。", "operationId": "getWebhookInfo", "parameters": [ { "name": "pipelineId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Webhook 配置", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/WebhookInfoData" }, "code": { "type": "string", "example": "SUCCESS" }, "message": { "type": "string", "example": "成功" } } } } } }, "400": { "description": "请求参数错误或鉴权异常", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "未授权或 Token 已失效", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/easo/pipelines/{pipelineId}/sampleData": { "post": { "tags": [ "Workflows & Pipelines" ], "summary": "提取工作流调试/采样数据", "description": "触发工作流节点采样数据提取,用于脚本调试与输入校验。", "operationId": "sampleWorkflowData", "parameters": [ { "name": "pipelineId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "采样数据", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object" }, "type": { "type": "string" } } } } } } } } } }, "components": { "schemas": { "ErrorResponse": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "details": { "type": "object" } } }, "CorporationItem": { "type": "object", "properties": { "id": { "type": "string", "description": "企业 ID" }, "name": { "type": "string", "description": "企业名称" }, "staffId": { "type": "string", "description": "员工 ID" }, "role": { "type": "string", "description": "角色权限" } } }, "PlatformItem": { "type": "object", "properties": { "id": { "type": "string", "description": "自建应用 ID" }, "name": { "type": "string", "description": "应用名称" }, "code": { "type": "string", "description": "应用标识 Code" }, "icon": { "type": "string" }, "status": { "type": "string" } } }, "WorkflowPageData": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowItem" } }, "total": { "type": "integer" }, "number": { "type": "integer" }, "pageSize": { "type": "integer" } } }, "WorkflowItem": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "state": { "type": "integer", "description": "1: 启用, 0: 停用" }, "platformId": { "type": "string" }, "updatedAt": { "type": "string" } } }, "WorkflowStatsData": { "type": "object", "properties": { "totalCount": { "type": "integer" }, "successCount": { "type": "integer" }, "failCount": { "type": "integer" } } }, "WorkflowChargeData": { "type": "object", "properties": { "used": { "type": "integer" }, "total": { "type": "integer" }, "remaining": { "type": "integer" } } }, "WorkflowDetailData": { "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" }, "description": "节点连线" } } }, "WorkflowJobItem": { "type": "object", "properties": { "jobId": { "type": "string" }, "pipelineId": { "type": "string" }, "status": { "type": "string" }, "startTime": { "type": "string" } } }, "WorkflowDslItem": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "content": { "type": "string" } } }, "StaffItem": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "cellphone": { "type": "string" } } }, "WebhookInfoData": { "type": "object", "properties": { "webhookUrl": { "type": "string" }, "token": { "type": "string" } } } } } }