Reference Temporary Mail API

Reference

API Documentation

Public gateway endpoints for mailbox generation, polling, cleanup, and stats.

Use the API to generate temporary inboxes, poll messages, read a specific mail, and clean up after verification flows.

Use cases and basics

Base URL http://tz.beiyuka.com
Auth All endpoints use Authorization: Bearer <api-key>.
Provider Pass provider when you need deterministic routing across multiple upstream providers.

GET /api/generate-email

Generate mailbox
curl http://tz.beiyuka.com/api/generate-email \
  -H 'Authorization: Bearer <api-key>'
Response example
{
  "success": true,
  "data": {
    "email": "demo123@mailto.plus"
  },
  "error": ""
}

POST /api/generate-email

FieldTypeRequiredDescription
prefixstringNoMailbox prefix.
domainstringNoRequested domain.
providerstringNoExplicit provider name.
Generate mailbox with payload
curl -X POST http://tz.beiyuka.com/api/generate-email \
  -H 'Authorization: Bearer <api-key>' \
  -H 'Content-Type: application/json' \
  -d '{"provider":"legacy"}'
Response example
{
  "success": true,
  "data": {
    "email": "otp-bot@mailto.plus"
  },
  "error": ""
}

GET /api/emails

List mailbox
curl 'http://tz.beiyuka.com/api/emails?email=user@example.com' \
  -H 'Authorization: Bearer <api-key>'
Response example
{
  "success": true,
  "data": {
    "emails": [
      {
        "id": "MAIL_ID",
        "email_address": "user@example.com",
        "from_address": "no-reply@example.com",
        "subject": "Your code",
        "content": "Code: 123456",
        "html_content": "<p>Code: <strong>123456</strong></p>"
      }
    ],
    "count": 1
  },
  "error": ""
}

Fields

FieldTypeDescription
idstringMail identifier.
email_addressstringMailbox address.
from_addressstringSender address.
subjectstringSubject line.
contentstringPlain-text body.
html_contentstringRendered HTML body.

GET /api/email/:id

Providing email improves lookup reliability.

Get one mail
curl 'http://tz.beiyuka.com/api/email/MAIL_ID?email=user@example.com' \
  -H 'Authorization: Bearer <api-key>'
Response example
{
  "success": true,
  "data": {
    "id": "MAIL_ID",
    "email_address": "user@example.com",
    "from_address": "no-reply@example.com",
    "subject": "Your code",
    "content": "Code: 123456",
    "html_content": "<p>Code: <strong>123456</strong></p>"
  },
  "error": ""
}

DELETE /api/email/:id

Delete one mail
curl -X DELETE 'http://tz.beiyuka.com/api/email/MAIL_ID?email=user@example.com' \
  -H 'Authorization: Bearer <api-key>'
Response example
{
  "success": true,
  "data": {
    "message": "Deleted email."
  },
  "error": ""
}

DELETE /api/emails/clear

Clear mailbox
curl -X DELETE 'http://tz.beiyuka.com/api/emails/clear?email=user@example.com' \
  -H 'Authorization: Bearer <api-key>'
Response example
{
  "success": true,
  "data": {
    "message": "Cleared emails.",
    "count": 1
  },
  "error": ""
}

GET /api/stats

Read stats
curl http://tz.beiyuka.com/api/stats \
  -H 'Authorization: Bearer <api-key>'
Stats envelope
{
  "success": true,
  "data": {
    "proxy": {
      "totalUpstreamCalls": 1234,
      "todayUpstreamCalls": 56,
      "activeApiKeys": 3
    },
    "providers": [
  {
    "name": "linshiyouxiang",
    "isDefault": false
  },
  {
    "name": "mailgw",
    "isDefault": false
  },
  {
    "name": "mailtm",
    "isDefault": true
  }
]
  },
  "error": ""
}

Stats Fields

FieldTypeDescription
proxy.totalUpstreamCallsnumberTotal upstream calls recorded by the gateway.
proxy.todayUpstreamCallsnumberToday's upstream calls in UTC.
proxy.activeApiKeysnumberCurrently active API key count.
providersarrayList of configured and enabled providers.

Examples

JavaScript
fetch("http://tz.beiyuka.com/api/generate-email", {
  headers: { Authorization: "Bearer <api-key>" }
}).then((response) => response.json())
Python
import requests

resp = requests.get(
    "http://tz.beiyuka.com/api/emails",
    params={"email": "user@example.com"},
    headers={"Authorization": "Bearer <api-key>"},
    timeout=30,
)
print(resp.json())

Practical Tips

  1. Poll every 2-5 seconds for OTP workflows.
  2. List the mailbox first to build the mail-id mapping.
  3. Prefer html_content when rendered email fidelity matters.
  4. Pass email explicitly for detail and delete operations.