Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this page
Looking for more inspiration?Visit the

Get started with Toll-Free Verification Compliance Embed


(new)

Compliance Embed in Public Beta

Compliance Embed is currently available for this program as a Public Beta product and the information contained in this document is subject to change. This means that some features are not yet implemented and others may be changed before the product is declared as Generally Available. Public Beta products are not covered by a Twilio SLA.

To use the Compliance Embeddable API, request access(link takes you to an external page).

Before sending messages to toll-free numbers that use the North American Numbering Plan (NANP)(link takes you to an external page), mobile carriers must approve these numbers. This process is called Toll-Free Verification (TFV). Carriers might filter or block unverified toll-free numbers.

To allow the end customers of an Independent Software Vendor (ISV) to comply with regulations, Twilio provides the Compliance Embed solution. The Compliance Embed provides an unbranded, self-service solution designed to integrate seamlessly into an ISV-hosted web app. This solution starts a session with Twilio that manages the registration form rendering and data collection for an ISV. The ISV then renders this self-service form to their end customer through their own web app. The end customer completes the form in the web app which sends the compliance data and request to Twilio.

To allow the end customers of an Independent Software Vendor (ISV) to comply with regulations, Twilio provides the Compliance Embed solution. The Compliance Embed provides an unbranded, self-service solution designed to integrate seamlessly into an ISV-hosted web app.

To create this self-service experience, ISVs complete the following activities:

  1. From their servers, the ISV calls the Twilio ComplianceInquiry Initialize API resource. This returns a session token and session ID.
  2. In their web app, the ISV creates a React component or JavaScript instance that renders a form in an iframe tag. This form connects to the compliance inquiry in Twilio through the ID and token.
  3. The end customer completes and submits their compliance request through the ISV web app.
  4. If it succeeds, the end customer can send messages. If it fails, the end customer can, in most cases, resubmit their request through the ISV's web app.

Prerequisites

prerequisites page anchor

Before you begin, complete the following tasks:

  1. Create a paid Twilio account(link takes you to an external page), if needed. You can't use a trial account.
  2. Get an approved Trust Hub Primary Customer Profile in the Twilio Console(link takes you to an external page) with a Business Identity of ISV or Reseller.
  3. Add Persona(link takes you to an external page) to the allow list on your firewall. To manage compliance, Twilio uses this service.
  4. Create a Content Security Policy (CSP)(link takes you to an external page) for your web app as another layer of security.

Authenticate with Twilio API

authenticate-with-twilio-api page anchor

You must authenticate all requests using Twilio's REST API credentials with HTTP Basic Auth.

  • Use your account SID as the username and your token as the password.
  • The account SID can be either your primary Twilio Account SID or a subaccount SID.

After your ComplianceInquiry completes, the TFV registration ID contains the Account SID that you provided in your credentials. This binds this TFV to that Account.


Initialize one TFV ComplianceInquiry

init page anchor

This request initializes a ComplianceInquiry and returns a session ID and token. To authenticate subsequent end customer submissions, you add this session and token into your web app that renders a submission form.

To initialize a TFV ComplianceInquiry, make an HTTPS POST request to the following API resource:

POST https://trusthub.twilio.com/v1/ComplianceInquiries/Tollfree/Initialize

If you provide any optional parameters, their values appear in the subsequent forms in the end customer's web app.

When using this API resource, include two optional parameters: BusinessRegistrationAuthority and BusinessCountry. These set default registration information for your end customers. Depending on your country, use the following parameters:

Country of originUS-based entitiesCanada-based entities
Registration AuthorityEmployer Identification Number (EIN)(link takes you to an external page)Canadian Business Number (CBN)(link takes you to an external page)
BusinessRegistrationAuthorityEINCBN
BusinessCountryUSCA
Initialize ComplianceInquiry API for Toll-Free VerificationLink to code sample: Initialize ComplianceInquiry API for Toll-Free Verification
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 createComplianceTollfreeInquiry() {
11
const complianceTollfreeInquiry =
12
await client.trusthub.v1.complianceTollfreeInquiries.create({
13
businessCountry: "US",
14
businessRegistrationAuthority: "EIN",
15
notificationEmail: "dean@twilio.com",
16
tollfreePhoneNumber: "+800445566",
17
});
18
19
console.log(complianceTollfreeInquiry.inquiryId);
20
}
21
22
createComplianceTollfreeInquiry();

Response

Note about this response
1
{
2
"inquiry_id": "inq_aaaaaaaaaaaaaaaaaaaaaaaa",
3
"inquiry_session_token": "new.session.token",
4
"registration_id": "tri1.us1.trusthub.ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tollfree.PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"url": "https://trusthub.twilio.com/v1/ComplianceInquiries/Tollfree/Initialize"
6
}

How to read the Registration ID

reg-id page anchor

The value of the id property contains two SIDs: tri1.us1.account.{$TWILIO_ACCOUNT_SID}.registration.{$TF_PHONE_NUMBER_SID}.

If the id property returns a value of tri1.us1.account.ACaa..aa.registration.PNnn..nn, this means this registration links to both the Account SID ACaa..aa and the Toll-Free Phone Number SID PNnn..nn.

When you check the status of this registration, search for an tollfree_phone_number_sid that matches PNnn..nn.


Review status of TFV requests

check page anchor

To check the status of a TFV request, make a GET request and retrieve a list of TFV requests.

Registration process status

registration-process-status page anchor

A brand or campaign registration moves through the following statuses. In certain statuses, you can resubmit a failed registration or resume an in-progress registration.

What you can do with a registration, including whether the Compliance Embed will let you resume or resubmit it, depends on its current status:

Status valueRegistration progressCan resume?Can resubmit?
DRAFTStarted, but not submitted for review.YesNo
PENDING or PENDING_REVIEWSubmitted.NoNo
IN_REVIEWSubmitted and Twilio, TCR, or both are reviewing the registration.NoNo
APPROVED or TWILIO_APPROVEDPassed review.NoNo
REJECTED or TWILIO_REJECTEDFailed review for a correctable reason.NoYes

Fetch list of all TFV requests

fetch-list-of-all-tfv-requests page anchor

To find the needed TFV request, make an HTTPS GET request to the TFV resource in the Messaging API. This request returns all TFV requests attached to the Account SID in the API credentials.

GET https://messaging.twilio.com/v1/Tollfree/Verifications

This list includes all TFV requests, including their phone number SIDs in the tollfree_phone_number_sid property.

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 at twilio.com/console
5
// Provision API Keys at twilio.com/console/runtime/api-keys
6
// and set the environment variables. See http://twil.io/secure
7
// For local testing, you can use your Account SID and Auth token
8
const accountSid = process.env.TWILIO_ACCOUNT_SID;
9
const apiKey = process.env.TWILIO_API_KEY;
10
const apiSecret = process.env.TWILIO_API_SECRET;
11
const client = twilio(apiKey, apiSecret, { accountSid: accountSid });
12
13
async function listTollfreeVerification() {
14
const tollfreeVerifications =
15
await client.messaging.v1.tollfreeVerifications.list({ limit: 20 });
16
17
tollfreeVerifications.forEach((t) => console.log(t.sid));
18
}
19
20
listTollfreeVerification();

Response

Note about this response
1
{
2
"meta": {
3
"page": 0,
4
"page_size": 50,
5
"first_page_url": "https://messaging.twilio.com/v1/Tollfree/Verifications?Status=TWILIO_APPROVED&ExternalReferenceId=abc123xyz567&TollfreePhoneNumberSid=PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&IncludeSubAccounts=false&PageSize=50&Page=0",
6
"previous_page_url": null,
7
"next_page_url": null,
8
"key": "verifications",
9
"url": "https://messaging.twilio.com/v1/Tollfree/Verifications?Status=TWILIO_APPROVED&ExternalReferenceId=abc123xyz567&TollfreePhoneNumberSid=PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&IncludeSubAccounts=false&PageSize=50&Page=0"
10
},
11
"verifications": [
12
{
13
"sid": "HHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
15
"customer_profile_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
16
"trust_product_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
17
"regulated_item_sid": "RAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
18
"date_created": "2021-01-27T14:18:35Z",
19
"date_updated": "2021-01-27T14:18:36Z",
20
"business_name": "Owl, Inc.",
21
"business_street_address": "123 Main Street",
22
"business_street_address2": "Suite 101",
23
"business_city": "Anytown",
24
"business_state_province_region": "AA",
25
"business_postal_code": "11111",
26
"business_country": "US",
27
"business_website": "http://www.company.com",
28
"business_contact_first_name": "firstname",
29
"business_contact_last_name": "lastname",
30
"business_contact_email": "email@company.com",
31
"business_contact_phone": "+11231231234",
32
"notification_email": "support@company.com",
33
"use_case_categories": [
34
"TWO_FACTOR_AUTHENTICATION",
35
"MARKETING"
36
],
37
"use_case_summary": "This number is used to send out promotional offers and coupons to the customers of John's Coffee Shop",
38
"production_message_sample": "lorem ipsum",
39
"opt_in_image_urls": [
40
"https://testbusiness.com/images/image1.jpg",
41
"https://testbusiness.com/images/image2.jpg"
42
],
43
"opt_in_type": "VERBAL",
44
"message_volume": "1,000",
45
"additional_information": "see our privacy policy here www.johnscoffeeshop.com/privacypolicy",
46
"tollfree_phone_number_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
47
"status": "TWILIO_APPROVED",
48
"url": "https://messaging.twilio.com/v1/Tollfree/Verifications/HHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
49
"rejection_reason": null,
50
"error_code": null,
51
"edit_expiration": null,
52
"edit_allowed": null,
53
"rejection_reasons": null,
54
"resource_links": {
55
"customer_profile": "https://trusthub.twilio.com/v1/CustomerProfiles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
56
"trust_product": "https://trusthub.twilio.com/v1/TrustProducts/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
57
"channel_endpoint_assignment": "https://trusthub.twilio.com/v1/TrustProducts/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelEndpointAssignments/RAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
58
},
59
"external_reference_id": "abc123xyz567",
60
"business_registration_number": "123456789",
61
"business_registration_authority": "EIN",
62
"business_registration_country": "US",
63
"business_type": "PRIVATE_PROFIT",
64
"business_registration_phone_number": "+13023334444",
65
"doing_business_as": "Toms Widgets",
66
"age_gated_content": false,
67
"help_message_sample": "For help, reply HELP or visit our website.",
68
"opt_in_confirmation_message": "Thank you for opting in!",
69
"opt_in_keywords": [
70
"START"
71
],
72
"privacy_policy_url": "https://www.example.com/privacy",
73
"terms_and_conditions_url": "https://www.example.com/terms",
74
"tollfree_phone_number": "+18003334444",
75
"vetting_id": null,
76
"vetting_id_expiration": null,
77
"vetting_provider": null
78
}
79
]
80
}

To learn more about query parameters for filtering results, see the [TFV request API][get-brand-list].

If you know the TFV request you need, make an HTTPS GET request that includes the TFV request SID to the Toll-Free Verifications resource in the Messaging API.

GET https://messaging.twilio.com/v1/Tollfree/Verifications/{Sid}

This request returns one TFV request as a JSON document.

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 at twilio.com/console
5
// Provision API Keys at twilio.com/console/runtime/api-keys
6
// and set the environment variables. See http://twil.io/secure
7
// For local testing, you can use your Account SID and Auth token
8
const accountSid = process.env.TWILIO_ACCOUNT_SID;
9
const apiKey = process.env.TWILIO_API_KEY;
10
const apiSecret = process.env.TWILIO_API_SECRET;
11
const client = twilio(apiKey, apiSecret, { accountSid: accountSid });
12
13
async function fetchTollfreeVerification() {
14
const tollfreeVerification = await client.messaging.v1
15
.tollfreeVerifications("HHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
16
.fetch();
17
18
console.log(tollfreeVerification.sid);
19
}
20
21
fetchTollfreeVerification();

Response

Note about this response
1
{
2
"sid": "HHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"customer_profile_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"trust_product_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"regulated_item_sid": "RAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"date_created": "2021-01-27T14:18:35Z",
8
"date_updated": "2021-01-27T14:18:36Z",
9
"business_name": "Owl, Inc.",
10
"business_street_address": "123 Main Street",
11
"business_street_address2": "Suite 101",
12
"business_city": "Anytown",
13
"business_state_province_region": "AA",
14
"business_postal_code": "11111",
15
"business_country": "US",
16
"business_website": "http://www.company.com",
17
"business_contact_first_name": "firstname",
18
"business_contact_last_name": "lastname",
19
"business_contact_email": "email@company.com",
20
"business_contact_phone": "+11231231234",
21
"notification_email": "support@company.com",
22
"use_case_categories": [
23
"TWO_FACTOR_AUTHENTICATION",
24
"MARKETING"
25
],
26
"use_case_summary": "This number is used to send out promotional offers and coupons to the customers of John's Coffee Shop",
27
"production_message_sample": "lorem ipsum",
28
"opt_in_image_urls": [
29
"https://testbusiness.com/images/image1.jpg",
30
"https://testbusiness.com/images/image2.jpg"
31
],
32
"opt_in_type": "VERBAL",
33
"message_volume": "2000",
34
"additional_information": "see our privacy policy here www.johnscoffeeshop.com/privacypolicy",
35
"tollfree_phone_number_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
"status": "TWILIO_APPROVED",
37
"rejection_reason": null,
38
"error_code": null,
39
"edit_expiration": null,
40
"edit_allowed": null,
41
"rejection_reasons": null,
42
"resource_links": {
43
"customer_profile": "https://trusthub.twilio.com/v1/CustomerProfiles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
44
"trust_product": "https://trusthub.twilio.com/v1/TrustProducts/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
45
"channel_endpoint_assignment": "https://trusthub.twilio.com/v1/TrustProducts/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelEndpointAssignments/RAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
46
},
47
"url": "https://messaging.twilio.com/v1/Tollfree/Verifications/HHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
48
"external_reference_id": "abc123xyz567",
49
"business_registration_number": "123456789",
50
"business_registration_authority": "EIN",
51
"business_registration_country": "US",
52
"business_type": "PRIVATE_PROFIT",
53
"business_registration_phone_number": "+13023334444",
54
"doing_business_as": "Toms Widgets",
55
"age_gated_content": false,
56
"help_message_sample": "For help, reply HELP or visit our website.",
57
"opt_in_confirmation_message": "Thank you for opting in!",
58
"opt_in_keywords": [
59
"START"
60
],
61
"privacy_policy_url": "https://www.example.com/privacy",
62
"terms_and_conditions_url": "https://www.example.com/terms",
63
"tollfree_phone_number": "+18003334444",
64
"vetting_id": null,
65
"vetting_id_expiration": null,
66
"vetting_provider": null
67
}

Resume or resubmit one TFV ComplianceInquiry

resume-or-resubmit-one-tfv-complianceinquiry page anchor
POST https://trusthub.twilio.com/v1/ComplianceInquiries/Tollfree/Initialize

The Initialize API resource supports both fresh submissions and resumption of existing submissions.

When you make a request for a toll-free number that has an existing incomplete or rejected ComplianceInquiry, the response updates the inquiry_session_token and might update the inquiry_id.

Re-initialize the SDK with the inquiry_id and inquiry_session_token from the latest response. Previously entered data is retained and pre-populated in the form.

If your end customer has a rejected TFV that they can resubmit, have your web app server make another request to the Initialize API resource.

In this request, your end customer can edit their submission and correct any issues.

The embedded form displays any previously accepted data. This allows targeted corrections rather than requiring them to re-enter everything.

If a verification is already in progress, approved, or rejected with an error that cannot be resubmitted, the API returns an error response.

Twilio validates the data in these fields.

Initialize ComplianceInquiry API for Toll-Free VerificationLink to code sample: Initialize ComplianceInquiry API for Toll-Free Verification
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 createComplianceTollfreeInquiry() {
11
const complianceTollfreeInquiry =
12
await client.trusthub.v1.complianceTollfreeInquiries.create({
13
businessName: "Twilio",
14
businessRegistrationAuthority: "EIN",
15
businessRegistrationCountry: "US",
16
businessRegistrationNumber: "12-3456789",
17
businessType: "PRIVATE_PROFIT",
18
businessWebsite: "https://www.twilio.com",
19
notificationEmail: "dean@twilio.com",
20
tollfreePhoneNumber: "+800445566",
21
});
22
23
console.log(complianceTollfreeInquiry.inquiryId);
24
}
25
26
createComplianceTollfreeInquiry();

Response

Note about this response
1
{
2
"inquiry_id": "inq_aaaaaaaaaaaaaaaaaaaaaaaa",
3
"inquiry_session_token": "new.session.token",
4
"registration_id": "tri1.us1.trusthub.ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tollfree.PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"url": "https://trusthub.twilio.com/v1/ComplianceInquiries/Tollfree/Initialize"
6
}

A successful request returns a JSON response body.

Error responses

errors page anchor

The TFV Initialize API resource returns the following errors.

HTTP statusCause
400TollfreePhoneNumber is missing from the request.
400TollfreePhoneNumber isn't a toll-free number.
400TollfreePhoneNumber doesn't belong to your account.
400TollfreePhoneNumber isn't in use on your account.
400NotificationEmail is missing from the request.
400The account is a trial account.
400The account isn't active.
400CustomerProfileSid doesn't exist, isn't TWILIO_APPROVED, is a Starter profile, is your own Primary Customer Profile, or has no Business Identity set.
409The verification isn't eligible for re-submission. It's already in progress, or it was rejected with an error that can't be resubmitted.
500You've reached the session limit of 50 session tokens per inquiry_id, or validating the customer profile failed.

Embed the Compliance form in your app

embed-the-compliance-form-in-your-app page anchor

After you initialize the ComplianceInquiry, embed the form in your app using the Twilio React SDK or the Twilio JavaScript SDK.