{
  "openapi": "3.0.0",
  "info": {
    "title": "n8n 公共 API",
    "version": "1.1.1"
  },
  "components": {
    "schemas": {
      "importResultDto.generated": {
        "type": "object",
        "properties": {
          "package": {
            "type": "object",
            "properties": {
              "sourceN8nVersion": {
                "type": "string"
              },
              "sourceId": {
                "type": "string"
              },
              "exportedAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "sourceN8nVersion",
              "sourceId",
              "exportedAt"
            ]
          },
          "workflows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sourceWorkflowId": {
                  "type": "string",
                  "description": "工作流在包中的 id。"
                },
                "localId": {
                  "type": "string",
                  "description": "目标实例上的工作流 id：`created` 时新建（`workflowIdPolicy=new` 时生成新 id，`source` 时使用包中的 id）；`updated`/`skipped` 时使用现有工作流的 id。"
                },
                "name": {
                  "type": "string"
                },
                "projectId": {
                  "type": "string"
                },
                "parentFolderId": {
                  "type": "string",
                  "nullable": true
                },
                "activeVersionId": {
                  "type": "string",
                  "nullable": true,
                  "description": "目标实例上的已发布版本（如有）。导入后工作流未发布时为 `null`。"
                },
                "isArchived": {
                  "type": "boolean",
                  "description": "导入后工作流在目标上是否归档。采用 `new-version` 时，遵循包中的 `isArchived` 标记；被跳过的工作流保留自身状态。"
                },
                "publishing": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "enum": [
                        "published",
                        "unpublished",
                        "unchanged",
                        "blocked",
                        "failed"
                      ],
                      "description": "`blocked` 表示导入版本无法发布，且没有激活版本，例如工作流使用了空白或不完整凭据，或使用实例未安装的节点类型。如果先前发布的版本仍处于激活状态，`state` 会为 `unchanged`，并附带 `skippedPublishReason`。`failed` 表示尝试了发布或取消发布，但操作未成功。"
                    },
                    "error": {
                      "type": "string",
                      "description": "`state` 为 `failed` 时返回，说明无法应用发布或取消发布操作的原因。"
                    },
                    "blockedReason": {
                      "type": "string",
                      "enum": [
                        "stub-credential",
                        "incomplete-credential",
                        "missing-node-type"
                      ],
                      "description": "`state` 为 `blocked` 时返回：导入版本无法发布，且没有激活版本。"
                    },
                    "skippedPublishReason": {
                      "type": "string",
                      "enum": [
                        "stub-credential",
                        "incomplete-credential",
                        "missing-node-type"
                      ],
                      "description": "`state` 为 `unchanged`，但策略原本要求发布导入版本时返回：先前发布的版本仍处于激活状态，例如更新后凭据为空或不完整。"
                    }
                  },
                  "required": [
                    "state"
                  ],
                  "description": "将所选发布策略应用到此工作流的结果。"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "created",
                    "updated",
                    "skipped"
                  ],
                  "description": "此包中工作流的导入结果。"
                }
              },
              "required": [
                "sourceWorkflowId",
                "localId",
                "name",
                "projectId",
                "parentFolderId",
                "activeVersionId",
                "isArchived",
                "publishing",
                "status"
              ]
            }
          },
          "removedWorkflows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "workflowId": {
                  "type": "string",
                  "description": "此实例上被移除工作流的 id。"
                },
                "name": {
                  "type": "string"
                },
                "projectId": {
                  "type": "string",
                  "description": "对工作流进行对齐处理的项目。"
                },
                "parentFolderId": {
                  "type": "string",
                  "nullable": true,
                  "description": "工作流原所在文件夹；位于项目根目录时为 null。"
                },
                "deletion": {
                  "type": "string",
                  "enum": [
                    "archived",
                    "deleted"
                  ],
                  "description": "实际发生的结果，而非 `overwriteDeletionPolicy` 请求的操作：如果请求 `hard-delete`，但相应记录尚不能删除，则报告为 `archived`。"
                }
              },
              "required": [
                "workflowId",
                "name",
                "projectId",
                "parentFolderId",
                "deletion"
              ]
            },
            "description": "此次导入期间从目标移除的工作流。"
          },
          "removedFolders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "folderId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "projectId": {
                  "type": "string"
                },
                "parentFolderId": {
                  "type": "string",
                  "nullable": true,
                  "description": "原所在文件夹；位于项目根目录时为 null。"
                }
              },
              "required": [
                "folderId",
                "name",
                "projectId",
                "parentFolderId"
              ]
            },
            "description": "包未定义、且在对齐处理后变为空的文件夹，由 `folderConflictPolicy=overwrite` 移除。仍包含任何内容的文件夹会保留，因此不会一并清理仅存在于目标的内容。其他策略下始终为空。"
          },
          "folders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sourceFolderId": {
                  "type": "string",
                  "description": "文件夹在包中的 id。"
                },
                "localId": {
                  "type": "string",
                  "description": "目标实例上的文件夹 id，等于 `sourceFolderId`，即复用文件夹 id。"
                },
                "name": {
                  "type": "string"
                },
                "parentFolderId": {
                  "type": "string",
                  "nullable": true,
                  "description": "目标上解析得到的父文件夹；位于项目根目录时为 `null`。"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "created",
                    "skipped"
                  ],
                  "description": "此包中文件夹的导入结果。"
                }
              },
              "required": [
                "sourceFolderId",
                "localId",
                "name",
                "parentFolderId",
                "status"
              ]
            },
            "description": "在目标项目中创建或跳过的文件夹结构。"
          },
          "projects": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sourceProjectId": {
                  "type": "string",
                  "description": "项目在包中的 id。"
                },
                "localId": {
                  "type": "string",
                  "description": "目标实例上的项目 id，等于 `sourceProjectId`，即复用项目 id。"
                },
                "name": {
                  "type": "string",
                  "description": "目标上的项目名称：采用 `overwrite` 时使用包中的名称，采用 `merge` 时使用原有名称。"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "created",
                    "updated",
                    "skipped"
                  ],
                  "description": "此包中项目的导入结果。`skipped` 表示项目已存在，且 `projectConflictPolicy=merge` 保留了原项目详情；项目内容仍会导入。"
                }
              },
              "required": [
                "sourceProjectId",
                "localId",
                "name",
                "status"
              ]
            },
            "description": "创建的项目结构，或匹配后更新或保留原样的项目结构，参见 `projectConflictPolicy`。项目包中会返回；导入独立工作流或文件夹时为空。"
          },
          "bindings": {
            "type": "object",
            "properties": {
              "workflows": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "credentials": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                },
                "description": "包清单 `requirements.credentials` 中的凭据 id → 目标实例上解析得到的凭据 id。同时涵盖匹配的现有凭据，以及通过 `credentialMissingMode=create-stub` 或 `create-with-values` 创建的凭据。"
              }
            },
            "required": [
              "workflows",
              "credentials"
            ],
            "description": "导入产生的源 id → 目标 id 映射，每种实体类型一个映射。每个值都将实体在包中的 id 映射到目标实例上的 id。"
          },
          "credentials": {
            "type": "object",
            "properties": {
              "matched": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "包中匹配到目标实例现有凭据的源凭据 id。"
              },
              "stubbed": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "已在目标项目中为其创建空白占位凭据的源凭据 id。"
              },
              "seeded": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "已在目标项目中为其创建凭据的源凭据 id；这些凭据包含包内表达式值携带的全部源数据。"
              },
              "incomplete": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "已在目标项目中使用包内表达式值创建凭据的源凭据 id，但包未确认其包含全部源数据。这些凭据还需补充信息。导入不会发布使用它们的工作流导入版本，原因为 `incomplete-credential`。"
              },
              "updated": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "此次导入通过 `credentialConflictPolicy=overwrite` 更改了其匹配凭据的源凭据 id。这些 id 不会列在 `matched` 中。其他策略下为空。"
              }
            },
            "required": [
              "matched",
              "stubbed",
              "seeded",
              "incomplete",
              "updated"
            ],
            "description": "按解析结果分组的源凭据 id：匹配现有凭据、创建空白占位凭据、创建带初始数据的凭据、创建不完整凭据，或匹配到此次导入已更新的凭据。完整的源→目标 id 映射见 `bindings.credentials`。"
          },
          "dataTables": {
            "type": "object",
            "properties": {
              "matched": {
                "type": "integer",
                "minimum": 0
              },
              "created": {
                "type": "integer",
                "minimum": 0
              },
              "updated": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "matched",
              "created",
              "updated"
            ]
          },
          "variables": {
            "type": "object",
            "properties": {
              "matched": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "解析到现有变量且保持不变的变量名，优先查找导入项目作用域，再查找全局作用域。此次导入重写的已解析变量会列在 `updated` 中。"
              },
              "missing": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "导入后仍未解析到的变量名。`variableMissingMode=do-nothing` 下，这些仅为警告：导入仍成功，不创建任何变量。成功的 `create-stub` 或 `create-with-value` 导入通常使此列表为空。"
              },
              "created": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "通过 `variableMissingMode=create-with-value` 使用包内值创建的变量名。空白占位变量会列在 `stubbed` 中。"
              },
              "stubbed": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "此次导入创建为空值的变量名：使用了 `variableMissingMode=create-stub`，或 `create-with-value` 没有可导出的值。其他结果下为空。"
              },
              "updated": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "此次导入通过 `variableConflictPolicy=overwrite`，将其现有值替换为包内值的变量名。其他策略下为空。"
              }
            },
            "required": [
              "matched",
              "missing",
              "created",
              "stubbed",
              "updated"
            ],
            "description": "包的变量需求解析结果。仅返回名称，响应绝不包含值。对于项目包，这些数组是在包级别汇总各目标结果得到的并集，可能重叠，例如某名称在一个项目中创建时带有值，在另一个项目中创建为空白占位变量；存在外部并发写入时，只能尽力准确分类。"
          },
          "tags": {
            "type": "object",
            "properties": {
              "matched": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "解析到 id 和名称均相同的现有标签，按原样附加。"
              },
              "created": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "此次导入通过 `tagMissingMode=create` 创建的标签，按名称列出。"
              },
              "renamed": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "通过 `tagConflictPolicy=rename` 重命名为包内名称的目标标签，按新名称列出。"
              },
              "reconciled": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "发生名称冲突时，通过 `tagConflictPolicy=rename` 将 id 改为包（源）id 的现有目标标签；其名称、工作流标签关联和文件夹标签关联均保留。"
              },
              "skipped": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "通过 `tagMissingMode=do-nothing` 或 `tagConflictPolicy=skip` 从导入中丢弃的标签：不创建、不重命名，也不附加到任何导入工作流。"
              }
            },
            "required": [
              "matched",
              "created",
              "renamed",
              "reconciled",
              "skipped"
            ],
            "description": "导入工作流引用的标签的解析结果，按源 id 匹配，仅包含标签名称。"
          }
        },
        "required": [
          "package",
          "workflows",
          "removedWorkflows",
          "removedFolders",
          "folders",
          "projects",
          "bindings",
          "credentials",
          "dataTables",
          "variables",
          "tags"
        ]
      }
    }
  }
}
