Skip to contentSkip to navigationSkip to topbar
On this page

Regulation Resource



Regulations Response Properties

regulations-response-properties page anchor

The Twilio Regulatory Compliance REST API allows you to view and understand Regulations. Regulations are requirements based on End-Users and Supporting Documents set for by each country's government.

A Regulation dictates the Regulatory Bundles composition of Item Assignments.

(error)

Danger

Regulations can and do change. Please make sure not to hardcode any regulation within your application. The Regulation resource is for you to call and populate the values required for regulatory compliance.

Property nameTypeRequiredDescriptionChild properties
sidSID<RN>Optional
Not PII

The unique string that identifies the Regulation resource.

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

friendly_namestringOptional

A human-readable description that is assigned to describe the Regulation resource. Examples can include Germany: Mobile - Business.


iso_countrystringOptional

The ISO country code of the phone number's country.


number_typestringOptional

The type of phone number restricted by the regulatory requirement. For example, Germany mobile phone numbers provisioned by businesses require a business name with commercial register proof from the Handelsregisterauszug and a proof of address from Handelsregisterauszug or a trade license by Gewerbeanmeldung.


end_user_typeenum<string>Optional

The type of End User the regulation requires - can be individual or business.

Possible values:
individualbusiness

requirementsobjectOptional

The SID of an object that holds the regulatory information of the phone number country, phone number type, and end user type.


urlstring<uri>Optional

The absolute URL of the Regulation resource.


Fetch a Regulation Instance

fetch-a-regulation-instance page anchor
GET https://numbers.twilio.com/v2/RegulatoryCompliance/Regulations/{Sid}

A Regulation instance details the End-User Types and values along with Supporting Document Types.

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
SidSID<RN>required

The unique string that identifies the Regulation resource.

Pattern: ^RN[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
IncludeConstraintsbooleanOptional

A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields

Fetch a Regulation InstanceLink to code sample: Fetch a Regulation Instance
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 fetchRegulation() {
11
const regulation = await client.numbers.v2.regulatoryCompliance
12
.regulations("RNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.fetch();
14
15
console.log(regulation.sid);
16
}
17
18
fetchRegulation();

Output

1
{
2
"sid": "RNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"friendly_name": "Australia: Local - Individual",
4
"iso_country": "AU",
5
"number_type": "local",
6
"end_user_type": "individual",
7
"requirements": {
8
"end_user": [
9
{
10
"name": "Individual",
11
"type": "individual",
12
"requirement_name": "individual_info",
13
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Regulations/individual",
14
"fields": [
15
"first_name",
16
"last_name"
17
],
18
"detailed_fields": [
19
{
20
"machine_name": "first_name",
21
"friendly_name": "First Name",
22
"description": "First name of the Individual"
23
},
24
{
25
"machine_name": "last_name",
26
"friendly_name": "Last Name",
27
"description": "Last name of the Individual"
28
}
29
]
30
}
31
],
32
"supporting_document": [
33
[
34
{
35
"name": "Address",
36
"type": "document",
37
"requirement_name": "proof_of_address",
38
"description": "The physical location of the individual or business. Must be within locality or region covered by the phone numbers prefix; a PO Box is not acceptable where a local address is required.",
39
"accepted_documents": [
40
{
41
"name": "Address Validation",
42
"type": "address",
43
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/DocumentTypes/address",
44
"fields": [
45
"address_sids"
46
],
47
"detailed_fields": [
48
{
49
"machine_name": "address_sids",
50
"friendly_name": "Address sid(s)",
51
"description": "Address sid of the individual"
52
}
53
]
54
}
55
]
56
}
57
]
58
]
59
},
60
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Regulations/RNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
61
}

Retrieve a list of regulations

retrieve-a-list-of-regulations page anchor
GET https://numbers.twilio.com/v2/RegulatoryCompliance/Regulations

The Regulations list is extensive and covers all Twilio's countries in the Phone Number Regulations Guidelines(link takes you to an external page).

The Regulations LIST endpoint is filterable by IsoCountry, NumberType, and EndUserType so you can select the correct instance of the collection of regulatory requirements.

Property nameTypeRequiredPIIDescription
EndUserTypeenum<string>Optional

The type of End User the regulation requires - can be individual or business.

Possible values:
individualbusiness

IsoCountrystringOptional

The ISO country code of the phone number's country.


NumberTypestringOptional

The type of phone number that the regulatory requiremnt is restricting.


IncludeConstraintsbooleanOptional

A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields


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 listRegulation() {
11
const regulations =
12
await client.numbers.v2.regulatoryCompliance.regulations.list({
13
endUserType: "individual",
14
isoCountry: "au",
15
numberType: "local",
16
limit: 20,
17
});
18
19
regulations.forEach((r) => console.log(r.sid));
20
}
21
22
listRegulation();

Output

1
{
2
"results": [
3
{
4
"sid": "RNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"friendly_name": "Australia: Local - Individual",
6
"iso_country": "AU",
7
"number_type": "local",
8
"end_user_type": "individual",
9
"requirements": {
10
"end_user": [
11
{
12
"name": "Individual",
13
"type": "individual",
14
"requirement_name": "individual_info",
15
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Regulations/individual",
16
"fields": [
17
"first_name",
18
"last_name"
19
],
20
"detailed_fields": [
21
{
22
"machine_name": "first_name",
23
"friendly_name": "First Name",
24
"description": "First name of the Individual"
25
},
26
{
27
"machine_name": "last_name",
28
"friendly_name": "Last Name",
29
"description": "Last name of the Individual"
30
}
31
]
32
}
33
],
34
"supporting_document": [
35
[
36
{
37
"name": "Address",
38
"type": "document",
39
"requirement_name": "proof_of_address",
40
"description": "The physical location of the individual or business. Must be within locality or region covered by the phone numbers prefix; a PO Box is not acceptable where a local address is required.",
41
"accepted_documents": [
42
{
43
"name": "Address Validation",
44
"type": "address",
45
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/DocumentTypes/address",
46
"fields": [
47
"address_sids"
48
],
49
"detailed_fields": [
50
{
51
"machine_name": "address_sids",
52
"friendly_name": "Address sid(s)",
53
"description": "Address sid of the individual"
54
}
55
]
56
}
57
]
58
}
59
]
60
]
61
},
62
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Regulations/RNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
63
}
64
],
65
"meta": {
66
"page": 0,
67
"page_size": 50,
68
"first_page_url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Regulations?PageSize=50&Page=0",
69
"previous_page_url": null,
70
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Regulations?PageSize=50&Page=0",
71
"next_page_url": null,
72
"key": "results"
73
}
74
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.