API 文档
基础 URL:https://api.cybertemp.xyz每个账户都有免费 API 密钥。付费套餐会提高请求速率和可保留的收件箱数量。
如何使用我们的 API(很简单!)
公共 API:访问通用邮件数据
像 getMail 或 getDomains 等端点在所有套餐下用法相同:
- 免费版: 免费 API 密钥,每秒 10 次请求,最多同时保留 5 个收件箱。
- 付费套餐: 在 您的 API 密钥 使用
X-API-KEY标头,与免费版完全相同。您将获得更多每秒请求数 和更多可同时保留的收件箱,具体取决于您的套餐。
X-API-KEY: tk_your_api_key_here所有套餐通用一个密钥
如何获取 API 密钥
每个账户都可以免费获取 API 密钥,免费版也一样。大约只需一分钟:
创建免费账户(或登录)
用邮箱几秒钟即可注册;如果已有账户,直接登录即可。
访问设置
单击右上角的个人资料头像,然后从下拉菜单中选择“设置”。
生成 API 密钥
向下滚动到“API 密钥”部分,然后单击“生成新密钥”按钮。复制并安全地存储您的 API 密钥。
API 访问:超简单指南
X-API-KEY 发送每个请求。套餐决定每秒请求数以及可保留的收件箱数量。需要更高的每秒请求数或更多收件箱?比较套餐:
查看订阅套餐API 速率限制和功能
每个请求都需要 API 密钥。套餐设定两项限制:每秒请求数和可同时保留的收件箱数量。超出时会返回明确的 429 或 402 错误。
免费层级
需要 API 密钥 · 5 个收件箱
Eco 计划
€1.99/月 · 25 个收件箱
Core 计划
€2.99/月 · 100 个收件箱
Elite 计划
€4.99/月 · 收件箱数量不限
Team 计划
€49/月 · 5 个席位 · 每个席位均享 Elite 功能
记住:免费层级始终可用!
代码示例
// Requires your API key (free for every account)
async function getEmails(apiKey, email, limit = 25, offset = 0) {
const headers = { 'X-API-KEY': apiKey };
const params = new URLSearchParams({ email });
if (limit !== 25) params.append('limit', limit.toString());
if (offset > 0) params.append('offset', offset.toString());
const url = `https://api.cybertemp.xyz/getMail?${params}`;
const response = await fetch(url, { headers });
if (!response.ok) { const err = await response.text(); throw new Error('HTTP error! ' + response.status + ': ' + err); }
return response.json();
}更喜欢使用客户端库?跳转到 客户端库
Webhook
仅限 Elite + Team
事件类型
message.received新邮件到达您的某个收件箱。test_ping从仪表板的「测试」按钮触发 — 在真实邮件到达之前验证您的端点很有用。
请求标头
负载结构
{
"id": "7c4f...",
"type": "message.received",
"timestamp": "2026-05-17T09:31:00.000Z",
"data": {
"inbox_id": "[email protected]",
"inbox_address": "[email protected]",
"message_id": "9a1b...",
"from": "[email protected]",
"to": "[email protected]",
"subject": "Your verification code",
"snippet": "Your code is...",
"received_at": "2026-05-17T09:31:00.000Z"
}
}验证签名
使用您的签名密钥对原始请求正文进行 HMAC,并使用恒定时间比较与 X-Cybertemp-Signature 标头进行比较。
import crypto from "node:crypto";
import express from "express";
const app = express();
app.use("/webhooks/cybertemp",
express.raw({ type: "application/json" }));
app.post("/webhooks/cybertemp", (req, res) => {
const header = req.header("x-cybertemp-signature") || "";
const expected = "sha256=" + crypto
.createHmac("sha256", process.env.CT_WEBHOOK_SECRET)
.update(req.body)
.digest("hex");
// timingSafeEqual throws on a length mismatch: check it first so a
// missing or forged header is a clean 401, not a 500.
const a = Buffer.from(header);
const b = Buffer.from(expected);
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
return res.status(401).end();
}
const event = JSON.parse(req.body.toString("utf8"));
// ...handle event...
res.status(200).end();
});重试策略
每次 message.received 推送只尝试一次,超时时间为 10 秒。返回 2xx 视为成功,并会重置控制面板中显示的失败计数。失败的推送不会重试,因此请不时调用 GET /getMail,以补上可能错过的邮件。
管理您的 webhook 端点和签名密钥
打开设置 → Webhooks客户端库
pip install cybertempimport time
from cybertemp import CyberTemp
client = CyberTemp(api_key="tk_...")
emails = client.get_email_content(f"test{int(time.time())}@cybertemp.xyz")
domains = client.get_domains()go get github.com/sexfrance/cybertemp-goimport cybertemp "github.com/sexfrance/cybertemp-go"
c := cybertemp.New("tk_...")
inbox, _ := c.CreateInbox(ctx, nil)
msg, _ := c.WaitForMessage(ctx, inbox.ID, 60*time.Second, nil)cargo add cybertemp tokio --features tokio/fulluse cybertemp::Client;
use std::time::Duration;
let client = Client::new("tk_...");
let inbox = client.create_inbox().await?;
let msg = client.wait_for_message(&inbox.id, Duration::from_secs(60)).await?;无需安装包:Node 18+ 已内置 fetch。
const email = `test${Date.now()}@cybertemp.xyz`; // created on first read
const res = await fetch(
`https://api.cybertemp.xyz/getMail?email=${email}`,
{ headers: { "X-API-KEY": process.env.CYBERTEMP_API_KEY! } },
);
const emails = await res.json(); // [{ id, from, subject, text, html, date }]套餐限制会返回清晰的错误
API 端点
GET/getMail
一站式邮件 API!这个单一端点可以满足您的所有需求:
getEmails 如何工作:
- 如果收件箱不存在,则自动创建。
- 检索该地址的所有电子邮件。
- 返回完整内容(HTML、文本、主题等)。
- 请使用 CyberTemp 域名或您已验证的自定义域名。其他域名永远收不到邮件,但仍会占用收件箱名额。查看列表:
- 支持大型收件箱的分页功能。
认证:
- API 密钥: 必填。添加此请求头:
X-API-KEY
参数 (查询字符串):
示例请求:
GET /[email protected]&limit=50&offset=100
X-API-KEY: your_api_key_here示例响应:
[
{
"id": "email:xyz",
"from": "[email protected]",
"to": "[email protected]",
"subject": "Test Email",
"text": "Email content",
"html": "<p>Email content</p>",
"date": "2024-01-01T00:00:00.000Z"
}
]