Skip to contentSkip to navigationSkip to topbar
Rate this page:
On 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.

Property nameTypePIIDescription
sidSID<VA>
Not PII

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

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>

The SID of the Account that created the Service resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

friendly_namestring

The name that appears in the body of your verification messages. It can be up to 30 characters long and can include letters, numbers, spaces, dashes, underscores. Phone numbers, special characters or links are NOT allowed. This value should not contain PII.


code_lengthinteger

The length of the verification code to generate.


lookup_enabledboolean

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


psd2_enabledboolean

Whether to pass PSD2 transaction parameters when starting a verification.


skip_sms_to_landlinesboolean

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


dtmf_input_requiredboolean

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


tts_namestring

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


do_not_share_warning_enabledboolean

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_enabledboolean

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


pushobject

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


totpobject

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


default_template_sidSID<HJ>
Pattern: ^HJ[0-9a-fA-F]{32}$Min length: 34Max length: 34

whatsappnull

verify_event_subscription_enabledboolean

Whether to allow verifications from the service to reach the stream-events sinks if configured


date_createdstring<date-time>

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


date_updatedstring<date-time>

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


urlstring<uri>

The absolute URL of the resource.


linksobject<uri-map>

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.

Request body parameters

Property nameTypeRequiredPIIDescription
FriendlyNamestringrequired

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.


CodeLengthintegerOptional

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


LookupEnabledbooleanOptional

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


SkipSmsToLandlinesbooleanOptional

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


DtmfInputRequiredbooleanOptional

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


TtsNamestringOptional

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


Psd2EnabledbooleanOptional

Whether to pass PSD2 transaction parameters when starting a verification.


DoNotShareWarningEnabledbooleanOptional

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


CustomCodeEnabledbooleanOptional

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


Push.IncludeDatebooleanOptional

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.ApnCredentialSidSID<CR>Optional

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

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

Push.FcmCredentialSidSID<CR>Optional

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

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

Totp.IssuerstringOptional

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

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

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


Totp.SkewintegerOptional

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


DefaultTemplateSidSID<HJ>Optional

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

Pattern: ^HJ[0-9a-fA-F]{32}$Min length: 34Max length: 34

Whatsapp.MsgServiceSidSID<MG>Optional

The SID of the Messaging Service containing WhatsApp Sender(s) that Verify will use to send WhatsApp messages to your users.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34

Whatsapp.FromstringOptional

The number to use as the WhatsApp Sender that Verify will use to send WhatsApp messages to your users.This WhatsApp Sender must be associated with a Messaging Service SID.


VerifyEventSubscriptionEnabledbooleanOptional

Whether to allow verifications from the service to reach the stream-events sinks if configured

Create a Service

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function createService() {
_18
const service = await client.verify.v2.services.create({
_18
friendlyName: "My Verify Service",
_18
});
_18
_18
console.log(service.sid);
_18
}
_18
_18
createService();

Output

_43
{
_43
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"friendly_name": "My Verify Service",
_43
"code_length": 4,
_43
"lookup_enabled": false,
_43
"psd2_enabled": false,
_43
"skip_sms_to_landlines": false,
_43
"dtmf_input_required": false,
_43
"tts_name": "name",
_43
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"do_not_share_warning_enabled": false,
_43
"custom_code_enabled": true,
_43
"push": {
_43
"include_date": false,
_43
"apn_credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"fcm_credential_sid": null
_43
},
_43
"totp": {
_43
"issuer": "test-issuer",
_43
"time_step": 30,
_43
"code_length": 3,
_43
"skew": 2
_43
},
_43
"whatsapp": {
_43
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"from": "whatsapp:+1234567890"
_43
},
_43
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"verify_event_subscription_enabled": false,
_43
"date_created": "2015-07-30T20:00:00Z",
_43
"date_updated": "2015-07-30T20:00:00Z",
_43
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"links": {
_43
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
_43
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
_43
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
_43
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
_43
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
_43
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
_43
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
_43
}
_43
}


Associate a predefined template with a service

A predefined template (public or private if there are any associated with your account) can be associated with a Verification Service by setting the DefaultTemplateSid attribute. By doing so, the message body of the verifications created with the service will use the text defined in the referenced template by default.

The default template SID<HJ> is a unique ID starting with the letters HJ. It is automatically generated when the template is created.

A complete list of the available templates for the account can be obtained by querying the Templates API.

The template that is going to be used in the verification will be selected in the following order:

  1. If a TemplateSid is received in the Create Verification request, the verification will use the text defined in the template identified with that Sid .
  2. If a DefaultTemplateSid is set for the Service, the verification will use the text defined in the template identified with that Sid .
  3. Otherwise, the text defined in the global default template will be used.

Create a Service with a default template

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createService() {
_19
const service = await client.verify.v2.services.create({
_19
defaultTemplateSid: "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
friendlyName: "My Verify Service",
_19
});
_19
_19
console.log(service.sid);
_19
}
_19
_19
createService();

Output

_43
{
_43
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"friendly_name": "My Verify Service",
_43
"code_length": 4,
_43
"lookup_enabled": false,
_43
"psd2_enabled": false,
_43
"skip_sms_to_landlines": false,
_43
"dtmf_input_required": false,
_43
"tts_name": "name",
_43
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"do_not_share_warning_enabled": false,
_43
"custom_code_enabled": true,
_43
"push": {
_43
"include_date": false,
_43
"apn_credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"fcm_credential_sid": null
_43
},
_43
"totp": {
_43
"issuer": "test-issuer",
_43
"time_step": 30,
_43
"code_length": 3,
_43
"skew": 2
_43
},
_43
"whatsapp": {
_43
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"from": "whatsapp:+1234567890"
_43
},
_43
"default_template_sid": "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_43
"verify_event_subscription_enabled": false,
_43
"date_created": "2015-07-30T20:00:00Z",
_43
"date_updated": "2015-07-30T20:00:00Z",
_43
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"links": {
_43
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
_43
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
_43
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
_43
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
_43
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
_43
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
_43
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
_43
}
_43
}

Create a PSD2 Enabled Service

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createService() {
_19
const service = await client.verify.v2.services.create({
_19
friendlyName: "Owl Banking",
_19
psd2Enabled: true,
_19
});
_19
_19
console.log(service.psd2Enabled);
_19
}
_19
_19
createService();

Output

_43
{
_43
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"friendly_name": "Owl Banking",
_43
"code_length": 4,
_43
"lookup_enabled": false,
_43
"psd2_enabled": true,
_43
"skip_sms_to_landlines": false,
_43
"dtmf_input_required": false,
_43
"tts_name": "name",
_43
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"do_not_share_warning_enabled": false,
_43
"custom_code_enabled": true,
_43
"push": {
_43
"include_date": false,
_43
"apn_credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"fcm_credential_sid": null
_43
},
_43
"totp": {
_43
"issuer": "test-issuer",
_43
"time_step": 30,
_43
"code_length": 3,
_43
"skew": 2
_43
},
_43
"whatsapp": {
_43
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"from": "whatsapp:+1234567890"
_43
},
_43
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"verify_event_subscription_enabled": false,
_43
"date_created": "2015-07-30T20:00:00Z",
_43
"date_updated": "2015-07-30T20:00:00Z",
_43
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"links": {
_43
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
_43
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
_43
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
_43
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
_43
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
_43
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
_43
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
_43
}
_43
}

See Verifying Transactions for PSD2 for more information.


Fetch a Service

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

Path parameters

Property nameTypeRequiredPIIDescription
SidSID<VA>required

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

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34

Fetch a Service

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchService() {
_18
const service = await client.verify.v2
_18
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.fetch();
_18
_18
console.log(service.sid);
_18
}
_18
_18
fetchService();

Output

_43
{
_43
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"friendly_name": "name",
_43
"code_length": 4,
_43
"lookup_enabled": false,
_43
"psd2_enabled": false,
_43
"skip_sms_to_landlines": false,
_43
"dtmf_input_required": false,
_43
"tts_name": "name",
_43
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"do_not_share_warning_enabled": false,
_43
"custom_code_enabled": true,
_43
"push": {
_43
"include_date": false,
_43
"apn_credential_sid": null,
_43
"fcm_credential_sid": null
_43
},
_43
"totp": {
_43
"issuer": null,
_43
"time_step": null,
_43
"code_length": null,
_43
"skew": null
_43
},
_43
"whatsapp": {
_43
"msg_service_sid": null,
_43
"from": null
_43
},
_43
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"verify_event_subscription_enabled": false,
_43
"date_created": "2015-07-30T20:00:00Z",
_43
"date_updated": "2015-07-30T20:00:00Z",
_43
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"links": {
_43
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
_43
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
_43
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
_43
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
_43
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
_43
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
_43
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
_43
}
_43
}


List all Services

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

Query parameters

Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

List all Services

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function listService() {
_16
const services = await client.verify.v2.services.list({ limit: 20 });
_16
_16
services.forEach((s) => console.log(s.sid));
_16
}
_16
_16
listService();

Output

_56
{
_56
"meta": {
_56
"page": 0,
_56
"page_size": 50,
_56
"first_page_url": "https://verify.twilio.com/v2/Services?PageSize=50&Page=0",
_56
"previous_page_url": null,
_56
"next_page_url": null,
_56
"key": "services",
_56
"url": "https://verify.twilio.com/v2/Services?PageSize=50&Page=0"
_56
},
_56
"services": [
_56
{
_56
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"friendly_name": "name",
_56
"code_length": 4,
_56
"lookup_enabled": false,
_56
"psd2_enabled": false,
_56
"skip_sms_to_landlines": false,
_56
"dtmf_input_required": false,
_56
"tts_name": "name",
_56
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"do_not_share_warning_enabled": false,
_56
"custom_code_enabled": true,
_56
"push": {
_56
"include_date": false,
_56
"apn_credential_sid": null,
_56
"fcm_credential_sid": null
_56
},
_56
"totp": {
_56
"issuer": null,
_56
"time_step": null,
_56
"code_length": null,
_56
"skew": null
_56
},
_56
"whatsapp": {
_56
"msg_service_sid": null,
_56
"from": null
_56
},
_56
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"verify_event_subscription_enabled": false,
_56
"date_created": "2015-07-30T20:00:00Z",
_56
"date_updated": "2015-07-30T20:00:00Z",
_56
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"links": {
_56
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
_56
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
_56
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
_56
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
_56
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
_56
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
_56
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
_56
}
_56
}
_56
]
_56
}


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.

Path parameters

Property nameTypeRequiredPIIDescription
SidSID<VA>required

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

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34

Request body parameters

Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

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.


CodeLengthintegerOptional

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


LookupEnabledbooleanOptional

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


SkipSmsToLandlinesbooleanOptional

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


DtmfInputRequiredbooleanOptional

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


TtsNamestringOptional

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


Psd2EnabledbooleanOptional

Whether to pass PSD2 transaction parameters when starting a verification.


DoNotShareWarningEnabledbooleanOptional

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


CustomCodeEnabledbooleanOptional

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


Push.IncludeDatebooleanOptional

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.ApnCredentialSidSID<CR>Optional

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

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

Push.FcmCredentialSidSID<CR>Optional

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

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

Totp.IssuerstringOptional

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


Totp.TimeStepintegerOptional

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

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


Totp.SkewintegerOptional

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


DefaultTemplateSidSID<HJ>Optional

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

Pattern: ^HJ[0-9a-fA-F]{32}$Min length: 34Max length: 34

Whatsapp.MsgServiceSidSID<MG>Optional

The SID of the Messaging Service to associate with the Verification Service.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34

Whatsapp.FromstringOptional

The WhatsApp number to use as the sender of the verification messages. This number must be associated with the WhatsApp Message Service.


VerifyEventSubscriptionEnabledbooleanOptional

Whether to allow verifications from the service to reach the stream-events sinks if configured


Associate a template with an existing service

A predefined template can be associated with an already created Verification Service by setting the DefaultTemplateSid attribute. By doing so, the message body of the verifications created with the service will use by default the text defined in the template.
The default template SID<HJ> is a unique ID starting with the letters HJ. It is generated when the template is created.

A complete list of the available templates for the account can be obtained by querying the List Templates API.

The template that is going to be used in the verification will be defined following this order:

  1. If a TemplateSid is received in the Create Verification request, the verification will use the text defined in the template identified with that Sid .
  2. If a DefaultTemplateSid is set for the Service, the verification will use the text defined in the template identified with that Sid .
  3. Otherwise, the text defined in the default template will be used.

Update a Service default template.

curl

_10
curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
_10
--data-urlencode "DefaultTemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Output

_36
{
_36
"sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"friendly_name": "name",
_36
"code_length": 7,
_36
"lookup_enabled": false,
_36
"psd2_enabled": false,
_36
"skip_sms_to_landlines": false,
_36
"dtmf_input_required": false,
_36
"tts_name": "name",
_36
"do_not_share_warning_enabled": false,
_36
"custom_code_enabled": true,
_36
"push": {
_36
"include_date": true,
_36
"apn_credential_sid": null,
_36
"fcm_credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_36
},
_36
"totp": {
_36
"issuer": "test-issuer",
_36
"time_step": 30,
_36
"code_length": 3,
_36
"skew": 2
_36
},
_36
"date_created": "2015-07-30T20:00:00Z",
_36
"date_updated": "2015-07-30T20:00:00Z",
_36
"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"links": {
_36
"verification_checks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VerificationCheck",
_36
"verifications": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications",
_36
"rate_limits": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits",
_36
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations",
_36
"entities": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities",
_36
"webhooks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
_36
"access_tokens": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens"
_36
}
_36
}

Update a Service's Code Length

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateService() {
_18
const service = await client.verify.v2
_18
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.update({ codeLength: 7 });
_18
_18
console.log(service.codeLength);
_18
}
_18
_18
updateService();

Output

_43
{
_43
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"friendly_name": "name",
_43
"code_length": 7,
_43
"lookup_enabled": false,
_43
"psd2_enabled": false,
_43
"skip_sms_to_landlines": false,
_43
"dtmf_input_required": false,
_43
"tts_name": "name",
_43
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"do_not_share_warning_enabled": false,
_43
"custom_code_enabled": true,
_43
"push": {
_43
"include_date": false,
_43
"apn_credential_sid": null,
_43
"fcm_credential_sid": "CRbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
_43
},
_43
"totp": {
_43
"issuer": "test-issuer",
_43
"time_step": 30,
_43
"code_length": 3,
_43
"skew": 2
_43
},
_43
"whatsapp": {
_43
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"from": "whatsapp:+1234567890"
_43
},
_43
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"verify_event_subscription_enabled": false,
_43
"date_created": "2015-07-30T20:00:00Z",
_43
"date_updated": "2015-07-30T20:00:00Z",
_43
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"links": {
_43
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
_43
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
_43
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
_43
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
_43
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
_43
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
_43
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
_43
}
_43
}

Update a Service Name

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateService() {
_18
const service = await client.verify.v2
_18
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.update({ friendlyName: "New and Improved Service Name" });
_18
_18
console.log(service.friendlyName);
_18
}
_18
_18
updateService();

Output

_43
{
_43
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"friendly_name": "New and Improved Service Name",
_43
"code_length": 4,
_43
"lookup_enabled": false,
_43
"psd2_enabled": false,
_43
"skip_sms_to_landlines": false,
_43
"dtmf_input_required": false,
_43
"tts_name": "name",
_43
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"do_not_share_warning_enabled": false,
_43
"custom_code_enabled": true,
_43
"push": {
_43
"include_date": false,
_43
"apn_credential_sid": null,
_43
"fcm_credential_sid": "CRbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
_43
},
_43
"totp": {
_43
"issuer": "test-issuer",
_43
"time_step": 30,
_43
"code_length": 3,
_43
"skew": 2
_43
},
_43
"whatsapp": {
_43
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"from": "whatsapp:+1234567890"
_43
},
_43
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"verify_event_subscription_enabled": false,
_43
"date_created": "2015-07-30T20:00:00Z",
_43
"date_updated": "2015-07-30T20:00:00Z",
_43
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43
"links": {
_43
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
_43
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
_43
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
_43
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
_43
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
_43
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
_43
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
_43
}
_43
}


Delete a Service

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

Path parameters

Property nameTypeRequiredPIIDescription
SidSID<VA>required

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

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34

Delete a Service

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function deleteService() {
_16
await client.verify.v2
_16
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_16
.remove();
_16
}
_16
_16
deleteService();


Rate this page: