Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Templates


(information)

Verify Templates are in Public Beta!

Pre-approved and custom templates are currently in the Public Beta maturity stage, which means that:

We're actively looking for early-adopter customers to try it out and give us feedback. That could be you!

Please note that pre-approved and custom templates are only supported with the SMS and Voice channels.

Templates are predefined and approved messages used to send Verifications that allow you to customize the Verification message. An account can have multiple templates associated with it to accommodate various scenarios.

Verify offers three different types of templates to support your use cases: Verify Default, pre-approved, and custom. Read more about the features and differences of these template types here.


Template translations and supported languages

template-translations-and-supported-languages page anchor

Verify will automatically resolve a template message body's locale based on phone number country code or fallback to English or a custom template's default language. Using this automatic resolution is highly recommended. If you still must override locale, use the locale parameter. Learn more about supported languages here.


Resource properties
sidtype: SID<HJ>Not PII

A 34 character string that uniquely identifies a Verification Template.


account_sidtype: SID<AC>Not PII

The unique SID identifier of the Account.


friendly_nametype: stringNot PII

A descriptive string that you create to describe a Template. It can be up to 32 characters long.


channelstype: string[]Not PII

A list of channels that support the Template. Can include: sms, voice.


translationstype: objectNot PII

An object that contains the different translations of the template. Every translation is identified by the language short name and contains its respective information as the approval status, text and created/modified date.


Get a list of available templates

get-a-list-of-available-templates page anchor
GET https://verify.twilio.com/v2/Templates

Parameters

list-parameters page anchor
URI parameters
FriendlyNametype: stringNot PII
Query Parameter

String filter used to query templates with a given friendly name.


PageSizetype: integerNot PII
Query Parameter

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


Pagetype: integerNot PII
Query Parameter

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


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

Get a list of available templates

get-a-list-of-available-templates-1 page anchor

Returns pre-approved and custom templates for your account

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.verify.v2.templates
_10
.list({limit: 20})
_10
.then(templates => templates.forEach(t => console.log(t.translations)));

Output

_50
{
_50
"templates": [
_50
{
_50
"sid": "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_50
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_50
"friendly_name": "Base Verification Template 2 with do not share",
_50
"channels": [
_50
"sms"
_50
],
_50
"translations": {
_50
"en": {
_50
"is_default_translation": true,
_50
"status": "approved",
_50
"locale": "en",
_50
"text": "Your {{friendly_name}} verification code is: {{code}}. Do not share this code with anyone.",
_50
"date_updated": "2021-07-29T20:38:28.759979905Z",
_50
"date_created": "2021-07-29T20:38:28.165602325Z"
_50
}
_50
}
_50
},
_50
{
_50
"sid": "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_50
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_50
"friendly_name": "Base Verification Template 3",
_50
"channels": [
_50
"sms",
_50
"voice"
_50
],
_50
"translations": {
_50
"en": {
_50
"is_default_translation": true,
_50
"status": "approved",
_50
"locale": "en",
_50
"text": "Your verification code is: {{code}}. Do not share it.",
_50
"date_updated": "2021-07-29T20:38:28.759979905Z",
_50
"date_created": "2021-07-29T20:38:28.165602325Z"
_50
}
_50
}
_50
}
_50
],
_50
"meta": {
_50
"page": 0,
_50
"page_size": 50,
_50
"first_page_url": "https://verify.twilio.com/v2/Templates?PageSize=50&Page=0",
_50
"previous_page_url": "https://verify.twilio.com/v2/Templates?PageSize=50&Page=0",
_50
"url": "https://verify.twilio.com/v2/Templates?PageSize=50&Page=0",
_50
"next_page_url": "https://verify.twilio.com/v2/Templates?PageSize=50&Page=1",
_50
"key": "templates"
_50
}
_50
}

(information)

Tip

If you have jq(link takes you to an external page) installed you can quickly see all of the English language templates with the following command:


_10
curl -X GET "https://verify.twilio.com/v2/Templates" \
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \
_10
| jq '.templates[] | {sid: .sid, template: .translations.en.text}'

Set a default template for your Verify Service

set-a-default-template-for-your-verify-service page anchor

To set a default template for a new Service, set the default_template_sid parameter:

Create a Service with a default template

create-a-service-with-a-default-template page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

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

Output

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

Start a Verification with a specific template

start-a-verification-with-a-specific-template page anchor

To send a verification with a specified template, include the TemplateSid (starts with HJ) as a parameter.

Start a Verification with a template

start-a-verification-with-a-template page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = require('twilio')(accountSid, authToken);
_15
_15
client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_15
.verifications
_15
.create({
_15
templateSid: 'HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_15
to: '+15017122661',
_15
channel: 'sms'
_15
})
_15
.then(verification => console.log(verification.status));

Output

_23
{
_23
"sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"to": "+15017122661",
_23
"channel": "sms",
_23
"status": "pending",
_23
"valid": false,
_23
"date_created": "2015-07-30T20:00:00Z",
_23
"date_updated": "2015-07-30T20:00:00Z",
_23
"lookup": {},
_23
"amount": null,
_23
"payee": null,
_23
"send_code_attempts": [
_23
{
_23
"time": "2015-07-30T20:00:00Z",
_23
"channel": "SMS",
_23
"attempt_sid": "VLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_23
}
_23
],
_23
"sna": null,
_23
"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications/VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_23
}


Rate this page: