跳到正文
Won.dev
冷邮件 API

回复邮件

在原邮件会话中、用同一个邮箱回复对方,可带附件。发出时收取 $0.03。

POST https://api.won.dev/v1/email/replies/{id}/reply

回复对方的来信:邮件会发在原会话中,并使用这段对话一直在用的邮箱,所以对方看到的始终是与同一个人的对话。对方的原邮件会引用在下方。请以那位发件人的口吻撰写:纯文本,不使用占位符。价目表、产品目录等文件放在 attachments 中。正文会像发送活动的文案一样经过检查。发出时收取 $0.03;未能投递则不收费。不能回复已退订或已退信的人。24 小时内针对同一条回复的相同请求会被视为重复:你会拿到第一次的结果,不会重复发信。

  • 计费: email_sent $0.03:成功投递给对方邮件服务器的一封邮件。

参数

id 放在路径中,其余参数放在 JSON 请求体里。POST 请求还支持 Idempotency-Key 请求头,见重复请求。

参数类型必填说明(API 原文)
idstring是Reply ID, such as rpl_1q8w3e5r4k2m9x7p.
textstring是Your answer, as plain text.
attachmentsobject[]否Up to 3 files, 10 MB together: PDFs, pictures, office documents, CSV and text. Each needs content or url.
attachments[].filenamestring是The name the recipient sees, with its extension: .pdf, .png, .jpg, .jpeg, .gif, .webp, .docx, .xlsx, .pptx, .doc, .xls, .ppt, .csv, .txt.
attachments[].contentstring否The file, base64-encoded. Up to about 3 MB this way; pass url for a larger file.
attachments[].urlstring否Instead of content: a public https:// address we fetch the file from while the email is sent.
max_costnumber否Spending cap for this call in US dollars. If the call could cost more, it fails with budget_exceeded before anything is charged.
dry_runboolean否If true, only return the maximum cost of this call. Nothing runs, nothing is charged. Default: false.

响应

传入 dry_run: true 时不会发信,data 中只返回本次调用的最高费用,见预估费用。错误说明见错误码。

字段类型说明(API 原文)
dataobject
data.idstringMessage ID, such as msg_3e5r4k2m9x7p1q8w.
data.campaign_idstring
data.recipient_idstring
data.tostring
data.kindstep | reply | singlestep of the sequence, reply (your answer to a reply), or single (an email you sent on its own with POST /email/messages).
data.stepinteger | nullThe step, counted from 1. Null for a reply or a single email.
data.versionintegerWhich version of the step went out, counted from 1.
data.statussending | sent | bounced | failed | skippedsent, bounced, or sending for the seconds it takes. failed and skipped did not go out and cost nothing.
data.subjectstring
data.opensintegerOpens that look like a person's. Machines that fetch mail to scan it are left out.
data.clicksinteger
data.bounce_typehard | soft | null
data.costnumberWhat it cost, in US dollars. 0 after a refund.
data.attachmentsobject[]The files that went with it.
data.attachments[].filenamestring
data.attachments[].content_typestring
data.attachments[].sizeintegerIn bytes.
data.sent_atstring | null
noticestring | nullA plain sentence when there is something to know about this answer. Null otherwise.
usageobjectWhat this call was charged, and the balance left.
usage.unitemail_sent | email_sent_dedicated | email_capacity | email_dedicated_domainWhat is counted.
usage.recordsintegerHow many were returned and charged.
usage.already_paidintegerHow many more were returned for free, because this organization paid for them in the last 30 days.
usage.costnumberWhat this call cost, in US dollars.
usage.balancenumberThe balance left after this call, in US dollars.
usage.replayedbooleanTrue when this is a repeat of a request from the last 24 hours. Repeats are free.

示例

curl https://api.won.dev/v1/email/replies/rpl_1q8w3e5r4k2m9x7p/reply \
  -H "Authorization: Bearer $WON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "text": "Hi Dana,\n\nThanks. The price list is attached. Shall I send two samples?\n\nAlex",
  "attachments": [
    {
      "filename": "price-list.pdf",
      "url": "https://northwind-seating.example/price-list.pdf"
    }
  ]
}'
{
  "data": {
    "id": "msg_9x7p1q8w3e5r4k2m",
    "campaign_id": "cmp_7p1q8w3e5r4k2m9x",
    "recipient_id": "rcp_9x7p1q8w3e5r4k2m",
    "to": "dana.whitfield@harborline-imports.example",
    "kind": "reply",
    "step": null,
    "version": 1,
    "status": "sent",
    "subject": "Re: Office chairs for Harborline Imports",
    "opens": 0,
    "clicks": 0,
    "bounce_type": null,
    "cost": 0.03,
    "attachments": [
      {
        "filename": "price-list.pdf",
        "content_type": "application/pdf",
        "size": 182344
      }
    ],
    "sent_at": "2026-11-20T14:02:19.000Z"
  },
  "notice": null,
  "usage": {
    "unit": "email_sent",
    "records": 1,
    "already_paid": 0,
    "cost": 0.03,
    "balance": 48.05,
    "replayed": false
  }
}

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

本页内容