Menu

Expand
Rate this page:

Services

A Verification Service is the set of common configurations used to create and check verifications. You can create a service with the API or in the Console. Services include configuration for features like:

  • Email
  • Friendly Name (used in the Verification message templates, except in countries with brand restrictions)
  • Code Length
  • Skip sending SMS to Landlines
  • Requiring DTMF Input for Voice Verifications
  • Enabling Twilio Lookup

The SMS channel example below shows different friendly names and code lengths used in our SMS message templates.

sms example friendly name and code length

Email Verification

Follow along with the instructions here to set up your service to send email verifications.

Service Response Properties

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

Resource Properties in REST API format
sid
sid<VA> Not PII

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

account_sid
sid<AC> Not PII

The SID of the Account that created the Service resource.

friendly_name
string Not PII

The string that you assigned to describe the verification service. It can be up to 32 characters long. This value should not contain PII.

code_length
integer Not PII

The length of the verification code to generate.

lookup_enabled
boolean Not PII

Whether to perform a lookup with each verification started and return info about the phone number.

psd2_enabled
boolean Not PII

Whether to pass PSD2 transaction parameters when starting a verification.

skip_sms_to_landlines
boolean Not PII

Whether to skip sending SMS verifications to landlines. Requires lookup_enabled.

dtmf_input_required
boolean Not PII

Whether to ask the user to press a number before delivering the verify code in a phone call.

tts_name
string Not PII

The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages.

do_not_share_warning_enabled
boolean Not PII

Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code

custom_code_enabled
boolean Not PII

Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers.

push
object Not PII

Configurations for the Push factors (channel) created under this Service.

totp
object Not PII

Configurations for the TOTP factors (channel) created under this Service.

default_template_sid
sid<HJ> Not PII

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 resource.

links
uri_map Not PII

The URLs of related resources.

Create a Verification Service

post
https://verify.twilio.com/v2/Services

These are the available input parameters for creating a Service.

Parameters
Parameters in REST API format
friendly_name
Required
post string Not PII

A descriptive string that you create to describe the verification service. It can be up to 32 characters long. This value should not contain PII.

code_length
Optional
post integer Not PII

The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive.

lookup_enabled
Optional
post boolean Not PII

Whether to perform a lookup with each verification started and return info about the phone number.

skip_sms_to_landlines
Optional
post boolean Not PII

Whether to skip sending SMS verifications to landlines. Requires lookup_enabled.

dtmf_input_required
Optional
post boolean Not PII

Whether to ask the user to press a number before delivering the verify code in a phone call.

tts_name
Optional
post string Not PII

The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages.

psd2_enabled
Optional
post boolean Not PII

Whether to pass PSD2 transaction parameters when starting a verification.

do_not_share_warning_enabled
Optional
post boolean Not PII

Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code

custom_code_enabled
Optional
post boolean Not PII

Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers.

push.include_date
Optional
post boolean Not PII

Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See Challenge resource’s details parameter for more info. Default: false. Deprecated do not use this parameter. This timestamp value is the same one as the one found in date_created, please use that one instead.

push.apn_credential_sid
Optional
post sid<CR> Not PII

Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See Credential Resource

push.fcm_credential_sid
Optional
post sid<CR> Not PII

Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See Credential Resource

totp.issuer
Optional
post string Not PII

Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. Defaults to the service friendly name if not provided.

totp.time_step
Optional
post integer Not PII

Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds

totp.code_length
Optional
post integer Not PII

Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6

totp.skew
Optional
post integer Not PII

Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1

default_template_sid
Optional
post sid<HJ> Not PII

The default message template. Will be used for all SMS verifications unless explicitly overriden. SMS channel only.

Example 1
Loading Code Sample...
        
        

        Create a Service

        Example 2
        Loading Code Sample...
              
              

              Create a PSD2 Enabled Service

              See Verifying Transactions for PSD2 for more information.

              Fetch a Service

              get
              https://verify.twilio.com/v2/Services/{Sid}
              Parameters
              Parameters in REST API format
              sid
              Path
              get sid<VA> Not PII

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

              Example 1
              Loading Code Sample...
                    
                    

                    Fetch a Service

                    List all Services

                    get
                    https://verify.twilio.com/v2/Services
                    Example 1
                    Loading Code Sample...
                          
                          

                          List all Services

                          Update a Service

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

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

                          Parameters
                          Parameters in REST API format
                          sid
                          Path
                          post sid<VA> Not PII

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

                          friendly_name
                          Optional
                          post string Not PII

                          A descriptive string that you create to describe the verification service. It can be up to 32 characters long. This value should not contain PII.

                          code_length
                          Optional
                          post integer Not PII

                          The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive.

                          lookup_enabled
                          Optional
                          post boolean Not PII

                          Whether to perform a lookup with each verification started and return info about the phone number.

                          skip_sms_to_landlines
                          Optional
                          post boolean Not PII

                          Whether to skip sending SMS verifications to landlines. Requires lookup_enabled.

                          dtmf_input_required
                          Optional
                          post boolean Not PII

                          Whether to ask the user to press a number before delivering the verify code in a phone call.

                          tts_name
                          Optional
                          post string Not PII

                          The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages.

                          psd2_enabled
                          Optional
                          post boolean Not PII

                          Whether to pass PSD2 transaction parameters when starting a verification.

                          do_not_share_warning_enabled
                          Optional
                          post boolean Not PII

                          Whether to add a privacy warning at the end of an SMS. Disabled by default and applies only for SMS.

                          custom_code_enabled
                          Optional
                          post boolean Not PII

                          Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers.

                          push.include_date
                          Optional
                          post boolean Not PII

                          Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See Challenge resource’s details parameter for more info. Default: false. Deprecated do not use this parameter.

                          push.apn_credential_sid
                          Optional
                          post sid<CR> Not PII

                          Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See Credential Resource

                          push.fcm_credential_sid
                          Optional
                          post sid<CR> Not PII

                          Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See Credential Resource

                          totp.issuer
                          Optional
                          post string Not PII

                          Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI.

                          totp.time_step
                          Optional
                          post integer Not PII

                          Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds

                          totp.code_length
                          Optional
                          post integer Not PII

                          Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6

                          totp.skew
                          Optional
                          post integer Not PII

                          Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1

                          default_template_sid
                          Optional
                          post sid<HJ> Not PII

                          The default message template. Will be used for all SMS verifications unless explicitly overriden. SMS channel only.

                          Example 1
                          Loading Code Sample...
                                
                                

                                Update a Service's Code Length

                                Example 2
                                Loading Code Sample...
                                      
                                      

                                      Update a Service Name

                                      Delete a Service

                                      delete
                                      https://verify.twilio.com/v2/Services/{Sid}
                                      Parameters
                                      Parameters in REST API format
                                      sid
                                      Path
                                      delete sid<VA> Not PII

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

                                      Example 1
                                      Loading Code Sample...
                                            
                                            

                                            Delete a Service

                                            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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                            Loading Code Sample...
                                                  
                                                  
                                                  

                                                  Thank you for your feedback!

                                                  Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

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

                                                  Thanks for your feedback!

                                                  thanks-feedback-gif