跳到主要内容

Signing up for Discord? Some of our domains are accepted there. See which ones on the Domains page.

CyberTemp

API 文档

基础 URL:https://api.cybertemp.xyz每个账户都有免费 API 密钥。付费套餐会提高请求速率和可保留的收件箱数量。

邮件检索
临时收件箱
多域名
订阅计划

如何使用我们的 API(很简单!)

创建免费 API 密钥,并在每个请求中带上它。套餐只影响两项限制:每秒请求数,以及可同时保留的收件箱数量。

公共 API:访问通用邮件数据

像 getMail 或 getDomains 等端点在所有套餐下用法相同:

  • 免费版: 免费 API 密钥,每秒 10 次请求,最多同时保留 5 个收件箱。
  • 付费套餐: 在 您的 API 密钥 使用 X-API-KEY 标头,与免费版完全相同。您将获得更多每秒请求数 和更多可同时保留的收件箱,具体取决于您的套餐。
X-API-KEY: tk_your_api_key_here
所有套餐通用一个密钥
升级不需要修改代码:同一个密钥会直接获得更高的限制。

如何获取 API 密钥

每个账户都可以免费获取 API 密钥,免费版也一样。大约只需一分钟:

1

创建免费账户(或登录)

用邮箱几秒钟即可注册;如果已有账户,直接登录即可。

2

访问设置

单击右上角的个人资料头像,然后从下拉菜单中选择“设置”。

3

生成 API 密钥

向下滚动到“API 密钥”部分,然后单击“生成新密钥”按钮。复制并安全地存储您的 API 密钥。

API 访问:超简单指南
公共 API(通用邮件,域名):使用 X-API-KEY 发送每个请求。套餐决定每秒请求数以及可保留的收件箱数量。
需要密钥?API 密钥 对所有账户免费,可在设置中管理。

需要更高的每秒请求数或更多收件箱?比较套餐:

查看订阅套餐

API 速率限制和功能

免费层级有限制,订阅解锁更高性能

每个请求都需要 API 密钥。套餐设定两项限制:每秒请求数和可同时保留的收件箱数量。超出时会返回明确的 429 或 402 错误。

记住:免费层级始终可用!
免费版永不过期。只有在需要更高的每秒请求数、更多同时保留的收件箱、验证码提取(Core)或 Webhook(Elite)时才需要升级。

代码示例

不同语言的实现示例
当前示例:GET/getMail· 获取邮件内容选择其他端点
// 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

当邮件到达您的任何收件箱时,在您的端点接收 HMAC-SHA256 签名的 POST。
仅限 Elite + Team
Webhook 属于 Elite 套餐(€4.99/月)。Team 所有者和成员同样可用。 查看订阅套餐

事件类型

  • message.received新邮件到达您的某个收件箱。
  • test_ping从仪表板的「测试」按钮触发 — 在真实邮件到达之前验证您的端点很有用。

请求标头

X-Cybertemp-Signature: sha256=<hmac_hex>
X-Cybertemp-Event: message.received
X-Cybertemp-Delivery: <unique_id>
Content-Type: application/json
User-Agent: Cybertemp-Webhook/1.0

负载结构

{
  "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

客户端库

基于同一 REST API 发布的封装库。每个都是轻量客户端:它们能做的,普通 HTTP 请求同样能做。
Python
PyPI
安装
pip install cybertemp
使用
import 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-go
使用
import 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/full
使用
use 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 / TypeScript
安装

无需安装包: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 }]
套餐限制会返回清晰的错误
触达限制时会返回 HTTP 402(并发收件箱上限)或 429(速率限制)以及 JSON 错误正文,让您的 CI 日志显示具体触达了哪项限制,而不是笼统的失败。

API 端点

GET/getMail

所有套餐(需 API 密钥)

一站式邮件 API!这个单一端点可以满足您的所有需求:

getEmails 如何工作:

  • 如果收件箱不存在,则自动创建。
  • 检索该地址的所有电子邮件。
  • 返回完整内容(HTML、文本、主题等)。
  • 请使用 CyberTemp 域名或您已验证的自定义域名。其他域名永远收不到邮件,但仍会占用收件箱名额。查看列表:
  • 支持大型收件箱的分页功能。

认证:

参数 (查询字符串):

email
必填

目标邮箱地址 (例如 [email protected])。如果是新的会自动创建。

limit
可选

返回的邮件数量 (默认 25,最大 100)。

offset
可选

分页偏移量 (默认 0)。

示例请求:

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"
  }
]