OTP One-shot

Gửi email(+pass) + rule_key → server tự chờ và trả OTP trong 1 lần gọi.
1 request timeout email+password

1. Khi nào dùng

  • Tool muốn đơn giản: gọi 1 phát ra OTP.
  • Không muốn tự loop poll ở phía client.
Multi-app: Refresh token có thể thuộc app khác (B/C/D) miễn mailbox lưu đúng tenant + client_id (và client_secret nếu là confidential client).
Lưu ý: One-shot giữ kết nối HTTP mở tới khi có OTP hoặc timeout.

2. Mapping email → mailbox_id (tuỳ chọn)

POST/system/api_otp_by_mail.php
TênKiểuMô tả
email requiredstringEmail cần map trong hệ thống.
passwordstringMật khẩu email (nếu hệ thống có check).
rule_keystringGợi ý rule để log (optional).
POST https://minisoftwares.net/system/api_otp_by_mail.php
Header: X-API-KEY: YOUR_API_KEY
Body:
{
  "email": "testmail01@outlook.com",
  "password": "123456",
  "rule_key": "tiktok"
}

Response mẫu

{
  "ok": true,
  "mailbox_id": 12,
  "email": "testmail01@outlook.com",
  "message": "Use mailbox_id with api_otp_request.php + api_otp_poll.php"
}

3. One-shot OTP

POST/system/api_otp_by_mail_oneshot.php
TênKiểuMô tả
email requiredstringEmail cần lấy OTP.
passwordstringMật khẩu email (nếu hệ thống có check).
rule_key requiredstringRule lọc OTP (vd tiktok, facebook...).
timeout_secondsintThời gian chờ tối đa (vd 60).
poll_intervalintMỗi N giây server kiểm tra (vd 3).
outputstringChọn dữ liệu trả về: otp (mặc định), full, both.
POST https://minisoftwares.net/system/api_otp_by_mail_oneshot.php
Header: X-API-KEY: YOUR_API_KEY
Body:
{
  "email": "testmail01@outlook.com",
  "password": "123456",
  "rule_key": "tiktok",
  "timeout_seconds": 60,
  "poll_interval": 3,
  "output": "both"
}

Response thành công

{
  "ok": true,
  "mode": "oneshot",
  "status": "done",
  "otp": "482931",
  "message_id": "AAMk...==",
  "request_id": "AAMk...==",
  "received_at": "2025-12-30T05:20:00Z",
  "from": "TikTok <no-reply@tiktok.com>",
  "subject": "Verification code",
  "mailbox_id": 12,
  "rule_key": "tiktok",
  "output": "both",
  "elapsed": 17.234,
  "full_text": "Your TikTok verification code is 482931"
}

4. Response timeout

{
  "ok": false,
  "mode": "oneshot",
  "status": "timeout",
  "error": "timeout_waiting_otp",
  "timeout_sec": 60
}
Copyright © 2026 Minisoftwares.Net. Design with
by Nguyen Van Sinh All rights reserved.