0 Tk

Verify API

User Authentication with Twilio Verify

Twilio Verify API provides a simple way to add user authentication to your applications using SMS, voice, or email one-time passcodes (OTP).

Start Verification

Endpoint: POST /v2/Services/{ServiceSid}/Verifications

Required Parameters:

  • To: The phone number or email to verify
  • Channel: The verification method (sms, call, or email)

Example request:

curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications \
--data-urlencode "To=+1XXXXXXXXXX" \
--data-urlencode "Channel=sms" \
-u YOUR_ACCOUNT_SID:YOUR_AUTH_TOKEN

Example response:

{
  "sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "to": "+1XXXXXXXXXX",
  "channel": "sms",
  "status": "pending",
  "valid": false,
  "lookup": {
    "carrier": {
      "mobile_country_code": "310",
      "type": "mobile",
      "error_code": null,
      "mobile_network_code": "456",
      "name": "verizon"
    }
  },
  "amount": null,
  "payee": null,
  "date_created": "2020-07-30T20:12:31Z",
  "date_updated": "2020-07-30T20:12:31Z",
  "url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications/VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}