Skip to content

ส่ง OTP ซ้ำ POST ​

ใช้ส่ง SMS OTP ใหม่สำหรับ otpId เดิม (เช่น ผู้ใช้ไม่ได้รับ SMS) ระบบสร้าง รหัสใหม่ แทนรหัสเดิม แต่ใช้ otpId และ referenceCode เดิม

Authorization ​

ใช้ API Key (การยืนยันตัวตน) ส่งใน header Authorization: Bearer <API_KEY> — ส่งซ้ำได้เฉพาะ OTP ของบัญชีตัวเอง

endpoint นี้ ไม่รองรับ Idempotency-Key (ถ้าส่งมาจะถูกเพิกเฉย) — การเรียกซ้ำแต่ละครั้งส่ง SMS ใหม่และนับเป็นการส่งซ้ำ 1 ครั้ง

HTTP Request ​

http
POST https://public-api.smsup-plus.com/OTP/resendotp

Content Type ​

application/json (รับเฉพาะ JSON)

Parameter Description ​

PropertyTypeRequiredDescription
otpidstringRequiredotpId จาก ขอ OTP
vpstringOptionalรับค่าไว้เพื่อความเข้ากันได้กับระบบเดิม ปัจจุบันไม่มีผล

พฤติกรรม ​

เรื่องค่า
รหัส OTPสร้างใหม่ทุกครั้ง รหัสเดิมใช้ไม่ได้อีก
referenceCodeคงเดิม
อายุ OTPไม่ต่ออายุ — ยังหมดอายุตามเวลาเดิมที่นับจาก ขอ OTP
จำนวนครั้งที่กรอกผิดไม่รีเซ็ต
จำนวนครั้งที่ส่งซ้ำได้สูงสุด 3 ครั้งต่อ otpId
ระยะห่างระหว่างการส่งซ้ำระบบไม่บังคับ — แนะนำให้แอปของคุณกำหนดเวลารอ (เช่น ปุ่ม "ส่งอีกครั้ง" กดได้หลัง 30–60 วินาที)
เครดิตตรวจเหมือน ขอ OTP (prepaid ต้องมีอย่างน้อย 1) และคิดเครดิตตามความยาวข้อความทุกครั้งที่ส่ง

Response Description ​

ตอบ HTTP 200 ทั้งกรณีสำเร็จและกรณีส่งซ้ำไม่ได้ — ให้ตรวจว่ามี success หรือ error

PropertyTypeDescription
otcIdstringรหัส OTP config ของ OTP นี้
otpIdstringotpid เดิม
referenceCodestringReference code เดิม
success.codestring"200"
success.messagestringSUCCESS
success.descriptionstringOTP has been resent successfully

ตัวอย่าง Request ​

bash
curl -X POST 'https://public-api.smsup-plus.com/OTP/resendotp' \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "otpid": "7f3c9a1e-2b4d-4c6e-8a0f-1e3d5b7c9a2f"
  }'
js
const res = await fetch('https://public-api.smsup-plus.com/OTP/resendotp', {
  method: 'POST',
  headers: { Authorization: 'Bearer <API_KEY>', 'Content-Type': 'application/json' },
  body: JSON.stringify({ otpid: '7f3c9a1e-2b4d-4c6e-8a0f-1e3d5b7c9a2f' }),
})
console.log(await res.json())

ตัวอย่าง Response ​

json
{
  "otcId": "c2a4e6f8-1b3d-4f5a-9c7e-0d2b4f6a8c1e",
  "otpId": "7f3c9a1e-2b4d-4c6e-8a0f-1e3d5b7c9a2f",
  "referenceCode": "KQZPWD",
  "success": {
    "code": "200",
    "message": "SUCCESS",
    "description": "OTP has been resent successfully"
  }
}

Error ที่อาจเจอ ​

ดูภาพรวมที่ รหัสข้อผิดพลาด

HTTPResponseสาเหตุ
200{"error":{"code":"400","message":"RESEND_FAILED","description":"Failed to resend OTP"}}OTP หมดอายุ / ไม่พบ otpid / ส่งซ้ำครบ 3 ครั้งแล้ว หรือระบบขัดข้องชั่วคราว — ให้ ขอ OTP ใหม่
400{"error":{"code":"400","message":"BAD_REQUEST","description":"Invalid request body"}}body ไม่ใช่ JSON ที่ถูกต้อง หรือไม่มี otpid
402{"error":{"code":"402","message":"INSUFFICIENT_CREDIT","description":"insufficient credit: required 1.00, available 0.00"}}บัญชี prepaid มีเครดิตไม่ถึง 1
403{"error":{"code":"403","message":"ACCOUNT_INACTIVE","description":"account is inactive"}}บัญชีถูกปิดใช้งาน
403{"error":{"code":"403","message":"ACCOUNT_HELD","description":"account is on credit hold"}}บัญชีถูกระงับเครดิต
403{"error":{"code":"403","message":"SERVICE_NOT_ALLOWED","description":"OTP is not enabled for this account"}}บัญชียังไม่เปิดสิทธิ์ใช้ OTP
404{"error":{"code":"404","message":"OTP_NOT_FOUND","description":"OTP not found for this account"}}otpid เป็นของบัญชีอื่น
429{"error":{"statusCode":"429","description":"rate limit exceeded: max 50 requests per second per account","message":"TOO_MANY_REQUESTS"}}เรียกถี่เกินกำหนด — รอตาม header Retry-After
500{"error":{"code":"500","message":"INTERNAL_SERVER_ERROR","description":"Failed to validate OTP request"}}ระบบตรวจสอบคำขอไม่สำเร็จชั่วคราว