• 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
    • Curl
    • Node
    • .NET (C#)
    # $AUTHY_API_FORMAT is either “xml” or “json”
    # $USER_PHONE example:  5551234567
    # $COUNTRY_CODE example: 1
    # $VERIFY_CODE is the token received via SMS or Voice
    # $VIA is either “sms” or “voice”
    
    curl -X POST "https://api.authy.com/protected/$AUTHY_API_FORMAT/phones/verification/start?via=$VIA&country_code=$USER_COUNTRY&phone_number=$USER_PHONE" \
    -H "X-Authy-API-Key: $AUTHY_API_KEY"
    
    # npm install authy-client
    const Client = require('authy-client').Client;
    const authy = new Client({key: AUTHY_API_KEY});
    
    const enums = require('authy-client').enums;
    
    authy.startPhoneVerification({ countryCode: 'US', locale: 'en', phone: '5551234567', via: enums.verificationVia.SMS }, function(err, res) {
      if (err) throw err;
    
      console.log('Phone information', response);
    });
    public static async Task StartPhoneVerificationAsync()
      {
        // Create client
        var client = new HttpClient();
    
        var requestContent = new FormUrlEncodedContent(new[] {
          new KeyValuePair("via", "sms"),
          new KeyValuePair("phone_number", "5558675309"),
          new KeyValuePair("country_code", "1"),
        });
    
        // https://api.authy.com/protected/$AUTHY_API_FORMAT/phones/verification/start?via=$VIA&country_code=$USER_COUNTRY&phone_number=$USER_PHONE
        HttpResponseMessage response = await client.PostAsync(
          "https://api.authy.com/protected/json/phones/verification/start?api_key=" + AuthyAPIKey,
          requestContent);
    
        // Get the response content.
        HttpContent responseContent = response.Content;
    
        // Get the stream of the content.
        using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
          {
            // Write the output.
            Console.WriteLine(await reader.ReadToEndAsync());
          }
        }
  • 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
    • Curl
    • Node
    • .NET (C#)
    # $AUTHY_API_FORMAT is either “xml” or “json”
    # $USER_PHONE example:  5551234567
    # $COUNTRY_CODE example: 1
    # $VERIFY_CODE is the token received via SMS or Voice
    
    curl "https://api.authy.com/protected/$AUTHY_API_FORMAT/phones/verification/check?phone_number=$USER_PHONE&country_code=$USER_COUNTRY&verification_code=$VERIFY_CODE" \
    -H "X-Authy-API-Key: $AUTHY_API_KEY"
    # npm install authy-client
    const Client = require('authy-client').Client;
    const authy = new Client({key: AUTHY_API_KEY});
    
    client.verifyPhone({ countryCode: 'US', phone: '5551234567', token: '1234' }, function(err, res) {
      if (err) throw err;
    
      console.log('Verification code is correct');
    });
    public static async Task VerifyPhoneAsync()
      {
        // Create client
        var client = new HttpClient();
    
        // Add authentication header
        client.DefaultRequestHeaders.Add("X-Authy-API-Key", AuthyAPIKey);
    
        // https://api.authy.com/protected/$AUTHY_API_FORMAT/phones/verification/check?phone_number=$USER_PHONE&country_code=$USER_COUNTRY&verification_code=$VERIFY_CODE
        HttpResponseMessage response = await client.GetAsync(
          "https://api.authy.com/protected/json/phones/verification/check?phone_number=5558675309&country_code=1&verification_code=3043");
    
        // Get the response content.
        HttpContent responseContent = response.Content;
    
        // Get the stream of the content.
        using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
          {
            // Write the output.
            Console.WriteLine(await reader.ReadToEndAsync());
          }
        }
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.