メニュー

Expand
ページを評価:

Verifications

The Twilio Verify REST API allows you to verify that a user has a claimed device in their possession. The API lets you request a verification code to be sent to the user and to check that a received code is valid.

必要なもの:

  1. Create a Verification Service

Verification Response Properties

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

Resource Properties in REST API 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
文字列 PII MTL: 30 DAYS

The phone number or email being verified. Phone numbers must be in E.164 format.

channel
enum:channel Not PII

The verification method used. One of: email, sms or call.

status
文字列 Not PII

The status of the verification. One of: pending, approved, or canceled

valid
boolean Not PII

Use "status" instead. Legacy property indicating whether the verification was successful.

lookup
オブジェクト Not PII

Information about the phone number being verified.

amount
文字列 PII MTL: 1 DAYS

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

payee
文字列 PII MTL: 1 DAYS

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

send_code_attempts
object[] Not PII

An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID.

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

To verify a user's phone number or email, start by requesting to send a verification code to their device.

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

パラメーター
Parameters in REST API format
service_sid
Path
post sid<VA> Not PII

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

to
必須
post 文字列 PII MTL: 30 DAYS

The phone number or email to verify. Phone numbers must be in E.164 format.

channel
必須
post 文字列 Not PII

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

custom_friendly_name
オプション
post 文字列 Not PII

A custom user defined friendly name that overwrites the existing one in the verification message

send_digits
オプション
post 文字列 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
オプション
post 文字列 Not PII

The locale to use for the verification SMS or call. Can be: af, ar, ca, cs, da, de, el, en, en-GB, 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
オプション
post 文字列 Not PII

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

amount
オプション
post 文字列 PII MTL: 1 DAYS

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

payee
オプション
post 文字列 PII MTL: 1 DAYS

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

rate_limits
オプション
post オブジェクト Not PII

The custom key-value pairs of Programmable Rate Limits. Keys correspond to unique_name fields defined when creating your Rate Limit. Associated value pairs represent values in the request that you are rate limiting on. You may include multiple Rate Limit values in each request.

channel_configuration
オプション
post オブジェクト Not PII

email channel configuration in json format. Must include 'from' and 'from_name'.

app_hash
オプション
post 文字列 Not PII

Your App Hash to be appended at the end of your verification SMS body. Applies only to SMS. Example SMS body: <#> Your AppName verification code is: 1234 He42w354ol9.

例 1
        
        
        
        
        例 2
              
              
              
              
              例 3
                    
                    
                    
                    
                    例 4
                          
                          
                          
                          

                          Verify's email channel requires additional Service configuration. Please refer to the email channel setup documentation for detailed instructions.

                          The email ChannelConfiguration parameter is an object that supports the following keys:

                          from 文字列 Required if submitting the ChannelConfiguration parameter.
                          from_name 文字列 Required if submitting the ChannelConfiguration parameter.
                          template_id 文字列

                          Override the default template from the Verify Service email integration. Create a new template in the SendGrid dashboard or learn more in the SendGrid docs.

                          substitutions オブジェクト

                          Variable substitution for dynamic email templates (learn more). i.e.

                          {
                            "substitutions": {
                              "username": "jdoe321",
                              "first_name": "Jane",
                              "last_name": "Doe"
                            }
                          }
                          

                          Localization and Supported Languages

                          Verify supports delivering verification codes in more than 30 languages over both voice and SMS. To find out more about which languages are supported visit our page on Localization and Supported Languages.

                          Canadian Carrier Data Support

                          By default, Verify will not return carrier data for Candian phone numbers. If you need carrier data on Canadian phone numbers, please visit our support site to enable this feature.

                          Fetch a Verification

                          GET
                          https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications/{Sid}
                          パラメーター
                          Parameters in REST API format
                          service_sid
                          Path
                          GET sid<VA> Not PII

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

                          sid
                          Path
                          GET 文字列 Not PII

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

                          例 1
                                
                                
                                
                                

                                Update a Verification Status

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

                                Mark the verification as "approved" after your application had validated the verification code.

                                Mark the verification as "canceled" to start a new verification with a different code before the previous code expires (10 minutes).

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

                                パラメーター
                                Parameters in REST API format
                                service_sid
                                Path
                                post sid<VA> Not PII

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

                                sid
                                Path
                                post 文字列 Not PII

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

                                status
                                必須
                                post ienum:status Not PII

                                The new status of the resource. Can be: canceled or approved.

                                例 1
                                      
                                      
                                      
                                      
                                      Only use if using Custom Verification Codes

                                      Manually Approve Verification using SID

                                      Only use if using Custom Verification Codes
                                      例 2
                                            
                                            
                                            
                                            
                                            Only use if using Custom Verification Codes

                                            Manually Approve Verification using Phone Number

                                            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.

                                            ページを評価:

                                            ヘルプが必要ですか?

                                            誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。

                                                  
                                                  
                                                  

                                                  フィードバックくださりありがとうございます!

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

                                                  Sending your feedback...
                                                  🎉 Thank you for your feedback!
                                                  Something went wrong. Please try again.

                                                  Thanks for your feedback!

                                                  Refer us and get $10 in 3 simple steps!

                                                  ステップ1

                                                  Get link

                                                  Get a free personal referral link here

                                                  ステップ2:

                                                  Give $10

                                                  Your user signs up and upgrade using link

                                                  ステップ3

                                                  Get $10

                                                  1,250 free SMSes
                                                  OR 1,000 free voice mins
                                                  OR 12,000 chats
                                                  OR more