{
  "openapi": "3.0.0",
  "info": {
    "title": "n8n 公共 API",
    "version": "1.1.1"
  },
  "tags": [
    {
      "name": "Credential",
      "description": "凭据相关操作"
    }
  ],
  "servers": [
    {
      "url": "/api/v1",
      "description": "当前 n8n 实例（自托管版本的内置测试台）"
    },
    {
      "url": "{url}/api/v1",
      "description": "自托管 n8n 实例",
      "variables": {
        "url": {
          "default": "https://example.com"
        }
      }
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "CookieAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-N8N-API-KEY"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "CookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "n8n-auth"
      }
    },
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "description": "最多返回的数据项数量。",
        "required": false,
        "schema": {
          "type": "number",
          "default": 100,
          "maximum": 250
        }
      },
      "cursor": {
        "name": "cursor",
        "in": "query",
        "description": "将 cursor 参数设为上次请求响应中的 nextCursor 属性，以进行分页。使用默认值时，获取集合的第一页。更多信息，请参阅分页说明。",
        "required": false,
        "style": "form",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "dependencyListPublicDto.generated": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "agent",
                    "credential",
                    "dataTable",
                    "errorWorkflow",
                    "errorWorkflowParent",
                    "parentWorkflow",
                    "subWorkflow"
                  ],
                  "description": "与所请求资源的关系。`credential`、`dataTable`、`subWorkflow`、`errorWorkflow`：所请求的工作流使用此依赖项。`parentWorkflow`：此工作流使用所请求的资源。`errorWorkflowParent`：此工作流将所请求的工作流用作错误工作流。`agent`：此智能体使用所请求的资源。"
                },
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "projectId": {
                  "type": "string",
                  "description": "依赖项所属项目（已知时返回）。"
                }
              },
              "required": [
                "type",
                "id",
                "name"
              ]
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "inaccessibleCount": {
            "type": "integer",
            "minimum": 0,
            "description": "你无权访问的依赖项数量；这些依赖项不会列出。"
          }
        },
        "required": [
          "data",
          "nextCursor",
          "inaccessibleCount"
        ]
      }
    },
    "responses": {
      "badRequest": {
        "description": "请求无效，或提供的数据格式错误。"
      },
      "unauthorized": {
        "description": "未授权"
      },
      "forbidden": {
        "description": "禁止访问"
      },
      "notFound": {
        "description": "未找到指定资源。"
      }
    }
  },
  "paths": {
    "/credentials/{credentialId}/dependencies": {
      "get": {
        "operationId": "getCredentialDependencies",
        "tags": [
          "Credential"
        ],
        "summary": "列出凭据依赖项",
        "description": "列出使用此凭据的工作流和智能体。",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "凭据的 ID。",
            "name": "credentialId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "操作成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/dependencyListPublicDto.generated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/badRequest"
          },
          "401": {
            "$ref": "#/components/responses/unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/forbidden"
          },
          "404": {
            "$ref": "#/components/responses/notFound"
          }
        }
      }
    }
  }
}
