Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Verifications

Twilio's new Verify API is currently available as a Public Beta product. Some features are not yet implemented and others may be changed before the product is declared as Generally Available. Public Beta products are not covered by a Twilio SLA.

The Verification Resource represents a verification request. This will trigger a communication to the end user through the specified channel (e.g. SMS).

Prerequisites:

  1. Create a Verification Service

Verification Response Properties

These fields are returned in the output JSON response. The type SID<XX> is a unique ID starting with the letters XX.

Names in Ruby format
sid
sid<VE> Not PII

The unique string that we created to identify the Verification resource.

service_sid
sid<VA> Not PII

The SID of the Service the resource is associated with.

account_sid
sid<AC> Not PII

The SID of the Account that created the Verification resource.

to
phone_number Not PII

The phone number being verified. Must be in E.164 format.

channel
enum:channel Not PII

The verification method to use. Can be: sms or call.

status
string Not PII

The status of the verification. Can be: pending, approved, denied, or expired.

valid
boolean Not PII

Whether the verification was successful.

lookup
object Not PII

Information about the phone number being verified.

amount
string Not PII

The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

payee
string Not PII

The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in RFC 2822 format.

date_updated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822 format.

url
url Not PII

The absolute URL of the Verification resource.

Start New Verification

post
https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications

These are the available input parameters for starting a verification. The type SID<XX> is a unique ID starting with the letters XX.

Parameters
Names in None format
service_sid
Required
post sid<VA> Not PII

The SID of the verification Service to create the resource under.

to
Required
post string Not PII

The phone number to verify.

channel
Required
post string Not PII

The verification method to use. Can be: sms or call.

custom_message
Optional
post string Not PII

The text of a custom message to use for the verification.

send_digits
Optional
post string Not PII

The digits to send after a phone call is answered, for example, to dial an extension. For more information, see the Programmable Voice documentation of sendDigits.

locale
Optional
post string Not PII

The locale to use for the verification SMS or call. Can be: af, ar, ca, cs, da, de, el, en, es, fi, fr, he, hi, hr, hu, id, it, ja, ko, ms, nb, nl, pl, pt, pr-BR, ro, ru, sv, th, tl, tr, vi, zh, zh-CN, or zh-HK.

custom_code
Optional
post string Not PII

A pre-generated code to use for verification. The code can be between 4 and 10 characters, inclusive.

amount
Optional
post string Not PII

The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

payee
Optional
post string Not PII

The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

rate_limits
Optional
post object Not PII

The custom key-value pairs of Programmable Rate Limits. Keys should be the unique_name configured while creating you Rate Limit along with the associated values for each particular request. You may include multiple Rate Limit values in each request.

Example 1
        
        
        
        

        Fetch a Verification

        get
        https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications/{Sid}
        Parameters
        Names in None format
        service_sid
        Required
        get sid<VA> Not PII

        The SID of the verification Service to fetch the resource from.

        sid
        Required
        get string Not PII

        The Twilio-provided string that uniquely identifies the Verification resource to fetch.

        Example 1
              
              
              
              

              Update a Verification Status

              post
              https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications/{Sid}

              Use this endpoint only if using Custom Verification Codes. You will need to mark the verification as "approved" after your application had validated the verification code.

              For most use cases, Verify is able to manage the complete lifecycle of a verification with the Verification Check Resource.

              Parameters
              Names in None format
              service_sid
              Required
              post sid<VA> Not PII

              The SID of the verification Service to update the resource from.

              sid
              Required
              post string Not PII

              The Twilio-provided string that uniquely identifies the Verification resource to update.

              status
              Required
              post enum:status Not PII

              The new status of the resource. Can be: pending, approved, denied, or expired.

              Example 1
                    
                    
                    
                    
                    Only use if using Custom Verification Codes

                    Manually Approve Verification using SID

                    Only use if using Custom Verification Codes

                    Next: Check a Verification

                    Validate if the code a user provided was correct with the Verification Check Resource.

                    Rate this page:

                    Need some help?

                    We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.