跳转到内容
搜索文档

事件与架构

最后更新 查看 MarkdownAgent 设置

本页提供事件订阅可用事件源及其对应事件与架构的全面参考。所有事件均包含通用元数据字段,并遵循一致的结构。

事件源

Access

application.created

在创建应用程序时触发。

示例:

{
  "type": "cf.access.application.created",
  "source": {
    "type": "access"
  },
  "payload": {
    "id": "app-12345678-90ab-cdef-1234-567890abcdef",
    "name": "My Application"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

application.deleted

在删除应用程序时触发。

示例:

{
  "type": "cf.access.application.deleted",
  "source": {
    "type": "access"
  },
  "payload": {
    "id": "app-12345678-90ab-cdef-1234-567890abcdef",
    "name": "My Application"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

Artifacts

账户级事件 — 订阅 artifacts 源以接收您账户中任何仓库的事件。

repo.created

在创建仓库时触发。

示例:

{
  "type": "cf.artifacts.repo.created",
  "source": {
    "type": "artifacts",
    "namespace": "my-namespace",
    "repoName": "my-repo"
  },
  "payload": {
    "repoId": "0tvugavnogssnwzk",
    "defaultBranch": "main",
    "description": "My Artifacts repository",
    "readOnly": false,
    "createdAt": "2026-05-18T15:53:46.833Z",
    "updatedAt": "2026-05-18T15:53:46.833Z",
    "lastPushAt": null
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2026-05-18T15:53:48.187Z"
  }
}

repo.deleted

在删除仓库时触发。

示例:

{
  "type": "cf.artifacts.repo.deleted",
  "source": {
    "type": "artifacts",
    "namespace": "my-namespace",
    "repoName": "my-repo"
  },
  "payload": {
    "repoId": "0tvugavnogssnwzk",
    "defaultBranch": "main",
    "description": "My Artifacts repository",
    "readOnly": false,
    "createdAt": "2026-05-18T15:53:46.833Z",
    "updatedAt": "2026-05-18T15:53:46.833Z",
    "lastPushAt": null
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2026-05-18T15:53:59.914Z"
  }
}

repo.forked

在复刻仓库时触发。

示例:

{
  "type": "cf.artifacts.repo.forked",
  "source": {
    "type": "artifacts",
    "namespace": "source-namespace",
    "repoName": "source-repo"
  },
  "payload": {
    "namespace": "target-namespace",
    "repoName": "target-repo",
    "repoId": "5ankv1vhl4xnw7wq",
    "defaultBranch": "main",
    "description": "Fork of source-repo",
    "readOnly": false,
    "createdAt": "2026-05-18T15:53:52.384Z",
    "updatedAt": "2026-05-18T15:53:54.579Z",
    "lastPushAt": null
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2026-05-18T15:53:54.641Z"
  }
}

repo.imported

在从外部 Git 远程仓库导入仓库时触发。

示例:

{
  "type": "cf.artifacts.repo.imported",
  "source": {
    "type": "artifacts",
    "namespace": "my-namespace",
    "repoName": "my-repo"
  },
  "payload": {
    "repoId": "d7nd72k964cv9kub",
    "defaultBranch": "main",
    "description": null,
    "readOnly": false,
    "createdAt": "2026-05-18T15:53:54.864Z",
    "updatedAt": "2026-05-18T15:53:57.737Z",
    "lastPushAt": null,
    "sourceUrl": "https://github.com/example/repo.git",
    "branch": "main"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2026-05-18T15:53:58.195Z"
  }
}

仓库级事件 — 订阅 artifacts.repo 源并指定 namespacerepo_name,以接收限定于单个仓库的事件。

pushed

在向仓库推送提交时触发。

示例:

{
  "type": "cf.artifacts.repo.pushed",
  "source": {
    "type": "artifacts.repo",
    "namespace": "my-namespace",
    "repoName": "my-repo"
  },
  "payload": {
    "ref": "refs/heads/main",
    "before": "abc123def456abc123def456abc123def456abc1",
    "after": "def789ghi012def789ghi012def789ghi012def7",
    "commits": [
      {
        "id": "def789ghi012def789ghi012def789ghi012def7",
        "message": "Fix bug in authentication",
        "messageTruncated": false,
        "timestamp": "2025-05-01T02:48:57.000Z",
        "author": {
          "name": "Developer Name",
          "email": "[email protected]"
        },
        "committer": {
          "name": "Developer Name",
          "email": "[email protected]"
        },
        "parents": [
          "abc123def456abc123def456abc123def456abc1"
        ]
      }
    ],
    "totalCommitsCount": 1,
    "commitsTruncated": false
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

cloned

在克隆仓库时触发。

示例:

{
  "type": "cf.artifacts.repo.cloned",
  "source": {
    "type": "artifacts.repo",
    "namespace": "my-namespace",
    "repoName": "my-repo"
  },
  "payload": {},
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "0ab4c7b45a39491ba5da2973f3d093a6",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2026-05-18T15:53:51.358Z"
  }
}

fetched

在从仓库获取更新时触发。

示例:

{
  "type": "cf.artifacts.repo.fetched",
  "source": {
    "type": "artifacts.repo",
    "namespace": "my-namespace",
    "repoName": "my-repo"
  },
  "payload": {},
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "0ab4c7b45a39491ba5da2973f3d093a6",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2026-05-18T15:53:51.358Z"
  }
}

token.created

在创建仓库范围令牌时触发。包含令牌 ID、作用域和过期时间。

示例:

{
  "type": "cf.artifacts.repo.token.created",
  "source": {
    "type": "artifacts.repo",
    "namespace": "default",
    "repoName": "token-evt-repo"
  },
  "payload": {
    "tokenId": "7ngdf3ww3u84t33x",
    "scope": "read",
    "expiresAt": "2026-05-20T16:58:14.548Z"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "0ab4c7b45a39491ba5da2973f3d093a6",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2026-05-20T16:58:14.548Z"
  }
}

token.revoked

在撤销仓库范围令牌时触发。包含令牌 ID。

示例:

{
  "type": "cf.artifacts.repo.token.revoked",
  "source": {
    "type": "artifacts.repo",
    "namespace": "default",
    "repoName": "token-evt-repo"
  },
  "payload": {
    "tokenId": "7ngdf3ww3u84t33x"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "0ab4c7b45a39491ba5da2973f3d093a6",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2026-05-20T16:58:14.548Z"
  }
}

Email Sending

Email Sending 事件订阅会发布从已启用发送域发送的出站事务性电子邮件生命周期事件。每个订阅限定于一个发送域:zone 顶点(例如 example.com)或已验证的发送子域(例如 send.example.com)。

Email Routing 事件(包括入站转发、回复、Worker 发出的路由事件以及投递到已验证路由收件人的事件)不会作为 Email Sending 事件发布。

message.delivered

在收件人邮件服务器接受消息时触发。

示例:

{
	"type": "cf.email.sending.message.delivered",
	"source": {
		"type": "email.sending",
		"zoneId": "023e105f4ecef8ad9ca31a8372d0c353",
		"domain": "example.com"
	},
	"payload": {
		"eventId": "0190d0c4-7e9a-7b3c-9f12-1a2b3c4d5e6f",
		"messageId": "0101018f7d0c4d9a-msg-deadbeef",
		"sender": "[email protected]",
		"recipient": "[email protected]",
		"subject": "Welcome",
		"terminal": true,
		"delivery": {
			"status": "delivered",
			"provider": "gmail",
			"deliveryTimeMs": 1234,
			"smtpStatusCode": "250",
			"smtpEnhancedStatusCode": "2.0.0",
			"smtpResponse": "250 2.0.0 OK 1714820445 a1b2c3 - gsmtp"
		}
	},
	"metadata": {
		"accountId": "f9f79265f388666de8122cfb508d7776",
		"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
		"eventSchemaVersion": 1,
		"eventTimestamp": "2026-06-01T02:48:57.132Z"
	}
}

message.deferred

在发生临时投递失败且投递重试仍在等待中时触发。

示例:

{
	"type": "cf.email.sending.message.deferred",
	"source": {
		"type": "email.sending",
		"zoneId": "023e105f4ecef8ad9ca31a8372d0c353",
		"domain": "send.example.com"
	},
	"payload": {
		"eventId": "0190d0c4-7e9b-7714-9004-11f0b6d9a341",
		"messageId": "0101018f7d0c4d9a-msg-deferred",
		"sender": "[email protected]",
		"recipient": "[email protected]",
		"subject": "Your receipt",
		"terminal": false,
		"delivery": {
			"status": "deferred",
			"provider": "external_smtp",
			"deliveryTimeMs": 2143,
			"smtpStatusCode": "451",
			"smtpEnhancedStatusCode": "4.2.0",
			"smtpResponse": "451 4.2.0 Temporary mailbox error"
		},
		"bounce": {
			"type": "soft",
			"classification": "temporary_failure",
			"reason": "451 4.2.0 Temporary mailbox error"
		}
	},
	"metadata": {
		"accountId": "f9f79265f388666de8122cfb508d7776",
		"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
		"eventSchemaVersion": 1,
		"eventTimestamp": "2026-06-01T02:48:57.132Z"
	}
}

message.bounced

在发生永久退信,或临时投递重试已耗尽时触发。

示例:

{
	"type": "cf.email.sending.message.bounced",
	"source": {
		"type": "email.sending",
		"zoneId": "023e105f4ecef8ad9ca31a8372d0c353",
		"domain": "send.example.com"
	},
	"payload": {
		"eventId": "0190d0c4-7ea1-7af2-8b88-c1d2e3f4a5b6",
		"messageId": "0101018f7d0c4d9a-msg-bounced",
		"sender": "[email protected]",
		"recipient": "[email protected]",
		"subject": "Your receipt",
		"terminal": true,
		"delivery": {
			"status": "bounced",
			"provider": "external_smtp",
			"deliveryTimeMs": 2143,
			"smtpStatusCode": "550",
			"smtpEnhancedStatusCode": "5.1.1",
			"smtpResponse": "550 5.1.1 User unknown"
		},
		"bounce": {
			"type": "hard",
			"classification": "permanent_failure",
			"reason": "550 5.1.1 User unknown"
		}
	},
	"metadata": {
		"accountId": "f9f79265f388666de8122cfb508d7776",
		"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
		"eventSchemaVersion": 1,
		"eventTimestamp": "2026-06-01T02:48:57.132Z"
	}
}

message.failed

在发生内部或非 SMTP 投递错误时触发。

示例:

{
	"type": "cf.email.sending.message.failed",
	"source": {
		"type": "email.sending",
		"zoneId": "023e105f4ecef8ad9ca31a8372d0c353",
		"domain": "example.com"
	},
	"payload": {
		"eventId": "0190d0c4-81c1-7bc6-9344-829cd9001a12",
		"messageId": "0101018f7d0c4d9a-msg-failed",
		"sender": "[email protected]",
		"recipient": "[email protected]",
		"subject": "Welcome",
		"terminal": true,
		"delivery": {
			"status": "failed"
		},
		"failure": {
			"reason": "delivery_failed"
		}
	},
	"metadata": {
		"accountId": "f9f79265f388666de8122cfb508d7776",
		"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
		"eventSchemaVersion": 1,
		"eventTimestamp": "2026-06-01T02:48:57.132Z"
	}
}

message.rejected

在消息因策略(包括抑制、验证拒绝或垃圾邮件拒绝)而在投递前被拒绝时触发。

示例:

{
	"type": "cf.email.sending.message.rejected",
	"source": {
		"type": "email.sending",
		"zoneId": "023e105f4ecef8ad9ca31a8372d0c353",
		"domain": "example.com"
	},
	"payload": {
		"eventId": "0190d0c4-830a-77e5-8fa0-8d10f4e8dc8b",
		"messageId": "0101018f7d0c4d9a-msg-rejected",
		"sender": "[email protected]",
		"recipient": "[email protected]",
		"subject": "Welcome",
		"terminal": true,
		"delivery": {
			"status": "rejected"
		},
		"rejection": {
			"reason": "suppressed",
			"party": "recipient",
			"detail": "Recipient is suppressed"
		}
	},
	"metadata": {
		"accountId": "f9f79265f388666de8122cfb508d7776",
		"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
		"eventSchemaVersion": 1,
		"eventTimestamp": "2026-06-01T02:48:57.132Z"
	}
}

message.complained

在已投递的消息通过反馈循环被收件人标记为垃圾邮件时触发。

示例:

{
	"type": "cf.email.sending.message.complained",
	"source": {
		"type": "email.sending",
		"zoneId": "023e105f4ecef8ad9ca31a8372d0c353",
		"domain": "send.example.com"
	},
	"payload": {
		"eventId": "0190d0c4-9f01-7c44-b2a1-aabbccddeeff",
		"messageId": "0101018f7d0c4d9a-msg-complained",
		"sender": "[email protected]",
		"recipient": "[email protected]",
		"terminal": true,
		"delivery": {
			"status": "complained"
		},
		"complaint": {
			"type": "abuse"
		}
	},
	"metadata": {
		"accountId": "f9f79265f388666de8122cfb508d7776",
		"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
		"eventSchemaVersion": 1,
		"eventTimestamp": "2026-06-01T02:48:57.132Z"
	}
}

R2

bucket.created

在创建存储桶时触发。

示例:

{
  "type": "cf.r2.bucket.created",
  "source": {
    "type": "r2"
  },
  "payload": {
    "name": "my-bucket",
    "jurisdiction": "default",
    "location": "WNAM",
    "storageClass": "Standard"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

bucket.deleted

在删除存储桶时触发。

示例:

{
  "type": "cf.r2.bucket.deleted",
  "source": {
    "type": "r2"
  },
  "payload": {
    "name": "my-bucket",
    "jurisdiction": "default"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

Super Slurper

job.started

在迁移任务开始时触发。

示例:

{
  "type": "cf.superSlurper.job.started",
  "source": {
    "type": "superSlurper"
  },
  "payload": {
    "id": "job-12345678-90ab-cdef-1234-567890abcdef",
    "createdAt": "2025-05-01T02:48:57.132Z",
    "overwrite": true,
    "pathPrefix": "migrations/",
    "source": {
      "provider": "s3",
      "bucket": "source-bucket",
      "region": "us-east-1",
      "endpoint": "s3.amazonaws.com"
    },
    "destination": {
      "provider": "r2",
      "bucket": "destination-bucket",
      "jurisdiction": "default"
    }
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

job.paused

在迁移任务暂停时触发。

示例:

{
  "type": "cf.superSlurper.job.paused",
  "source": {
    "type": "superSlurper"
  },
  "payload": {
    "id": "job-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

job.resumed

在迁移任务恢复时触发。

示例:

{
  "type": "cf.superSlurper.job.resumed",
  "source": {
    "type": "superSlurper"
  },
  "payload": {
    "id": "job-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

job.completed

在迁移任务完成时触发。

示例:

{
  "type": "cf.superSlurper.job.completed",
  "source": {
    "type": "superSlurper"
  },
  "payload": {
    "id": "job-12345678-90ab-cdef-1234-567890abcdef",
    "totalObjectsCount": 1000,
    "skippedObjectsCount": 10,
    "migratedObjectsCount": 980,
    "failedObjectsCount": 10
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

job.aborted

在手动中止迁移任务时触发。

示例:

{
  "type": "cf.superSlurper.job.aborted",
  "source": {
    "type": "superSlurper"
  },
  "payload": {
    "id": "job-12345678-90ab-cdef-1234-567890abcdef",
    "totalObjectsCount": 1000,
    "skippedObjectsCount": 100,
    "migratedObjectsCount": 500,
    "failedObjectsCount": 50
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

job.object.migrated

在迁移对象时触发。

示例:

{
  "type": "cf.superSlurper.job.object.migrated",
  "source": {
    "type": "superSlurper.job",
    "jobId": "job-12345678-90ab-cdef-1234-567890abcdef"
  },
  "payload": {
    "key": "migrations/file.txt"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

Vectorize

index.created

在创建索引时触发。

示例:

{
  "type": "cf.vectorize.index.created",
  "source": {
    "type": "vectorize"
  },
  "payload": {
    "name": "my-vector-index",
    "description": "Index for embeddings",
    "createdAt": "2025-05-01T02:48:57.132Z",
    "modifiedAt": "2025-05-01T02:48:57.132Z",
    "dimensions": 1536,
    "metric": "cosine"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

index.deleted

在删除索引时触发。

示例:

{
  "type": "cf.vectorize.index.deleted",
  "source": {
    "type": "vectorize"
  },
  "payload": {
    "name": "my-vector-index"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

Workers AI

batch.queued

在批处理请求入队时触发。

示例:

{
  "type": "cf.workersAi.model.batch.queued",
  "source": {
    "type": "workersAi.model",
    "modelName": "@cf/baai/bge-base-en-v1.5"
  },
  "payload": {
    "requestId": "req-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

batch.succeeded

在批处理请求完成时触发。

示例:

{
  "type": "cf.workersAi.model.batch.succeeded",
  "source": {
    "type": "workersAi.model",
    "modelName": "@cf/baai/bge-base-en-v1.5"
  },
  "payload": {
    "requestId": "req-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

batch.failed

在批处理请求失败时触发。

示例:

{
  "type": "cf.workersAi.model.batch.failed",
  "source": {
    "type": "workersAi.model",
    "modelName": "@cf/baai/bge-base-en-v1.5"
  },
  "payload": {
    "requestId": "req-12345678-90ab-cdef-1234-567890abcdef",
    "message": "Model execution failed",
    "internalCode": 5001,
    "httpCode": 500
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

Workers Builds

build.started

在构建开始时触发。

示例:

{
  "type": "cf.workersBuilds.worker.build.started",
  "source": {
    "type": "workersBuilds.worker",
    "workerName": "my-worker"
  },
  "payload": {
    "buildUuid": "build-12345678-90ab-cdef-1234-567890abcdef",
    "status": "running",
    "buildOutcome": null,
    "createdAt": "2025-05-01T02:48:57.132Z",
    "initializingAt": "2025-05-01T02:48:58.132Z",
    "runningAt": "2025-05-01T02:48:59.132Z",
    "stoppedAt": null,
    "buildTriggerMetadata": {
      "buildTriggerSource": "push_event",
      "branch": "main",
      "commitHash": "abc123def456",
      "commitMessage": "Fix bug in authentication",
      "author": "[email protected]",
      "buildCommand": "npm run build",
      "deployCommand": "wrangler deploy",
      "rootDirectory": "/",
      "repoName": "my-worker-repo",
      "providerAccountName": "github-user",
      "providerType": "github"
    }
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

build.failed

在构建失败时触发。

示例:

{
  "type": "cf.workersBuilds.worker.build.failed",
  "source": {
    "type": "workersBuilds.worker",
    "workerName": "my-worker"
  },
  "payload": {
    "buildUuid": "build-12345678-90ab-cdef-1234-567890abcdef",
    "status": "failed",
    "buildOutcome": "failure",
    "createdAt": "2025-05-01T02:48:57.132Z",
    "initializingAt": "2025-05-01T02:48:58.132Z",
    "runningAt": "2025-05-01T02:48:59.132Z",
    "stoppedAt": "2025-05-01T02:50:00.132Z",
    "buildTriggerMetadata": {
      "buildTriggerSource": "push_event",
      "branch": "main",
      "commitHash": "abc123def456",
      "commitMessage": "Fix bug in authentication",
      "author": "[email protected]",
      "buildCommand": "npm run build",
      "deployCommand": "wrangler deploy",
      "rootDirectory": "/",
      "repoName": "my-worker-repo",
      "providerAccountName": "github-user",
      "providerType": "github"
    }
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

build.canceled

在构建被取消时触发。

示例:

{
  "type": "cf.workersBuilds.worker.build.canceled",
  "source": {
    "type": "workersBuilds.worker",
    "workerName": "my-worker"
  },
  "payload": {
    "buildUuid": "build-12345678-90ab-cdef-1234-567890abcdef",
    "status": "canceled",
    "buildOutcome": "canceled",
    "createdAt": "2025-05-01T02:48:57.132Z",
    "initializingAt": "2025-05-01T02:48:58.132Z",
    "runningAt": "2025-05-01T02:48:59.132Z",
    "stoppedAt": "2025-05-01T02:49:30.132Z",
    "buildTriggerMetadata": {
      "buildTriggerSource": "push_event",
      "branch": "main",
      "commitHash": "abc123def456",
      "commitMessage": "Fix bug in authentication",
      "author": "[email protected]",
      "buildCommand": "npm run build",
      "deployCommand": "wrangler deploy",
      "rootDirectory": "/",
      "repoName": "my-worker-repo",
      "providerAccountName": "github-user",
      "providerType": "github"
    }
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

build.succeeded

在构建成功时触发。

示例:

{
  "type": "cf.workersBuilds.worker.build.succeeded",
  "source": {
    "type": "workersBuilds.worker",
    "workerName": "my-worker"
  },
  "payload": {
    "buildUuid": "build-12345678-90ab-cdef-1234-567890abcdef",
    "status": "success",
    "buildOutcome": "success",
    "createdAt": "2025-05-01T02:48:57.132Z",
    "initializingAt": "2025-05-01T02:48:58.132Z",
    "runningAt": "2025-05-01T02:48:59.132Z",
    "stoppedAt": "2025-05-01T02:50:15.132Z",
    "buildTriggerMetadata": {
      "buildTriggerSource": "push_event",
      "branch": "main",
      "commitHash": "abc123def456",
      "commitMessage": "Fix bug in authentication",
      "author": "[email protected]",
      "buildCommand": "npm run build",
      "deployCommand": "wrangler deploy",
      "rootDirectory": "/",
      "repoName": "my-worker-repo",
      "providerAccountName": "github-user",
      "providerType": "github"
    }
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

Workers KV

namespace.created

在创建命名空间时触发。

示例:

{
  "type": "cf.kv.namespace.created",
  "source": {
    "type": "kv"
  },
  "payload": {
    "id": "ns-12345678-90ab-cdef-1234-567890abcdef",
    "name": "my-kv-namespace"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

namespace.deleted

在删除命名空间时触发。

示例:

{
  "type": "cf.kv.namespace.deleted",
  "source": {
    "type": "kv"
  },
  "payload": {
    "id": "ns-12345678-90ab-cdef-1234-567890abcdef",
    "name": "my-kv-namespace"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

Workflows

instance.queued

在创建实例并等待执行时触发。

示例:

{
  "type": "cf.workflows.workflow.instance.queued",
  "source": {
    "type": "workflows.workflow",
    "workflowName": "my-workflow"
  },
  "payload": {
    "versionId": "v1",
    "instanceId": "inst-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

instance.started

在实例开始或恢复执行时触发。

示例:

{
  "type": "cf.workflows.workflow.instance.started",
  "source": {
    "type": "workflows.workflow",
    "workflowName": "my-workflow"
  },
  "payload": {
    "versionId": "v1",
    "instanceId": "inst-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

instance.paused

在实例暂停执行时触发。

示例:

{
  "type": "cf.workflows.workflow.instance.paused",
  "source": {
    "type": "workflows.workflow",
    "workflowName": "my-workflow"
  },
  "payload": {
    "versionId": "v1",
    "instanceId": "inst-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

instance.errored

在实例步骤抛出错误时触发。

示例:

{
  "type": "cf.workflows.workflow.instance.errored",
  "source": {
    "type": "workflows.workflow",
    "workflowName": "my-workflow"
  },
  "payload": {
    "versionId": "v1",
    "instanceId": "inst-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

instance.terminated

在手动终止实例时触发。

示例:

{
  "type": "cf.workflows.workflow.instance.terminated",
  "source": {
    "type": "workflows.workflow",
    "workflowName": "my-workflow"
  },
  "payload": {
    "versionId": "v1",
    "instanceId": "inst-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

instance.completed

在实例成功完成执行时触发。

示例:

{
  "type": "cf.workflows.workflow.instance.completed",
  "source": {
    "type": "workflows.workflow",
    "workflowName": "my-workflow"
  },
  "payload": {
    "versionId": "v1",
    "instanceId": "inst-12345678-90ab-cdef-1234-567890abcdef"
  },
  "metadata": {
    "accountId": "f9f79265f388666de8122cfb508d7776",
    "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
    "eventSchemaVersion": 1,
    "eventTimestamp": "2025-05-01T02:48:57.132Z"
  }
}

通用架构字段

所有事件均包含以下通用字段:

字段 类型 描述
type string 事件类型标识符
source object 包含源特定信息,如 ID 和名称
metadata.accountId string 您的 Cloudflare 账户 ID
metadata.eventSubscriptionId string 触发此事件的订阅
metadata.eventSchemaVersion number 事件架构版本
metadata.eventTimestamp string 事件发生的 ISO 8601 时间戳
payload object 包含所发生事件详情的特定事件数据

这篇文档对您有帮助吗?