{
  "openapi": "3.0.0",
  "info": {
    "title": "n8n 公共 API",
    "version": "1.1.1"
  },
  "tags": [
    {
      "name": "Executions",
      "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": {
      "idempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "description": "此 POST 请求的安全重试键。使用 1 到 128 个可见 ASCII 字符。相同的键配合相同的请求，会返回首次成功的响应。使用此键发送不同请求时返回 422。首次请求仍在处理时重试，会返回 409。",
        "required": false,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[\\x21-\\x7E]+$"
        }
      }
    },
    "responses": {
      "badRequest": {
        "description": "请求无效，或提供的数据格式错误。"
      },
      "unauthorized": {
        "description": "未授权"
      },
      "forbidden": {
        "description": "禁止访问"
      },
      "notFound": {
        "description": "未找到指定资源。"
      },
      "conflict": {
        "description": "冲突"
      },
      "unprocessableEntity": {
        "description": "无法处理的实体"
      }
    }
  },
  "paths": {
    "/executions/{executionId}/stop": {
      "post": {
        "operationId": "stopExecution",
        "tags": [
          "Executions"
        ],
        "summary": "停止执行",
        "description": "按 id 停止某次执行。",
        "parameters": [
          {
            "$ref": "#/components/parameters/idempotencyKey"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "required": true,
            "description": "执行的 ID。",
            "name": "executionId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "操作成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "type": "string",
                      "enum": [
                        "cli",
                        "error",
                        "integrated",
                        "internal",
                        "manual",
                        "retry",
                        "trigger",
                        "webhook",
                        "evaluation",
                        "chat",
                        "agent"
                      ]
                    },
                    "startedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "执行开始的时间。"
                    },
                    "stoppedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "执行停止的时间；未记录停止时间时不返回。"
                    },
                    "finished": {
                      "type": "boolean",
                      "description": "执行是否已运行完成。请改用 `status`。",
                      "deprecated": true
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "canceled",
                        "crashed",
                        "error",
                        "new",
                        "running",
                        "success",
                        "unknown",
                        "waiting"
                      ]
                    }
                  },
                  "required": [
                    "mode",
                    "startedAt",
                    "finished",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/badRequest"
          },
          "401": {
            "$ref": "#/components/responses/unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/forbidden"
          },
          "404": {
            "$ref": "#/components/responses/notFound"
          },
          "409": {
            "$ref": "#/components/responses/conflict"
          },
          "422": {
            "$ref": "#/components/responses/unprocessableEntity"
          }
        }
      }
    }
  }
}
