Skip to contentSkip to navigationSkip to topbar
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(link takes you to an external page). Services include configuration for features like:

  • Email
  • Friendly Name (used in the Verification message templates, except in countries with brand restrictions(link takes you to an external page))
  • 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

email-verification page anchor

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


Service Response Properties

service-response-properties page anchor

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

Property nameTypeRequiredDescriptionChild properties
sidSID<VA>Optional
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>Optional

The SID of the Account that created the Service resource.

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

friendly_namestringOptional

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_lengthintegerOptional

The length of the verification code to generate.

Default: 0

lookup_enabledbooleanOptional

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


psd2_enabledbooleanOptional

Whether to pass PSD2 transaction parameters when starting a verification.


skip_sms_to_landlinesbooleanOptional

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


dtmf_input_requiredbooleanOptional

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


tts_namestringOptional

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


do_not_share_warning_enabledbooleanOptional

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_enabledbooleanOptional

Whether to allow sending verifications with a custom code instead of a randomly generated one.


pushobjectOptional

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


totpobjectOptional

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


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

whatsappnullOptional

verify_event_subscription_enabledbooleanOptional

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


date_createdstring<date-time>Optional

The date and time in GMT when the resource was created specified in RFC 2822(link takes you to an external page) format.


date_updatedstring<date-time>Optional

The date and time in GMT when the resource was last updated specified in RFC 2822(link takes you to an external page) format.


urlstring<uri>Optional

The absolute URL of the resource.


linksobject<uri-map>Optional

The URLs of related resources.


Create a Verification Service

create-a-verification-service page anchor
POST https://verify.twilio.com/v2/Services

These are the available input parameters for creating a Service.

Request body parameters

request-body-parameters page anchor
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
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.


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 ServiceLink to code sample: Create a Service
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createService() {
11
const service = await client.verify.v2.services.create({
12
friendlyName: "My Verify Service",
13
});
14
15
console.log(service.sid);
16
}
17
18
createService();

Output

1
{
2
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "My Verify Service",
5
"code_length": 4,
6
"lookup_enabled": false,
7
"psd2_enabled": false,
8
"skip_sms_to_landlines": false,
9
"dtmf_input_required": false,
10
"tts_name": "name",
11
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"do_not_share_warning_enabled": false,
13
"custom_code_enabled": true,
14
"push": {
15
"include_date": false,
16
"apn_credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
17
"fcm_credential_sid": null
18
},
19
"totp": {
20
"issuer": "test-issuer",
21
"time_step": 30,
22
"code_length": 3,
23
"skew": 2
24
},
25
"whatsapp": {
26
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"from": "whatsapp:+1234567890"
28
},
29
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
30
"verify_event_subscription_enabled": false,
31
"date_created": "2015-07-30T20:00:00Z",
32
"date_updated": "2015-07-30T20:00:00Z",
33
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
"links": {
35
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
36
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
37
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
38
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
39
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
40
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
41
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
42
}
43
}

Associate a predefined template with a service

associate-a-predefined-template-with-a-service page anchor

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.
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createService() {
11
const service = await client.verify.v2.services.create({
12
defaultTemplateSid: "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
13
friendlyName: "My Verify Service",
14
});
15
16
console.log(service.sid);
17
}
18
19
createService();

Output

1
{
2
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "My Verify Service",
5
"code_length": 4,
6
"lookup_enabled": false,
7
"psd2_enabled": false,
8
"skip_sms_to_landlines": false,
9
"dtmf_input_required": false,
10
"tts_name": "name",
11
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"do_not_share_warning_enabled": false,
13
"custom_code_enabled": true,
14
"push": {
15
"include_date": false,
16
"apn_credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
17
"fcm_credential_sid": null
18
},
19
"totp": {
20
"issuer": "test-issuer",
21
"time_step": 30,
22
"code_length": 3,
23
"skew": 2
24
},
25
"whatsapp": {
26
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"from": "whatsapp:+1234567890"
28
},
29
"default_template_sid": "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
30
"verify_event_subscription_enabled": false,
31
"date_created": "2015-07-30T20:00:00Z",
32
"date_updated": "2015-07-30T20:00:00Z",
33
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
"links": {
35
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
36
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
37
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
38
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
39
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
40
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
41
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
42
}
43
}
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createService() {
11
const service = await client.verify.v2.services.create({
12
friendlyName: "Owl Banking",
13
psd2Enabled: true,
14
});
15
16
console.log(service.psd2Enabled);
17
}
18
19
createService();

Output

1
{
2
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "Owl Banking",
5
"code_length": 4,
6
"lookup_enabled": false,
7
"psd2_enabled": true,
8
"skip_sms_to_landlines": false,
9
"dtmf_input_required": false,
10
"tts_name": "name",
11
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"do_not_share_warning_enabled": false,
13
"custom_code_enabled": true,
14
"push": {
15
"include_date": false,
16
"apn_credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
17
"fcm_credential_sid": null
18
},
19
"totp": {
20
"issuer": "test-issuer",
21
"time_step": 30,
22
"code_length": 3,
23
"skew": 2
24
},
25
"whatsapp": {
26
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"from": "whatsapp:+1234567890"
28
},
29
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
30
"verify_event_subscription_enabled": false,
31
"date_created": "2015-07-30T20:00:00Z",
32
"date_updated": "2015-07-30T20:00:00Z",
33
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
"links": {
35
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
36
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
37
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
38
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
39
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
40
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
41
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
42
}
43
}

See Verifying Transactions for PSD2 for more information.


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

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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchService() {
11
const service = await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.fetch();
14
15
console.log(service.sid);
16
}
17
18
fetchService();

Output

1
{
2
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "name",
5
"code_length": 4,
6
"lookup_enabled": false,
7
"psd2_enabled": false,
8
"skip_sms_to_landlines": false,
9
"dtmf_input_required": false,
10
"tts_name": "name",
11
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"do_not_share_warning_enabled": false,
13
"custom_code_enabled": true,
14
"push": {
15
"include_date": false,
16
"apn_credential_sid": null,
17
"fcm_credential_sid": null
18
},
19
"totp": {
20
"issuer": null,
21
"time_step": null,
22
"code_length": null,
23
"skew": null
24
},
25
"whatsapp": {
26
"msg_service_sid": null,
27
"from": null
28
},
29
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
30
"verify_event_subscription_enabled": false,
31
"date_created": "2015-07-30T20:00:00Z",
32
"date_updated": "2015-07-30T20:00:00Z",
33
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
"links": {
35
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
36
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
37
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
38
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
39
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
40
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
41
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
42
}
43
}

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

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.

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

Output

1
{
2
"meta": {
3
"page": 0,
4
"page_size": 50,
5
"first_page_url": "https://verify.twilio.com/v2/Services?PageSize=50&Page=0",
6
"previous_page_url": null,
7
"next_page_url": null,
8
"key": "services",
9
"url": "https://verify.twilio.com/v2/Services?PageSize=50&Page=0"
10
},
11
"services": [
12
{
13
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
15
"friendly_name": "name",
16
"code_length": 4,
17
"lookup_enabled": false,
18
"psd2_enabled": false,
19
"skip_sms_to_landlines": false,
20
"dtmf_input_required": false,
21
"tts_name": "name",
22
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
23
"do_not_share_warning_enabled": false,
24
"custom_code_enabled": true,
25
"push": {
26
"include_date": false,
27
"apn_credential_sid": null,
28
"fcm_credential_sid": null
29
},
30
"totp": {
31
"issuer": null,
32
"time_step": null,
33
"code_length": null,
34
"skew": null
35
},
36
"whatsapp": {
37
"msg_service_sid": null,
38
"from": null
39
},
40
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
41
"verify_event_subscription_enabled": false,
42
"date_created": "2015-07-30T20:00:00Z",
43
"date_updated": "2015-07-30T20:00:00Z",
44
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
45
"links": {
46
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
47
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
48
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
49
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
50
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
51
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
52
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
53
}
54
}
55
]
56
}

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.

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
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
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.


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

associate-a-template-with-an-existing-service page anchor

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.
1
curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
2
--data-urlencode "DefaultTemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
3
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Output

1
{
2
"sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
4
"friendly_name": "name",
5
"code_length": 7,
6
"lookup_enabled": false,
7
"psd2_enabled": false,
8
"skip_sms_to_landlines": false,
9
"dtmf_input_required": false,
10
"tts_name": "name",
11
"do_not_share_warning_enabled": false,
12
"custom_code_enabled": true,
13
"push": {
14
"include_date": true,
15
"apn_credential_sid": null,
16
"fcm_credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
17
},
18
"totp": {
19
"issuer": "test-issuer",
20
"time_step": 30,
21
"code_length": 3,
22
"skew": 2
23
},
24
"date_created": "2015-07-30T20:00:00Z",
25
"date_updated": "2015-07-30T20:00:00Z",
26
"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
27
"links": {
28
"verification_checks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VerificationCheck",
29
"verifications": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications",
30
"rate_limits": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits",
31
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations",
32
"entities": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities",
33
"webhooks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
34
"access_tokens": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens"
35
}
36
}
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateService() {
11
const service = await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.update({ codeLength: 7 });
14
15
console.log(service.codeLength);
16
}
17
18
updateService();

Output

1
{
2
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "name",
5
"code_length": 7,
6
"lookup_enabled": false,
7
"psd2_enabled": false,
8
"skip_sms_to_landlines": false,
9
"dtmf_input_required": false,
10
"tts_name": "name",
11
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"do_not_share_warning_enabled": false,
13
"custom_code_enabled": true,
14
"push": {
15
"include_date": false,
16
"apn_credential_sid": null,
17
"fcm_credential_sid": "CRbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
18
},
19
"totp": {
20
"issuer": "test-issuer",
21
"time_step": 30,
22
"code_length": 3,
23
"skew": 2
24
},
25
"whatsapp": {
26
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"from": "whatsapp:+1234567890"
28
},
29
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
30
"verify_event_subscription_enabled": false,
31
"date_created": "2015-07-30T20:00:00Z",
32
"date_updated": "2015-07-30T20:00:00Z",
33
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
"links": {
35
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
36
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
37
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
38
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
39
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
40
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
41
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
42
}
43
}
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateService() {
11
const service = await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.update({ friendlyName: "New and Improved Service Name" });
14
15
console.log(service.friendlyName);
16
}
17
18
updateService();

Output

1
{
2
"sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "New and Improved Service Name",
5
"code_length": 4,
6
"lookup_enabled": false,
7
"psd2_enabled": false,
8
"skip_sms_to_landlines": false,
9
"dtmf_input_required": false,
10
"tts_name": "name",
11
"mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"do_not_share_warning_enabled": false,
13
"custom_code_enabled": true,
14
"push": {
15
"include_date": false,
16
"apn_credential_sid": null,
17
"fcm_credential_sid": "CRbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
18
},
19
"totp": {
20
"issuer": "test-issuer",
21
"time_step": 30,
22
"code_length": 3,
23
"skew": 2
24
},
25
"whatsapp": {
26
"msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"from": "whatsapp:+1234567890"
28
},
29
"default_template_sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
30
"verify_event_subscription_enabled": false,
31
"date_created": "2015-07-30T20:00:00Z",
32
"date_updated": "2015-07-30T20:00:00Z",
33
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
"links": {
35
"verification_checks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck",
36
"verifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications",
37
"rate_limits": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits",
38
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations",
39
"entities": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities",
40
"webhooks": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",
41
"access_tokens": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens"
42
}
43
}

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

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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteService() {
11
await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.remove();
14
}
15
16
deleteService();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.