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.


Property nameTypePIIDescription
sidSID<HJ>
Not PII

A 34 character string that uniquely identifies a Verification Template.

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

account_sidSID<AC>

The unique SID identifier of the Account.

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

friendly_namestring

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


channelsarray[string]

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


translationsobject

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

Query parameters

query-parameters page anchor
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

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


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.

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

_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 listVerificationTemplate() {
_16
const templates = await client.verify.v2.templates.list({ limit: 20 });
_16
_16
templates.forEach((t) => console.log(t.translations));
_16
}
_16
_16
listVerificationTemplate();

Output

_50
{
_50
"templates": [
_50
{
_50
"sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_50
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
_50
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": null,
_50
"url": "https://verify.twilio.com/v2/Templates?PageSize=50&Page=0",
_50
"next_page_url": null,
_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

_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
}

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

_22
// Download the helper library from https://www.twilio.com/docs/node/install
_22
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_22
_22
// Find your Account SID and Auth Token at twilio.com/console
_22
// and set the environment variables. See http://twil.io/secure
_22
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_22
const authToken = process.env.TWILIO_AUTH_TOKEN;
_22
const client = twilio(accountSid, authToken);
_22
_22
async function createVerification() {
_22
const verification = await client.verify.v2
_22
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_22
.verifications.create({
_22
channel: "sms",
_22
templateSid: "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_22
to: "+15017122661",
_22
});
_22
_22
console.log(verification.status);
_22
}
_22
_22
createVerification();

Output

_23
{
_23
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "VLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_23
}
_23
],
_23
"sna": null,
_23
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications/VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_23
}


Rate this page: