Skip to main content

Send Verification Code

Send an OTP verification code to a phone number.

POST /api/v2/verify

Authentication

Authorization: Bearer sl_live_your_key_here

Request body

ParameterTypeRequiredDescription
phone_numberstringYesRecipient phone number in E.164 format (e.g. +8801XXXXXXXXX).
channelstringNo"sms" (default) or "whatsapp".
code_lengthnumberNoNumber of digits in the OTP code. Range: 4-10. Default: 6.
expirynumberNoSeconds until the code expires. Range: 60-3600. Default: 300.
localestringNoMessage language: "en-us" (default) or "bn-bd" (Bengali).
brand_idstringNoSender brand ID. Auto-resolved if omitted.

Example request

SMS

curl -X POST "https://api.sendlime.com/api/v2/verify" \
-H "Authorization: Bearer sl_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+8801XXXXXXXXX",
"channel": "sms",
"code_length": 6,
"expiry": 300
}'

WhatsApp

curl -X POST "https://api.sendlime.com/api/v2/verify" \
-H "Authorization: Bearer sl_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+8801XXXXXXXXX",
"channel": "whatsapp"
}'

Bengali message

curl -X POST "https://api.sendlime.com/api/v2/verify" \
-H "Authorization: Bearer sl_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+8801XXXXXXXXX",
"locale": "bn-bd"
}'

Success response

Status: 200 OK

{
"success": true,
"data": {
"request_id": "vrf_abc123def456",
"to": "+8801XXXXXXXXX",
"channel": "sms",
"status": "pending",
"expires_in": 300
}
}

Response fields

FieldTypeDescription
request_idstringUnique verification request ID. Use this to check the code.
tostringRecipient phone number.
channelstring"sms" or "whatsapp".
statusstringAlways "pending" on success.
expires_innumberSeconds until the code expires.

Error responses

400 Bad Request

{ "error": "Validation failed", "details": { "phone_number": ["Required"] } }

401 Unauthorized

{ "error": "Invalid or revoked API key" }

402 Payment Required

{ "error": "Insufficient balance", "required": 0.5, "available": 0 }

429 Too Many Requests

{ "error": "Rate limit exceeded. Max 10 requests per minute per number.", "retry_after": 42 }
{ "error": "Too many pending verifications for this number. Max 5 pending." }

500 Internal Server Error

{ "error": "Failed to send verification code" }

Rate limits

  • 10 requests per minute per phone number per organization.
  • 5 maximum pending verifications per phone number per organization.

Pricing

  • SMS verification: standard SMS rate (currently 0.5 BDT).
  • WhatsApp verification: free (0 credits).
  • Balance is charged on send and refunded automatically if delivery fails.