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

批准邮件

让等待审批的邮件按原样发出。免费。

批准等待审批(pending_approval)的邮件:每封都按写好的内容,在它的邮箱可以发信、且收件人处于工作时间时尽快发出。没有在等待审批的邮件(例如已经批准过的)保持不变(done: false)。设置为需要审批的 key 不能批准(forbidden):由人在控制台中批准。免费。

  • 计费: 调用免费,邮件本身也免费:它们从发件方的发信域名发出,域名按月付费,见发信域名。

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

POST
/email/messages/approve

鉴权

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/approve' \  -H 'Content-Type: application/json' \  -d '{  "message_ids": [    "msg_3e5r4k2m9x7p1q8w"  ]}'
响应示例
{  "data": [    {      "id": "msg_3e5r4k2m9x7p1q8w",      "done": true,      "status": "approved"    }  ],  "notice": null,  "usage": {    "cost": 0,    "balance": 48.08,    "replayed": false  }}