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.


ConnectionPolicyTarget Properties

connectionpolicytarget-properties page anchor
Property nameTypePIIDescription
account_sidSID<AC>
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>

The SID of the Connection Policy that owns the Target.

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

sidSID<NE>

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

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

friendly_namestring

The string that you assigned to describe the resource.


targetstring<uri>
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.


priorityinteger

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.


weightinteger

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.


enabledboolean

Whether the target is enabled. The default is true.


date_updatedstring<date-time>

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>

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
Property nameTypeRequiredPIIDescription
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 ConnectionPolicyTarget

create-a-connectionpolicytarget page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.targets
_11
.create({target: 'https://example.com'})
_11
.then(connection_policy_target => console.log(connection_policy_target.sid));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"sid": "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"friendly_name": "friendly_name",
_13
"target": "sip:sip-box.com:1234",
_13
"priority": 1,
_13
"weight": 20,
_13
"enabled": true,
_13
"date_created": "2020-03-18T23:31:36Z",
_13
"date_updated": "2020-03-18T23:31:36Z",
_13
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_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

Fetch a ConnectionPolicyTarget

fetch-a-connectionpolicytarget page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(connection_policy_target => console.log(connection_policy_target.friendlyName));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"sid": "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"friendly_name": "friendly_name",
_13
"target": "sip:sip-box.com:1234",
_13
"priority": 1,
_13
"weight": 20,
_13
"enabled": true,
_13
"date_created": "2020-03-18T23:31:36Z",
_13
"date_updated": "2020-03-18T23:31:37Z",
_13
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_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.

List multiple ConnectionPolicyTargets

list-multiple-connectionpolicytargets page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.targets
_11
.list({limit: 20})
_11
.then(targets => targets.forEach(t => console.log(t.sid)));

Output

_26
{
_26
"meta": {
_26
"page": 0,
_26
"page_size": 50,
_26
"first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets?PageSize=50&Page=0",
_26
"previous_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets?PageSize=50&Page=0",
_26
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets?PageSize=50&Page=0",
_26
"next_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets?PageSize=50&Page=1",
_26
"key": "targets"
_26
},
_26
"targets": [
_26
{
_26
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"sid": "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"friendly_name": "friendly_name",
_26
"target": "sip:sip-box.com:1234",
_26
"priority": 1,
_26
"weight": 20,
_26
"enabled": true,
_26
"date_created": "2020-03-18T23:31:36Z",
_26
"date_updated": "2020-03-18T23:31:37Z",
_26
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_26
}
_26
]
_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
Property nameTypeRequiredPIIDescription
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.

Update a ConnectionPolicyTarget

update-a-connectionpolicytarget page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.update({friendlyName: 'friendly_name'})
_11
.then(connection_policy_target => console.log(connection_policy_target.friendlyName));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"sid": "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"friendly_name": "updated_name",
_13
"target": "sip:sip-updated.com:4321",
_13
"priority": 2,
_13
"weight": 10,
_13
"enabled": false,
_13
"date_created": "2020-03-18T23:31:36Z",
_13
"date_updated": "2020-03-18T23:31:37Z",
_13
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_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

Delete a ConnectionPolicyTarget

delete-a-connectionpolicytarget page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.remove();


Rate this page: