{
  "openapi": "3.0.0",
  "info": {
    "title": "n8n 公共 API",
    "version": "1.1.1"
  },
  "tags": [
    {
      "name": "NodeTypePolicy",
      "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": {
      "policyEffectivePublicDto.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"
                }
              },
              "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": {
    "/node-type-policies/projects/{projectId}": {
      "get": {
        "operationId": "getNodeTypeProjectPolicy",
        "tags": [
          "NodeTypePolicy"
        ],
        "summary": "预览：获取项目的节点类型策略",
        "description": "**预览**——即使不提升主版本号，也可能出现破坏性变更。\n\n返回项目自身组合后的策略，不是与实例策略合并后的结果。从未配置过的项目会返回 `scopeId: null`、空规则、`defaultAction: allow` 和 `version: 0`。",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "项目的 ID。",
            "name": "projectId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "操作成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/policyEffectivePublicDto.generated"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/forbidden"
          },
          "503": {
            "$ref": "#/components/responses/serviceUnavailable"
          }
        }
      }
    }
  }
}
