# 自动化

> Owner-built automations on triggers, with conditions, branches, delays, retries, custom triggers and HTTP actions.

> Markdown version of https://kanorio.com/zh-CN/developers/products/automation. Append `.md` to any developer docs URL for this format. Index: https://kanorio.com/llms.txt · MCP: https://app.kanorio.com/api/mcp
>
> Translated from the English original: https://kanorio.com/en/developers/products/automation.md

Status: **Available**

自动化功能会在特定事件发生时执行步骤：例如订单已支付、表单已提交、特定日期到达，或是您的系统报告了某个事件。发送电子邮件只是众多动作中的其中一种。

## 核心对象

- **触发条件与动作：** 一个包含每个触发条件数据与每个动作输入之 JSON schema 的目录。
- **自动化：** 在后台或通过 API 创建的条件、分支、延迟与速率限制。
- **执行记录：** 每次执行的详细步骤，包含重试机制、失败细节以及重新执行的选项。
- **自定义触发条件：** 使用 `POST /sites/{id}/automations/events` 报告您自己的事件以启动自动化。

## API 如何运作

- 使用 Management API 读取目录、创建与编辑自动化、进行测试，以及读取并重试执行记录。
- `automations.run.failed` Webhook 会在执行失败时通知您。

## What the APIs expose

| Capability | Status | API | Elements | Hosted site | Webhooks |
| --- | --- | --- | --- | --- | --- |
| Automation engine: trigger/action catalog, owner-built flows, per-step runs, custom triggers | Available | Management API (REST/MCP) `automations.catalog.get`, `automations.templates.list`, `automations.flows.*` (list/get/validate/create/update/set_status/archive/delete/test), `automations.runs.*` (list/get/rerun), `automations.events.report`/`cancel`, `automations.triggers.*`, `automations.secrets.*`; preinstalled toggles via `automations.list`/`set_action_enabled`; signed inbound endpoint `POST /api/webhooks/automations/<token>` (Standard Webhooks) | — | `/automations`, `/automations/settings` | Every trigger in the catalog is also a subscribable webhook event; custom triggers accept signed inbound webhooks (planned) |

## API reference

- Management API: [Automations](https://kanorio.com/en/developers/management-api/automations) (27 operations)

## Webhook events

- `automations.run.failed`: Fired when a run of an owner-built automation ends in FAILED after retries (compensation already applied). Not fired for test runs or platform-default automations; at most once per automation revision every 30 days.
- `automations.flow.paused`: Fired when Kanorio turns an owner-built automation off automatically because its current revision ran more than 20 times in the past 7 days and 95% or more of those runs failed.

Payloads: https://kanorio.com/en/developers/webhooks/events
