{
  "openapi": "3.0.0",
  "info": {
    "title": "n8n 公共 API",
    "version": "1.1.1"
  },
  "tags": [
    {
      "name": "CredentialTypePolicy",
      "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"
      }
    },
    "schemas": {
      "credentialTypePolicyEffectivePublicDto.generated": {
        "type": "object",
        "properties": {
          "scopeId": {
            "type": "string",
            "nullable": true
          },
          "rules": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "allow",
                    "deny",
                    "delegate"
                  ]
                },
                "selector": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "name"
                          ]
                        },
                        "value": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "kind",
                        "value"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "package"
                          ]
                        },
                        "value": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "kind",
                        "value"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "extends"
                          ]
                        },
                        "value": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "kind",
                        "value"
                      ],
                      "description": "匹配指定的凭据类型及继承它的所有类型"
                    }
                  ],
                  "type": "object"
                }
              },
              "required": [
                "id",
                "action",
                "selector"
              ]
            }
          },
          "defaultAction": {
            "type": "string",
            "enum": [
              "allow",
              "deny",
              "delegate"
            ]
          },
          "version": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "scopeId",
          "rules",
          "defaultAction",
          "version"
        ]
      }
    },
    "responses": {
      "unauthorized": {
        "description": "未授权"
      },
      "forbidden": {
        "description": "禁止访问"
      },
      "serviceUnavailable": {
        "description": "所请求的服务暂时不可用。"
      }
    }
  },
  "paths": {
    "/credential-type-policies/instance": {
      "get": {
        "operationId": "getCredentialTypeInstancePolicy",
        "tags": [
          "CredentialTypePolicy"
        ],
        "summary": "预览：获取实例的凭据类型策略",
        "description": "**预览**——即使不提升主版本号，也可能出现破坏性变更。\n\n返回组合后的实例作用域策略，包括默认动作，以及按评估顺序排列的所有已附加策略文档中的规则。从未配置过的实例会返回 `scopeId: null`、空规则、`defaultAction: allow` 和 `version: 0`。",
        "responses": {
          "200": {
            "description": "操作成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/credentialTypePolicyEffectivePublicDto.generated"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/forbidden"
          },
          "503": {
            "$ref": "#/components/responses/serviceUnavailable"
          }
        }
      }
    }
  }
}
