Verify API

Phone number verification built for developers

  • Request phone verification

    Reduce fraudulent activity by validating that a user account is associated with a real person who has access to a valid phone number.

    View Docs
    • Node.js
    • C#
    • PHP
    • Ruby
    • Python
    • Java
    • Curl
    // Download the helper library from https://www.twilio.com/docs/node/install
    // Your Account Sid and Auth Token from twilio.com/console
    // DANGER! This is insecure. See http://twil.io/secure
    const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
    const authToken = 'your_auth_token';
    const client = require('twilio')(accountSid, authToken);
    
    client.verify.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
                 .verifications
                 .create({to: '+15017122661', channel: 'sms'})
                 .then(verification => console.log(verification.status));
    // Install the C# / .NET helper library from twilio.com/docs/csharp/install
    
    using System;
    using Twilio;
    using Twilio.Rest.Verify.V2.Service;
    
    
    class Program
    {
        static void Main(string[] args)
        {
            // Find your Account Sid and Token at twilio.com/console
            // DANGER! This is insecure. See http://twil.io/secure
            const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
            const string authToken = "your_auth_token";
    
            TwilioClient.Init(accountSid, authToken);
    
            var verification = VerificationResource.Create(
                to: "+15017122661",
                channel: "sms",
                pathServiceSid: "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );
    
            Console.WriteLine(verification.Status);
        }
    }
    <?php
    
    // Update the path below to your autoload.php,
    // see https://getcomposer.org/doc/01-basic-usage.md
    require_once '/path/to/vendor/autoload.php';
    
    use Twilio\Rest\Client;
    
    // Find your Account Sid and Auth Token at twilio.com/console
    // DANGER! This is insecure. See http://twil.io/secure
    $sid    = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    $token  = "your_auth_token";
    $twilio = new Client($sid, $token);
    
    $verification = $twilio->verify->v2->services("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
                                       ->verifications
                                       ->create("+15017122661", "sms");
    
    print($verification->status);
    # Download the helper library from https://www.twilio.com/docs/ruby/install
    require 'rubygems'
    require 'twilio-ruby'
    
    # Your Account Sid and Auth Token from twilio.com/console
    # DANGER! This is insecure. See http://twil.io/secure
    account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    auth_token = 'your_auth_token'
    @client = Twilio::REST::Client.new(account_sid, auth_token)
    
    verification = @client.verify
                          .services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
                          .verifications
                          .create(to: '+15017122661', channel: 'sms')
    
    puts verification.status
    # Download the helper library from https://www.twilio.com/docs/python/install
    from twilio.rest import Client
    
    
    # Your Account Sid and Auth Token from twilio.com/console
    # DANGER! This is insecure. See http://twil.io/secure
    account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    auth_token = 'your_auth_token'
    client = Client(account_sid, auth_token)
    
    verification = client.verify \
                         .services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
                         .verifications \
                         .create(to='+15017122661', channel='sms')
    
    print(verification.status)
    // Install the Java helper library from twilio.com/docs/java/install
    
    import com.twilio.Twilio;
    import com.twilio.rest.verify.v2.service.Verification;
    
    public class Example {
        // Find your Account Sid and Token at twilio.com/console
        // DANGER! This is insecure. See http://twil.io/secure
        public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        public static final String AUTH_TOKEN = "your_auth_token";
    
        public static void main(String[] args) {
            Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
            Verification verification = Verification.creator(
                    "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                    "+15017122661",
                    "sms")
                .create();
    
            System.out.println(verification.getStatus());
        }
    }
    curl -X POST "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications" \
    --data-urlencode "To=+15017122661" \
    --data-urlencode "Channel=sms" \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
  • Verify the phone verification code

    Reduce fraudulent activity by validating that a user account is associated with a real person who has access to a valid phone number.

    View Docs
    • Node.js
    • C#
    • PHP
    • Ruby
    • Python
    • Java
    • Curl
    // Download the helper library from https://www.twilio.com/docs/node/install
    // Your Account Sid and Auth Token from twilio.com/console
    // DANGER! This is insecure. See http://twil.io/secure
    const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
    const authToken = 'your_auth_token';
    const client = require('twilio')(accountSid, authToken);
    
    client.verify.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
          .verificationChecks
          .create({to: '+15017122661', code: '123456'})
          .then(verification_check => console.log(verification_check.status));
    // Install the C# / .NET helper library from twilio.com/docs/csharp/install
    
    using System;
    using Twilio;
    using Twilio.Rest.Verify.V2.Service;
    
    
    class Program
    {
        static void Main(string[] args)
        {
            // Find your Account Sid and Token at twilio.com/console
            // DANGER! This is insecure. See http://twil.io/secure
            const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
            const string authToken = "your_auth_token";
    
            TwilioClient.Init(accountSid, authToken);
    
            var verificationCheck = VerificationCheckResource.Create(
                to: "+15017122661",
                code: "123456",
                pathServiceSid: "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );
    
            Console.WriteLine(verificationCheck.Status);
        }
    }
    <?php
    
    // Update the path below to your autoload.php,
    // see https://getcomposer.org/doc/01-basic-usage.md
    require_once '/path/to/vendor/autoload.php';
    
    use Twilio\Rest\Client;
    
    // Find your Account Sid and Auth Token at twilio.com/console
    // DANGER! This is insecure. See http://twil.io/secure
    $sid    = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    $token  = "your_auth_token";
    $twilio = new Client($sid, $token);
    
    $verification_check = $twilio->verify->v2->services("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
                                             ->verificationChecks
                                             ->create("123456", // code
                                                      array("to" => "+15017122661")
                                             );
    
    print($verification_check->status);
    # Download the helper library from https://www.twilio.com/docs/ruby/install
    require 'rubygems'
    require 'twilio-ruby'
    
    # Your Account Sid and Auth Token from twilio.com/console
    # DANGER! This is insecure. See http://twil.io/secure
    account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    auth_token = 'your_auth_token'
    @client = Twilio::REST::Client.new(account_sid, auth_token)
    
    verification_check = @client.verify
                                .services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
                                .verification_checks
                                .create(to: '+15017122661', code: '123456')
    
    puts verification_check.status
    # Download the helper library from https://www.twilio.com/docs/python/install
    from twilio.rest import Client
    
    
    # Your Account Sid and Auth Token from twilio.com/console
    # DANGER! This is insecure. See http://twil.io/secure
    account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    auth_token = 'your_auth_token'
    client = Client(account_sid, auth_token)
    
    verification_check = client.verify \
                               .services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
                               .verification_checks \
                               .create(to='+15017122661', code='123456')
    
    print(verification_check.status)
    // Install the Java helper library from twilio.com/docs/java/install
    
    import com.twilio.Twilio;
    import com.twilio.rest.verify.v2.service.VerificationCheck;
    
    public class Example {
        // Find your Account Sid and Token at twilio.com/console
        // DANGER! This is insecure. See http://twil.io/secure
        public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        public static final String AUTH_TOKEN = "your_auth_token";
    
        public static void main(String[] args) {
            Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
            VerificationCheck verificationCheck = VerificationCheck.creator(
                    "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                    "123456")
                .setTo("+15017122661").create();
    
            System.out.println(verificationCheck.getStatus());
        }
    }
    curl -X POST "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VerificationCheck" \
    --data-urlencode "To=+15017122661" \
    --data-urlencode "Code=123456" \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
The Twilio advantage
  • Communicate reliably

    Experience a 99.95% uptime SLA made possible with automated failover and zero maintenance windows.

  • Operate at scale

    Extend the same app you write once to new markets with configurable features for localization and compliance.

  • Many channels

    Use the same platform you know for voice, SMS, video, chat, two-factor authentication, and more.

  • No shenanigans

    Get to market faster with pay-as-you-go pricing, free support, and the freedom to scale up or down without contracts.