Skip to contentSkip to navigationSkip to topbar
On this page

End-Users Resource


(warning)

Warning

The v2 Regulatory Compliance APIs are currently in Public Beta. No breaking changes in the API contract will occur when the API moves from Public Beta to GA.

The Twilio End-User REST API allows you to create End-Users to follow Regulations. The End-User is the entity that answers the phone call or receives the message of a phone number. An entity can be either an individual or a business. You can find more information about the possible End-Users by referencing End-User Type resource.

You will Assign Items to an End-User of a Regulatory Bundle with Supporting Documents. For applications that manage many End-Users, you will need to ensure that you assign the End-User instance to the correct Bundle instance to be in compliance with regulations.


End-User Response Properties

end-user-response-properties page anchor

The fields of the End-User resource response is in JSON. The type SID<IT> is a unique ID starting with letters IT. For more information about Twilio SIDs, please refer to Twilio's glossary on SIDs.

Property nameTypeRequiredDescriptionChild properties
sidSID<IT>

Optional

Not PII

The unique string created by Twilio to identify the End User resource.

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

account_sidSID<AC>

Optional

The SID of the Account that created the End User resource.

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

friendly_namestring

Optional

The string that you assigned to describe the resource.


typeenum<string>

Optional

The type of end user of the Bundle resource - can be individual or business.

Possible values:
individualbusiness

attributesobject

Optional

PII MTL: 30 days

The set of parameters that are the attributes of the End Users resource which are listed in the End User Types.


date_updatedstring<date-time>

Optional

The date and time in GMT when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


urlstring<uri>

Optional

The absolute URL of the End User resource.


POST https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers

To provision or port a phone number to Twilio, you will need to create a new End-User of a phone number.

The End-User is the individual or business who answers the phone call or receives the message.

You will need to assign the End-User to a Regulatory Bundle and that Regulatory Bundle assigned to a Phone Number.

Request body parameters

request-body-parameters page anchor
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
FriendlyNamestringrequired

The string that you assigned to describe the resource.


Typeenum<string>required

The type of end user of the Bundle resource - can be individual or business.

Possible values:
individualbusiness

Attributesobject

Optional

The set of parameters that are the attributes of the End User resource which are derived End User Types.

Create a new End-UserLink to code sample: Create a new End-User
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 createEndUser() {
11
const endUser = await client.numbers.v2.regulatoryCompliance.endUsers.create({
12
attributes: {
13
business_name: "Twilio",
14
vat: "2348132",
15
business_description: "Communications Platform as a Service",
16
},
17
friendlyName: "Twilio, Inc.",
18
type: "business",
19
});
20
21
console.log(endUser.sid);
22
}
23
24
createEndUser();

Output

1
{
2
"sid": "ITaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "Twilio, Inc.",
5
"type": "business",
6
"attributes": {
7
"email": "[email protected]"
8
},
9
"date_created": "2019-07-30T21:57:45Z",
10
"date_updated": "2019-07-30T21:57:45Z",
11
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers/ITaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
12
}

Note: the EndUserType must be either individual or business.


Fetch an End-User Instance

fetch-an-end-user-instance page anchor
GET https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IT>required

The unique string created by Twilio to identify the End User resource.

Pattern: ^IT[0-9a-fA-F]{32}$Min length: 34Max length: 34
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 fetchEndUser() {
11
const endUser = await client.numbers.v2.regulatoryCompliance
12
.endUsers("ITaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.fetch();
14
15
console.log(endUser.sid);
16
}
17
18
fetchEndUser();

Output

1
{
2
"sid": "ITaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "friendly_name",
5
"type": "individual",
6
"attributes": {
7
"email": "[email protected]"
8
},
9
"date_created": "2019-07-30T21:57:45Z",
10
"date_updated": "2019-07-30T21:57:45Z",
11
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers/ITaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
12
}

GET https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers

Property nameTypeRequiredPIIDescription
PageSizeinteger

Optional

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

Minimum: 1Maximum: 1000

Pageinteger

Optional

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

Minimum: 0

PageTokenstring

Optional

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 listEndUser() {
11
const endUsers = await client.numbers.v2.regulatoryCompliance.endUsers.list({
12
limit: 20,
13
});
14
15
endUsers.forEach((e) => console.log(e.sid));
16
}
17
18
listEndUser();

Output

1
{
2
"results": [],
3
"meta": {
4
"page": 0,
5
"page_size": 50,
6
"first_page_url": "https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers?PageSize=50&Page=0",
7
"previous_page_url": null,
8
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers?PageSize=50&Page=0",
9
"next_page_url": null,
10
"key": "results"
11
}
12
}

Update an End-User instance

update-an-end-user-instance page anchor
POST https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IT>required

The unique string created by Twilio to identify the End User resource.

Pattern: ^IT[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
FriendlyNamestring

Optional

The string that you assigned to describe the resource.


Attributesobject

Optional

The set of parameters that are the attributes of the End User resource which are derived End User Types.

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 updateEndUser() {
11
const endUser = await client.numbers.v2.regulatoryCompliance
12
.endUsers("ITaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.update({
14
attributes: {
15
email: "[email protected]",
16
first_name: "Jeff",
17
},
18
friendlyName: "Twilio",
19
});
20
21
console.log(endUser.sid);
22
}
23
24
updateEndUser();

Output

1
{
2
"sid": "ITaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"friendly_name": "Twilio",
5
"type": "individual",
6
"attributes": {
7
"email": "[email protected]"
8
},
9
"date_created": "2019-07-30T21:57:45Z",
10
"date_updated": "2019-07-30T21:57:45Z",
11
"url": "https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers/ITaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
12
}

Delete an End-User instance

delete-an-end-user-instance page anchor
DELETE https://numbers.twilio.com/v2/RegulatoryCompliance/EndUsers/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IT>required

The unique string created by Twilio to identify the End User resource.

Pattern: ^IT[0-9a-fA-F]{32}$Min length: 34Max length: 34
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 deleteEndUser() {
11
await client.numbers.v2.regulatoryCompliance
12
.endUsers("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
13
.remove();
14
}
15
16
deleteEndUser();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.