Send and check
- 01
Send a code
Taysend generates the code and texts it. The code is never stored in plaintext. Add sender_id to send it from your own approved sender ID; without it the code comes from TAYSEND.
curl -X POST "https://api.taysend.com/v1/verify/send" \ -H "Authorization: Bearer $TAYSEND_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+233200000001" }'Responsepending{ "id": "ver_01hx...", "status": "pending", "expires_at": "2026-11-18T10:10:00.000Z" }Keep id. It is the verification_id for the check call. The code expires after 10 minutes. - 02
Check the code
Send the verification_id from step 01 with the code the person typed. The phone number is not part of this call.
curl -X POST "https://api.taysend.com/v1/verify/check" \ -H "Authorization: Bearer $TAYSEND_KEY" \ -H "Content-Type: application/json" \ -d '{ "verification_id": "ver_01hx...", "code": "123456" }'Responseverified{ "valid": true, "status": "verified" }Only a correct code gets this answer. A wrong, expired, or over-tried code is an error, listed below.
Error codes
Error codes include OTP_EXPIRED, OTP_INVALID, OTP_MAX_ATTEMPTS, OTP_COOLDOWN.
CodeHTTPCallWhen
OTP_EXPIREDHTTP 400 · checkcheckThe code is more than 10 minutes old.
OTP_INVALIDHTTP 400 · checkcheckThe code does not match. Every check counts as an attempt.
OTP_MAX_ATTEMPTSHTTP 400 · checkcheckFive checks were already made on this verification.
OTP_COOLDOWNHTTP 429 · sendsendA code went to this number in the last 30 seconds, or five in the last hour.
SENDER_NOT_APPROVEDHTTP 400 · sendsendLIVE key only. The sender_id you passed (or TAYSEND, when you pass none) is not approved for your account.
Wrong code400
{
"error": {
"code": "OTP_INVALID",
"message": "Invalid code",
"request_id": "req_01hx..."
}
}