Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

ConnectionPolicyTarget Resource


The ConnectionPolicyTarget resource describes the individual URI entries that make up the BYOC Origination ConnectionPolicies list.


Target Properties

target-properties page anchor
Property nameTypeRequiredDescriptionChild properties
account_sidSID<AC>Optional
Not PII

The SID of the Account that created the Target resource.

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

connection_policy_sidSID<NY>Optional

The SID of the Connection Policy that owns the Target.

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

sidSID<NE>Optional

The unique string that we created to identify the Target resource.

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

friendly_namestringOptional

The string that you assigned to describe the resource.


targetstring<uri>Optional
PII MTL: 30 days

The SIP address you want Twilio to route your calls to. This must be a sip: schema. sips is NOT supported.


priorityintegerOptional

The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target.

Default: 0

weightintegerOptional

The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority.

Default: 0

enabledbooleanOptional

Whether the target is enabled. The default is true.


date_updatedstring<date-time>Optional

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


urlstring<uri>Optional

The absolute URL of the resource.


Create a ConnectionPolicyTarget resource

create-a-connectionpolicytarget-resource page anchor
POST https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
ConnectionPolicySidSID<NY>required

The SID of the Connection Policy that owns the Target.

Pattern: ^NY[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
Targetstring<uri>required

The SIP address you want Twilio to route your calls to. This must be a sip: schema. sips is NOT supported.


FriendlyNamestringOptional

A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.


PriorityintegerOptional

The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target.


WeightintegerOptional

The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority.


EnabledbooleanOptional

Whether the Target is enabled. The default is true.

Create a TargetLink to code sample: Create a Target
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 createConnectionPolicyTarget() {
11
const target = await client.voice.v1
12
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.targets.create({ target: "https://www.example.com" });
14
15
console.log(target.accountSid);
16
}
17
18
createConnectionPolicyTarget();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"friendly_name": "friendly_name",
6
"target": "https://www.example.com",
7
"priority": 1,
8
"weight": 20,
9
"enabled": true,
10
"date_created": "2020-03-18T23:31:36Z",
11
"date_updated": "2020-03-18T23:31:36Z",
12
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
13
}

Fetch a ConnectionPolicyTarget resource

fetch-a-connectionpolicytarget-resource page anchor
GET https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

Property nameTypeRequiredPIIDescription
ConnectionPolicySidSID<NY>required

The SID of the Connection Policy that owns the Target.

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

SidSID<NE>required

The unique string that we created to identify the Target resource to fetch.

Pattern: ^NE[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 fetchConnectionPolicyTarget() {
11
const target = await client.voice.v1
12
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.targets("NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.fetch();
15
16
console.log(target.accountSid);
17
}
18
19
fetchConnectionPolicyTarget();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"friendly_name": "friendly_name",
6
"target": "sip:sip-box.com:1234",
7
"priority": 1,
8
"weight": 20,
9
"enabled": true,
10
"date_created": "2020-03-18T23:31:36Z",
11
"date_updated": "2020-03-18T23:31:37Z",
12
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
13
}

Read multiple ConnectionPolicyTarget resources

read-multiple-connectionpolicytarget-resources page anchor
GET https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets

Property nameTypeRequiredPIIDescription
ConnectionPolicySidSID<NY>required

The SID of the Connection Policy from which to read the Targets.

Pattern: ^NY[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
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 listConnectionPolicyTarget() {
11
const targets = await client.voice.v1
12
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.targets.list({ limit: 20 });
14
15
targets.forEach((t) => console.log(t.accountSid));
16
}
17
18
listConnectionPolicyTarget();

Output

1
{
2
"meta": {
3
"page": 0,
4
"page_size": 50,
5
"first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets?PageSize=50&Page=0",
6
"previous_page_url": null,
7
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets?PageSize=50&Page=0",
8
"next_page_url": null,
9
"key": "targets"
10
},
11
"targets": [
12
{
13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
15
"sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
16
"friendly_name": "friendly_name",
17
"target": "sip:sip-box.com:1234",
18
"priority": 1,
19
"weight": 20,
20
"enabled": true,
21
"date_created": "2020-03-18T23:31:36Z",
22
"date_updated": "2020-03-18T23:31:37Z",
23
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
24
}
25
]
26
}

Update a ConnectionPolicyTarget resource

update-a-connectionpolicytarget-resource page anchor
POST https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

Property nameTypeRequiredPIIDescription
ConnectionPolicySidSID<NY>required

The SID of the Connection Policy that owns the Target.

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

SidSID<NE>required

The unique string that we created to identify the Target resource to update.

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

A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.


Targetstring<uri>Optional

The SIP address you want Twilio to route your calls to. This must be a sip: schema. sips is NOT supported.


PriorityintegerOptional

The relative importance of the target. Can be an integer from 0 to 65535, inclusive. The lowest number represents the most important target.


WeightintegerOptional

The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive. Targets with higher values receive more load than those with lower ones with the same priority.


EnabledbooleanOptional

Whether the Target is enabled.

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 updateConnectionPolicyTarget() {
11
const target = await client.voice.v1
12
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.targets("NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.update({ friendlyName: "FriendlyName" });
15
16
console.log(target.accountSid);
17
}
18
19
updateConnectionPolicyTarget();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"friendly_name": "FriendlyName",
6
"target": "sip:sip-updated.com:4321",
7
"priority": 2,
8
"weight": 10,
9
"enabled": false,
10
"date_created": "2020-03-18T23:31:36Z",
11
"date_updated": "2020-03-18T23:31:37Z",
12
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
13
}

Delete a ConnectionPolicyTarget resource

delete-a-connectionpolicytarget-resource page anchor
DELETE https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

Property nameTypeRequiredPIIDescription
ConnectionPolicySidSID<NY>required

The SID of the Connection Policy that owns the Target.

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

SidSID<NE>required

The unique string that we created to identify the Target resource to delete.

Pattern: ^NE[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 deleteConnectionPolicyTarget() {
11
await client.voice.v1
12
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.targets("NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.remove();
15
}
16
17
deleteConnectionPolicyTarget();

Rate this page: