TUNGKAO API docs
Press the button and choose “Save as PDF” as the destination

TUNGKAO API

Email sending + OTP + SMTP

API v1 · Last updated: Thailand time (UTC+07:00)

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

You must show a visible “Powered by TUNGKAO” (or “Secured by TUNGKAO” for login/payments) credit linking to https://tungkao.com on pages that use the service, as required by the terms

📧
API · email

Email sending + OTP + SMTP

Send email from your site through the API or SMTP (WordPress works), plus email OTP codes with verification — we fail over between email providers automatically.

🕒 Last updated: Thailand time (UTC+07:00) · ✅ Your existing code keeps working

🤖 Let an AI write the integration

Copy this link for an AI to read (the whole API as Markdown), or press a button: the prompt is copied and the AI opens — paste it and tell it your language/framework

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

This link returns this API's updates as JSON (no key, any origin). Have your admin page show it as an “Update announcements” box and flag “New” when last_updated changes

Copy + open in: pressing an AI button copies the prompt automatically — if the chat box is empty, just paste

🔑 Key to use

Create a email key in the merchant portal (API keys) and send this header with every request — keys of other services won't work here

Authorization: Bearer $TUNGKAO_KEY

📋 How it works

  1. Create an email key (test keys can only send to your own address, 50 per day).
  2. SMTP: host smtp.tungkao.com, port 587 (STARTTLS) or 465 (SSL), any username, password = your API key.
  3. API: send an email, or request an OTP and verify it with the returned otp_id (5 attempts, single use).

📡 API calls + code examples

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

📚 Usage examples

Example 1

Order confirmation email

Situation: A customer completes an order

Request
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

Example 2

Send an email OTP

Situation: A new sign-up must confirm their email

Request
POST /v1/email/otp/send
{
  "to": "[email protected]",
  "brand": "My Shop",
  "lang": "th",
  "length": 6,
  "ttl_seconds": 300
}
Sample response
{
  "success": true,
  "data": {
    "otp_id": "8f6c2a1e-…"
  }
}

➡️ Keep otp_id; the code expires in 5 minutes

Example 3

Check the OTP

Situation: The user types the 6-digit code

Request
POST /v1/email/otp/verify
{
  "otp_id": "8f6c2a1e-…",
  "code": "123456"
}

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

Example 4

Send to several people

Situation: Tell three staff about a large order

Request
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

Example 5

Review sent emails

Situation: A customer says the email never arrived

Request
GET /v1/email/messages

➡️ Check the delivery status of each email

💡 More

📜 Update history of this API

  1. Added Thailand time (UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  2. Added Thailand time (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. Added Thailand time (UTC+07:00)
    GET /status: per-service API status 🟢 normal / 🟠 high traffic / 🔴 minor delays (no key needed)
  4. New Thailand time (UTC+07:00)
    Email service launched: API + SMTP (smtp.tungkao.com) + email OTP
  5. Added Thailand time (UTC+07:00)
    Key on/off switch with status-change time + one key per service per website
  6. Improved Thailand time (UTC+07:00)
    API v1 frozen (additive only) + X-Tungkao-Api-Version header + 12-month deprecation notices
  7. Docs Thailand time (UTC+07:00)
    Per-API docs pages with AI links (ChatGPT / Claude / Gemini / Grok) in 10 languages
  8. Security Thailand time (UTC+07:00)
    Domain verification per API key (1 key = 1 site) — existing keys keep working
  9. Added Thailand time (UTC+07:00)
    Optional HMAC request signing — nothing changes unless you turn it on
  10. Added Thailand time (UTC+07:00)
    API key lifetimes, expiry warnings and renewal — the key string never changes
  11. Added Thailand time (UTC+07:00)
    Test-mode keys (simulated, free) for every service

✅ Your existing code keeps working

🛡️ Stability promise: integrate once, keep working

🚦 System status (GET /status)

Check any time whether the API is healthy — no key needed

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 attribution requirement

Powered by TUNGKAO