Verification Services in Verify V2 can be configured to validate phone numbers prior to attempting a verification. Enabling this option also gives you the option of skipping landline phone numbers, and only attempting to verify SMS-capable phone numbers. This guide will explain how to control these options.
Create a new Verification Service that Blocks Landlines
Landline phone number blocking can be enabled when a new Verification Service is created. The Lookup and Landline Validation options will just need to be enabled in Console, or included with positive values in your API request.
For examples, please see the Create a Verify V2 Service section of Getting Started with Verify V2.
Update an existing Verification Service to Block Landlines via Console
- Access the Verification Services page in Console.
- Click the desired Verification Service to modify.
- Click to enable LOOKUP and LANDLINE VALIDATION.
- Click Save.
Update an existing Verification Service to Block Landlines via the REST API
Verify V2 Services can also be updated via the REST API. Here’s an example cURL script:
curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \ --data-urlencode "LookupEnabled=true" \ --data-urlencode "SkipSmsToLandlines=true" \ -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
This example will update the existing verification service with Service SID
to enable the Lookup and Landline Validation options. To make this script work for you, make the following updates, and then paste it into a terminal window:
- Line 1 update with the Verification Service's SID
- Line 4 update with your Account SID and Auth Token
For more details, including code samples using our Helper Libraries, please see Update a Service (Twilio Docs).