跳到正文
Won.dev
文档API 参考
冷邮件 API

拒绝邮件

让等待审批的邮件不再发出,并结束这些人的序列。免费。

拒绝等待审批、或已批准但还没发出的邮件:它们不会发出(skipped),收件人也不会再收到这个活动的任何邮件(stopped,原因 declined)。如果想改发别的内容,请用 PATCH /email/messages/{id} 修改邮件。设置为需要审批的 key 不能拒绝(forbidden)。免费。

  • 计费: 免费。

用测试 key(won_test_...)发送这个请求,会在沙箱中运行:不发信,不收费。

POST
/email/messages/decline

鉴权

apiKey
headerAuthorizationBearer <API key>

Authorization: Bearer won_live_..., a key from the console.

请求头参数

Idempotency-Key?string

Any unique string. A retry with the same key and the same body returns the first response and is not charged again.

长度length <= 255

请求体

application/json
  1. body
message_ids*array<>

Up to 100 email IDs, such as msg_3e5r4k2m9x7p1q8w, from GET /email/messages?status=pending_approval.

元素1 <= items <= 100

响应体

The result.

application/json
  1. response
data*array<>

One result per ID, in the order given.

notice*|

A plain sentence when there is something to know about this answer. Null otherwise.

usage*

Nothing is charged here. The balance, for reference.

请求示例
curl -X POST 'https://api.won.dev/v1/email/messages/decline' \  -H 'Content-Type: application/json' \  -d '{  "message_ids": [    "msg_3e5r4k2m9x7p1q8w"  ]}'
响应示例
{  "data": [    {      "id": "msg_3e5r4k2m9x7p1q8w",      "done": true,      "status": "skipped"    }  ],  "notice": null,  "usage": {    "cost": 0,    "balance": 48.08,    "replayed": false  }}