Templates
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 .
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 name Type PII Description
A 34 character string that uniquely identifies a Verification Template.
Pattern: ^HJ[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique SID identifier of the Account.
Pattern: ^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A descriptive string that you create to describe a Template. It can be up to 32 characters long.
A list of channels that support the Template. Can include: sms, voice.
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 https://verify.twilio.com/v2/Templates
Property name Type Required PII Description
FriendlyName string Optional String filter used to query templates with a given friendly name.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Minimum: 1
Maximum: 1000
The page index. This value is simply for client state.
Minimum: 0
The page token. This is provided by the API.
Returns pre-approved and custom templates for your account
_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 // 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 async function listVerificationTemplate() {
_16 const templates = await client.verify.v2.templates.list({ limit: 20 });
_16 templates.forEach((t) => console.log(t.translations));
_16 listVerificationTemplate();
_50 "sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_50 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_50 "friendly_name": "Base Verification Template 2 with do not share",
_50 "is_default_translation": true,
_50 "status": "approved",
_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 "sid": "HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
_50 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_50 "friendly_name": "Base Verification Template 3",
_50 "is_default_translation": true,
_50 "status": "approved",
_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 "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,
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}'
To set a default template for a new Service, set the default_template_sid
parameter:
_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 // 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 async function createService() {
_19 const service = await client.verify.v2.services.create({
_19 defaultTemplateSid: "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19 friendlyName: "My Verify Service",
_19 console.log(service.sid);
_43 "sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43 "friendly_name": "My Verify Service",
_43 "lookup_enabled": false,
_43 "psd2_enabled": false,
_43 "skip_sms_to_landlines": false,
_43 "dtmf_input_required": false,
_43 "mailer_sid": "MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43 "do_not_share_warning_enabled": false,
_43 "custom_code_enabled": true,
_43 "include_date": false,
_43 "apn_credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43 "fcm_credential_sid": null
_43 "issuer": "test-issuer",
_43 "msg_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_43 "from": "whatsapp:+1234567890"
_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 "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"
To send a verification with a specified template, include the TemplateSid (starts with HJ) as a parameter.
_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 // 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 async function createVerification() {
_22 const verification = await client.verify.v2
_22 .services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_22 .verifications.create({
_22 templateSid: "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_22 console.log(verification.status);
_23 "sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "to": "+15017122661",
_23 "date_created": "2015-07-30T20:00:00Z",
_23 "date_updated": "2015-07-30T20:00:00Z",
_23 "send_code_attempts": [
_23 "time": "2015-07-30T20:00:00Z",
_23 "attempt_sid": "VLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_23 "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications/VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"