跳到正文

API

Voaaro API

由您的实例提供的 JSON HTTP API,与 Resend API 兼容。

地址

每个实例都提供自己的 API:

Texte
https://mail.example.com/api/v1

所有请求均通过 HTTPS 以 JSON(UTF-8)格式发送,并在 Authorization 请求头中携带密钥。日期采用 ISO 8601 格式,时区为 UTC。

API 的功能

资源用途页面
/emails、/emails/batch发送、定时、跟踪、取消、分享发送
/emails/receiving读取邮箱收到的邮件接收
/domains发信域名及其 DNS 记录域名
/api-keys创建和撤销密钥身份验证
/contacts、/segments、/topics、/contact-properties营销邮件的联系人联系人
/broadcasts营销邮件营销邮件
/newsletter、/forms、/newsletter-templates、/automations、/events设置、订阅表单、模板、自动化新闻通讯
/suppressions、/emails/events禁止发送列表、发送事件日志禁止发送列表与事件日志
/webhookswebhook 端点、投递记录、重放管理 webhook
/emails/metrics统计信息发送
/organizations客户组织,使用单独的运营方密钥(mko_…),这些路由默认停用组织

参考文档描述了每一个路由;它由 API 的 OpenAPI 3.1 文件生成,该文件会自动与服务的实际路由进行比对。

第一次调用

cURL

curl https://mail.example.com/api/v1/emails \
  -H "Authorization: Bearer $VOAARO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from": "Acme <notifications@example.com>", "to": "client@example.org", "subject": "Hello", "text": "First email."}'

Node / Bun

const { data, error } = await voaaro.emails.send({
  from: "Acme <notifications@example.com>",
  to: "client@example.org",
  subject: "Hello",
  text: "First email.",
})

Python

email = voaaro.Emails.send({
    "from": "Acme <notifications@example.com>",
    "to": "client@example.org",
    "subject": "Hello",
    "text": "First email.",
})

PHP

$email = $voaaro->emails->send([
    'from' => 'Acme <notifications@example.com>',
    'to' => 'client@example.org',
    'subject' => 'Hello',
    'text' => 'First email.',
]);

Go

sent, err := client.Emails.Send(&voaaro.SendEmailRequest{
	From:    "Acme <notifications@example.com>",
	To:      []string{"client@example.org"},
	Subject: "Hello",
	Text:    "First email.",
})

通用约定

所有路由都遵循相同的规则:

主题规则页面
列表使用 limit、after、before 游标,从新到旧排列;可按状态、地址或日期筛选分页
重试任何 POST 请求都可携带 Idempotency-Key 请求头,保留 24 小时幂等性
速率每个密钥每分钟 600 个请求,返回 RateLimit-* 请求头限制
错误始终返回 JSON {statusCode, name, message, error},即使是未知路由也是如此错误
字段请求中的未知字段会被拒绝(422);响应可能会随版本增加字段:请忽略您不认识的字段错误

延伸阅读

Esc