TUNGKAO API ドキュメント
ボタンを押して送信先で「PDF に保存」を選んでください

TUNGKAO API

メール送信 + OTP + SMTP

API v1 · 最終更新: タイ時間(UTC+07:00)

https://tungkao.com · https://api.tungkao.com/docs

利用規約により、サービスを使うページに https://tungkao.com へのリンク付きで “Powered by TUNGKAO”(ログイン/決済は “Secured by TUNGKAO”)を表示する必要があります

📧
API · email

メール送信 + OTP + SMTP

API または SMTP でサイトからメールを送信(WordPress 対応)し、メール OTP の送信と検証も — 複数のメール配信会社を自動で切り替えます。

🕒 最終更新: タイ時間(UTC+07:00) · ✅ 既存のコードはそのまま動作

🤖 AI に連携コードを書かせる

このリンクを AI に渡すか(API 全体の Markdown)、ボタンを押すとプロンプトがコピーされ AI が開きます

https://api.tungkao.com/docs/api/email.md?lang=ja
https://api.tungkao.com/changelog/email.json

このリンクはこの API の更新を JSON で返します(key 不要・どのドメインからも可)。管理画面に「更新のお知らせ」として表示し、last_updated が変わったら「新着」を付けてください

ChatGPT ↗Claude ↗Gemini ↗Grok ↗

コピーして開く: AI ボタンでプロンプトが自動コピーされます。入力欄が空なら貼り付けてください

🔑 使うキー

加盟店ポータル(API key)で email キーを作成し、すべてのリクエストにこの header を送ります — 他サービスのキーはここでは使えません

Authorization: Bearer $TUNGKAO_KEY

📋 手順

  1. メールキーを作成(テストキーは自分のアドレス宛てのみ、1 日 50 通)。
  2. SMTP:ホスト smtp.tungkao.com、ポート 587(STARTTLS)または 465(SSL)、ユーザー名は任意、パスワード = API キー。
  3. API:メールを送信、または OTP を要求し、返された otp_id で検証(5 回まで・1 回限り)。

📡 API 呼び出し + コード例

POST/v1/email/send
curl -X POST https://api.tungkao.com/v1/email/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":["[email protected]"],"subject":"Order #1001 confirmed","html":"<h1>Thanks for your order</h1>","text":"Thanks for your order","from_name":"My Shop","reply_to":"[email protected]"}'
POST/v1/email/otp/send
curl -X POST https://api.tungkao.com/v1/email/otp/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"[email protected]","brand":"My Shop","lang":"th","length":6,"ttl_seconds":300}'
POST/v1/email/otp/verify
curl -X POST https://api.tungkao.com/v1/email/otp/verify \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"otp_id":"8f6c2a1e-…","code":"123456"}'

📚 使い方の例

例 1

Order confirmation email

状況: A customer completes an order

リクエスト
POST /v1/email/send
{
  "to": [
    "[email protected]"
  ],
  "subject": "Order #1001 confirmed",
  "html": "<h1>Thanks for your order</h1>",
  "text": "Thanks for your order",
  "from_name": "My Shop",
  "reply_to": "[email protected]"
}

➡️ Always send html and text; replies go to reply_to

例 2

Send an email OTP

状況: A new sign-up must confirm their email

リクエスト
POST /v1/email/otp/send
{
  "to": "[email protected]",
  "brand": "My Shop",
  "lang": "th",
  "length": 6,
  "ttl_seconds": 300
}
レスポンス例
{
  "success": true,
  "data": {
    "otp_id": "8f6c2a1e-…"
  }
}

➡️ Keep otp_id; the code expires in 5 minutes

例 3

Check the OTP

状況: The user types the 6-digit code

リクエスト
POST /v1/email/otp/verify
{
  "otp_id": "8f6c2a1e-…",
  "code": "123456"
}

➡️ Correct = email confirmed · too many wrong tries = code locked, send a new one

例 4

Send to several people

状況: Tell three staff about a large order

リクエスト
POST /v1/email/send
{
  "to": [
    "[email protected]",
    "[email protected]",
    "[email protected]"
  ],
  "subject": "Large order #1002",
  "text": "Order #1002: 25,000 THB"
}

➡️ Everyone listed receives the email

例 5

Review sent emails

状況: A customer says the email never arrived

リクエスト
GET /v1/email/messages

➡️ Check the delivery status of each email

💡 その他

📜 この API の更新履歴

  1. 追加 タイ時間(UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  2. 追加 タイ時間(UTC+07:00)
    error.user_message: ready-to-show text for end users on outages, no credits or key problems (white-label keys omit tungkao.com)
  3. 追加 タイ時間(UTC+07:00)
    GET /status:サービス別の API ステータス(キー不要)
  4. 新規 タイ時間(UTC+07:00)
    メールサービス開始:API + SMTP + メール OTP
  5. 追加 タイ時間(UTC+07:00)
    キーのオン/オフと状態変更時刻 + 1 サイトにつきサービスごとに 1 キー
  6. 改善 タイ時間(UTC+07:00)
    API v1 を恒久固定(追加のみ)+ X-Tungkao-Api-Version header + 12 か月前の廃止予告
  7. ドキュメント タイ時間(UTC+07:00)
    API ごとのドキュメントと AI リンク(10 言語)
  8. セキュリティ タイ時間(UTC+07:00)
    API キーごとのドメイン認証(1 キー = 1 サイト)— 既存キーはそのまま動作
  9. 追加 タイ時間(UTC+07:00)
    任意の HMAC リクエスト署名 — オンにしなければ変化なし
  10. 追加 タイ時間(UTC+07:00)
    API キーの期限・期限前通知・更新 — キー文字列は変わらない
  11. 追加 タイ時間(UTC+07:00)
    全サービスに test モードキー(模擬・無料)

✅ 既存のコードはそのまま動作

🛡️ 安定性の約束:一度つなげばずっと動く

🚦 システム状況(GET /status)

API が正常かいつでも確認できます(キー不要)

GET https://api.tungkao.com/status

curl https://api.tungkao.com/status
{
  "success": true,
  "data": {
    "status": "ok",
    "services": [
      { "id": "slip_verify", "status": "ok", "routes": ["ok", "ok", "busy"] },
      { "id": "slip_deposit", "status": "ok", "routes": ["ok", "ok", "busy"] },
      { "id": "login", "status": "ok" },
      { "id": "telegram", "status": "ok" },
      { "id": "discord", "status": "ok" },
      { "id": "email", "status": "busy" },
      { "id": "crypto", "status": "ok" },
      { "id": "core", "status": "ok" }
    ],
    "paused": [],
    "updated_at": "2026-11-14T12:00:00.000Z"
  }
}

🏷️ TUNGKAO クレジット表記の要件

Powered by TUNGKAO