Skip to content

Send OTP

POST /v1/verify/send

Generate and deliver a one-time password to a user's phone or email.

Request Body

ParameterTypeRequiredDescription
tostringYesRecipient phone (E.164) or email address.
channelstringNoDelivery channel: sms, whatsapp, or email (default: sms).
code_lengthintegerNoNumber of digits in the OTP code (default: 6, range: 4–8).
ttl_secondsintegerNoTime-to-live in seconds (default: 300, range: 60–600).
bash
curl -X POST https://sendapi.co/v1/verify/send \
  -H "Authorization: Bearer sk_live_123456789" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+447700900000",
    "channel": "sms",
    "code_length": 6,
    "ttl_seconds": 300
  }'
javascript
const verification = await client.verify.send({
  to: '+447700900000',
  channel: 'sms'
});

// Store the recipient ("to") to pass to verify.check later
python
verification = client.verify.send(
    to="+447700900000",
    channel="sms"
)
php
$verification = $client->verify->send([
    'to' => '+447700900000',
    'channel' => 'sms',
]);

Response

json
{
  "success": true,
  "data": {
    "id": 17,
    "channel": "sms",
    "status": "sent",
    "code_length": 6,
    "expires_at": "2026-03-09T14:35:00.000000Z",
    "delivery": {
      "provider": "telnyx",
      "external_id": "40319d98-8ece-401e-9add-94b696939751"
    }
  }
}

The OTP is delivered to the user. To verify the code, call POST /v1/verify/check with the same to value (the recipient phone/email).

Delivered Message

The OTP message is fixed — it cannot be customized per request. Users receive:

Your SendAPI verification code is: 847291

This code expires in 5 minutes. Do not share it with anyone.

Released under the MIT License.