跳到正文

API

禁止发送列表和事件日志

读取和维护不再向其发信的地址列表,并浏览最近 30 天内的每个发送事件。

禁止发送列表

每个发信域名都有自己的禁止发送列表:列表中的地址不会再收到该域名发出的任何邮件。发往这些地址的邮件不会被发送;该地址会出现在发送响应的 suppressed 中,以及 email.suppressed 事件中。该列表适用于发送 API、营销邮件和自动化。

列表会自动填充:永久退信(bounce)或垃圾邮件投诉(complaint)都会将收件人加入列表。您也可以自行添加地址(manual),例如当某位客户要求您不要再给他发邮件时。

这些路由需要 full_access 应用密钥,并且只能看到该密钥所属的域名。sending_access 密钥或个人密钥会收到 401 restricted_api_key;其他域名的地址返回 404。在控制台中也可以查看同一份列表(管理 › 禁止发送列表)。

方法路径作用
GET/api/v1/suppressions列出(筛选条件 domain、email、reason)
POST/api/v1/suppressions添加地址
GET/api/v1/suppressions/{id}读取一条记录
DELETE/api/v1/suppressions/{id}移除地址:之后将重新向其发信

添加地址

请求体:email(必填)和 domain;如果密钥只覆盖一个域名,domain 可以省略(否则返回 422)。响应为 201 并返回新建的记录;如果地址已在列表中,则返回 200 和现有记录(其原因不变)。

cURL

curl https://mail.example.com/api/v1/suppressions \
  -H "Authorization: Bearer $VOAARO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "former.customer@example.org", "domain": "example.com"}'

Node / Bun

const { data, error } = await voaaro.suppressions.add({ email: "former.customer@example.org", domain: "example.com" })

Python

s = voaaro.Suppressions.add({"email": "former.customer@example.org", "domain": "example.com"})

PHP

$entry = $voaaro->suppressions->add(['email' => 'former.customer@example.org', 'domain' => 'example.com']);

Go

s, err := client.Suppressions.Add(&voaaro.AddSuppressionRequest{Email: "former.customer@example.org", Domain: "example.com"})
JSON
{
  "object": "suppression",
  "id": "0b7d2c6e-3f41-4e0a-9d52-8a1c6f3e2b90",
  "email": "former.customer@example.org",
  "domain": "example.com",
  "reason": "manual",
  "details": null,
  "email_id": null,
  "created_at": "2026-11-12T09:30:00Z"
}
字段含义
reasonbounce(永久退信)、complaint(投诉)、manual(手动添加或通过 API 添加)
details远程服务器的响应,或收到的报告中的响应(文本),如果有的话
email_id导致该地址被加入列表的邮件(退信或投诉),否则为 null

列出和移除

GET /api/v1/suppressions 按时间从新到旧排列,未指定 limit 时每页 20 条(分页)。筛选条件:domain、email(地址包含该文本)、reason。

cURL
curl "https://mail.example.com/api/v1/suppressions?reason=bounce&limit=100" \
  -H "Authorization: Bearer $VOAARO_API_KEY"

curl -X DELETE https://mail.example.com/api/v1/suppressions/$ID \
  -H "Authorization: Bearer $VOAARO_API_KEY"

DELETE 返回 { "object": "suppression", "id": "…", "deleted": true }。

每次通过 API 添加和移除都会以该密钥的名义记入审核日志(suppression.add、suppression.remove)。

发送事件日志

GET /api/v1/emails/events 列出最近 30 天内发送的每个事件:接受、送达、拒绝、打开、点击…这与 webhook 使用的是同一份日志,您可以随时读取:用于补回错过的通知,或者在没有接收服务器的情况下使用。

任何密钥都可以读取它。它能看到的邮件与 GET /api/v1/emails 中相同:sending_access 密钥看到自己发送的邮件;full_access 应用密钥还能看到其域名下其他应用密钥发送的邮件;full_access 个人密钥能看到其所有者的各个个人密钥发送的邮件。

筛选条件取值
typeaccepted、sent、delivered、deferred、bounced、failed、suppressed、canceled、complained、opened、clicked
email_id某封邮件
recipient某个地址(不区分大小写)
created_after、created_beforeISO 8601 日期(2026-11-12T08:00:00Z);包含前者,不包含后者

cURL

curl "https://mail.example.com/api/v1/emails/events?type=bounced&created_after=2026-11-01T00:00:00Z&limit=100" \
  -H "Authorization: Bearer $VOAARO_API_KEY"

Node / Bun

const { data } = await voaaro.emails.events({ type: "bounced", createdAfter: "2026-11-01T00:00:00Z", limit: 100 })

Python

page = voaaro.Emails.events({"type": "bounced", "created_after": "2026-11-01T00:00:00Z", "limit": 100})

PHP

$page = $voaaro->emails->events(['type' => 'bounced', 'createdAfter' => '2026-11-01T00:00:00Z', 'limit' => 100]);

Go

page, err := client.Emails.Events(&voaaro.ListEmailEventsOptions{Type: "bounced", CreatedAfter: "2026-11-01T00:00:00Z"})
JSON
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "email_event",
      "id": "48213",
      "email_id": "4f9c1e0a-5b8d-4c7e-9a31-2d6f8b0c7e15",
      "type": "bounced",
      "recipient": "unknown@example.org",
      "details": { "smtp_reply": "550 5.1.1 User unknown" },
      "created_at": "2026-11-12T09:30:02.481Z"
    }
  ]
}
  • type 沿用日志中的名称:deferred 对应 last_event 中的 delivery_delayed,accepted 表示邮件已被接收处理。
  • 对于针对整封邮件的事件(accepted、sent、canceled),recipient 为 null。
  • details 的格式与 webhook 中相同。
  • id 是以文本形式表示的数字,可原样传给 after 或 before。未指定 limit 时每页 20 个事件。
Esc