API 参考
账户与计费
使用 API 密钥读取账户用量、分析数据和密钥元数据;计费变更以及密钥的创建或吊销需要控制台会话。
没有与此筛选条件匹配的操作。
/account使用 API 密钥获取账户、用量、计费状态和工作区数量
相当于控制台个人资料页的 API 密钥版本:账户所有者、当前周期内收件人和附件的用量及套餐上限、访问级别、发件人信誉摘要、订阅状态、已发布的套餐以及工作区数量。只读;计费变更仍只能通过会话进行。
curl https://sendhq.cc/api/v1/account \
-X GET \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"user": {},
"usage": {},
"access": {},
"reputation": {},
"infrastructure": {},
"billing": {},
"plans": [],
"workspace": {
"mailer": "ses",
"stats": {}
}
}/account/diagnosticsDiagnose sending and receiving problems in the workspace
Read-only troubleshooting snapshot from stored state: an `issues` list in plain language, plan and usage against limits, each domain's DKIM and inbound state, sending identities, 30-day deliverability and sender reputation, suppressions and unsubscribes, the last 30 days of messages that were not sent with their reasons, bounce, complaint and reject events, and webhook delivery health. Never returns message bodies, API keys or webhook secrets.
curl https://sendhq.cc/api/v1/account/diagnostics \
-X GET \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"generatedAt": "2026-10-30T12:00:00.000Z",
"windowDays": 30,
"issues": [
{
"severity": "action",
"code": "domain_unverified",
"message": "example.com is not verified (pending); 2 of 3 DKIM records are not visible in DNS yet."
}
],
"plan": {},
"domains": [],
"sendingIdentities": {
"domains": [],
"addresses": []
},
"inbound": {},
"deliverability": {},
"suppressions": {},
"failures": {
"notSent": [],
"recentNotSent": [],
"recentProviderEvents": []
},
"webhooks": []
}/analytics获取 7 天、30 天或 90 天的控制台发信分析数据
时间窗口内的已发送、已接收、已送达、退信、被拦截、打开、点击和投诉总数,按天统计的发送/接收时间线,发信量最高的域名,以及表现最好的邮件主题。
curl https://sendhq.cc/api/v1/analytics \
-X GET \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"window": "30d",
"days": 30,
"metrics": {
"sent": 0,
"received": 0,
"bounced": 0,
"blocked": 0,
"delivered": 0,
"opened": 0,
"clicks": 0,
"complaints": 0
},
"timeline": [],
"domains": [],
"topContent": []
}/profile获取账户、用量和叠加的订阅状态
获取账户、用量和叠加的订阅状态
curl https://sendhq.cc/api/v1/profile \
-X GET \
-H "Cookie: sendhq_session_v2=…"{
"user": {},
"usage": {},
"access": {},
"reputation": {},
"billing": {},
"plans": []
}/billing/checkout为尚未持有的套餐(级别、邮件类别和计费周期)发起托管结账
为尚未持有的套餐(级别、邮件类别和计费周期)发起托管结账
curl https://sendhq.cc/api/v1/billing/checkout \
-X POST \
-H "Cookie: sendhq_session_v2=…" \
-H "Content-Type: application/json" \
-d '{"plan_key":"scaleup_marketing_annual"}'{
"url": "https://checkout.example/…",
"session_id": "…"
}/billing/cancel在应用内取消当前订阅,不触及支付服务商
在应用内取消当前订阅,不触及支付服务商
curl https://sendhq.cc/api/v1/billing/cancel \
-X POST \
-H "Cookie: sendhq_session_v2=…"{
"ok": true
}/keys创建 API 密钥
创建 API 密钥
curl https://sendhq.cc/api/v1/keys \
-X POST \
-H "Cookie: sendhq_session_v2=…" \
-H "Content-Type: application/json" \
-d '{"name":"Production"}'{
"id": "key_…",
"name": "Production",
"key": "re_…",
"prefix": "re_…"
}/keys列出 API 密钥元数据
列出密钥名称、非机密的前缀和最近使用时间。完整的密钥值永远不会返回。创建和吊销密钥需要控制台会话。
curl https://sendhq.cc/api/v1/keys \
-X GET \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"data": [],
"count": 0
}/keys/:id吊销 API 密钥
吊销 API 密钥
curl https://sendhq.cc/api/v1/keys/id_value \
-X DELETE \
-H "Cookie: sendhq_session_v2=…"{
"ok": true
}