API 文档

完整的 REST API,用于以编程方式访问 TmpMail 服务。非常适合测试、自动化和 CI/CD 流水线。

快速开始

# Create a new inbox
curl -X POST https://get-a-temp-email.xyz/api/inbox

# Get emails (use the token from above)
curl https://get-a-temp-email.xyz/api/inbox/{token}/emails

基础 URL

https://get-a-temp-email.xyz

所有 API 端点都通过 HTTPS 提供。HTTP 请求将被重定向。

认证

TmpMail API 使用基于令牌的认证。创建邮箱时,你会收到一个唯一的令牌。此令牌用于访问你的邮箱和邮件。请保管好你的令牌 - 任何拥有令牌的人都可以访问你的邮件。

创建邮箱

创建一个新的临时邮箱。返回唯一的令牌和邮箱地址。

POST/api/inbox
// Request Body (optional)
{
  "domain": "get-a-temp-email.xyz"
}

// Response
{
  "success": true,
  "data": {
    "token": "aBcDeFgHiJkLmNoPqRsTuVwXyZ123456",
    "email": "[email protected]",
    "createdAt": "2024-12-01T00:00:00.000Z",
    "expiresAt": "2024-12-02T00:00:00.000Z"
  }
}

获取邮箱信息

使用令牌获取现有邮箱的信息。

GET/api/inbox/:token

获取邮件

获取邮箱中的所有邮件。包含智能提取的验证码和链接。

GET/api/inbox/:token/emails
// Response
{
  "success": true,
  "data": [
    {
      "id": "email_abc123",
      "from": "[email protected]",
      "subject": "Your verification code",
      "extracted": {
        "codes": ["123456"],
        "links": ["https://github.com/verify/abc"]
      }
    }
  ]
}

获取可用域名

获取创建邮箱时可使用的邮箱域名列表。

GET/api/domains

速率限制

为确保公平使用,API 有以下速率限制:

EndpointLimit
POST /api/inbox10 requests/minute per IP
GET /api/inbox/:token/emails60 requests/minute per token
Other endpoints100 requests/minute per IP

智能代码提取

TmpMail 自动从邮件中提取验证码和重要链接。我们支持以下热门服务的模板:

GitHubGoogleTwitter/XFacebookMicrosoftAppleDiscordSlackNotionLinkedInNetflixStripeVercelZoomPayPalAmazonDropboxSpotifyUberOpenAI

没看到你的服务?我们的通用代码检测适用于大多数验证邮件。

Premium Features

TmpMail offers premium features for power users. Connect your TON wallet to access fixed mailboxes with extended retention and webhook notifications.

Custom Email

Create permanent mailboxes with your chosen address (e.g., [email protected])

7-Day Retention

Emails are kept for 7 days instead of 24 hours for free inboxes

Webhook Notifications

Get instant notifications via Telegram or custom webhooks

Premium API Authentication

Premium API endpoints require wallet authentication. First authenticate with your TON wallet to obtain a session token, then include it in the Authorization header.

// All premium endpoints require this header
Authorization: Bearer {sessionToken}

Get Mailboxes

Retrieve all fixed mailboxes associated with your wallet account.

GET/api/mailboxes
// Response
{
  "success": true,
  "data": [
    {
      "email": "[email protected]",
      "type": "paid",
      "status": "active",
      "retentionDays": 7,
      "emailCount": 5,
      "accessToken": "abc123...",
      "notify": {
        "enabled": true,
        "platform": "telegram",
        "target": "123456789"
      },
      "createdAt": "2025-01-01T00:00:00.000Z"
    }
  ]
}

Create Fixed Mailbox

Create a new fixed mailbox with your custom email address. Requires an available mailbox slot.

POST/api/mailbox
// Request Body
{
  "address": "yourname",
  "domain": "get-a-temp-email.xyz",
  "retentionDays": 7
}

// Response
{
  "success": true,
  "data": {
    "email": "[email protected]",
    "type": "paid",
    "status": "active",
    "retentionDays": 7,
    "accessToken": "abc123..."
  }
}

Update Mailbox Settings

Update retention days and notification settings for a fixed mailbox.

PATCH/api/mailbox/:email
// Request Body
{
  "retentionDays": 7,
  "notify": {
    "enabled": true,
    "platform": "telegram",  // or "webhook"
    "target": "123456789"    // chat_id or webhook URL
  }
}

// Response
{
  "success": true,
  "data": { ... }  // Updated mailbox object
}

Delete Mailbox

Delete a fixed mailbox. This action is irreversible and frees up a mailbox slot.

DELETE/api/mailbox/:email
// Response
{
  "success": true
}

Test Notification

Send a test notification to verify your webhook or Telegram configuration.

POST/api/mailbox/:email/notify/test
// Response
{
  "success": true
}

准备好集成了吗?

立即在你的项目中使用 TmpMail API。无需 API 密钥。