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

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_createdstring<date-time>

date_updatedstring<date-time>

The date and time in GMT when the resource was last updated specified in RFC 2822 format.


urlstring<uri>

The absolute URL of the resource.


Create a ConnectionPolicyTarget resource

POST https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets

Path parameters

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

Request body parameters

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

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function createConnectionPolicyTarget() {
_18
const target = await client.voice.v1
_18
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.targets.create({ target: "https://www.example.com" });
_18
_18
console.log(target.accountSid);
_18
}
_18
_18
createConnectionPolicyTarget();

Output

_13
{
_13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"friendly_name": "friendly_name",
_13
"target": "https://www.example.com",
_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/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_13
}


Fetch a ConnectionPolicyTarget resource

GET https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

Path parameters

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

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function fetchConnectionPolicyTarget() {
_19
const target = await client.voice.v1
_19
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.targets("NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.fetch();
_19
_19
console.log(target.accountSid);
_19
}
_19
_19
fetchConnectionPolicyTarget();

Output

_13
{
_13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_13
}


Read multiple ConnectionPolicyTarget resources

GET https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets

Path parameters

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

Query parameters

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

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function listConnectionPolicyTarget() {
_18
const targets = await client.voice.v1
_18
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.targets.list({ limit: 20 });
_18
_18
targets.forEach((t) => console.log(t.accountSid));
_18
}
_18
_18
listConnectionPolicyTarget();

Output

_26
{
_26
"meta": {
_26
"page": 0,
_26
"page_size": 50,
_26
"first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets?PageSize=50&Page=0",
_26
"previous_page_url": null,
_26
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets?PageSize=50&Page=0",
_26
"next_page_url": null,
_26
"key": "targets"
_26
},
_26
"targets": [
_26
{
_26
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_26
"connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_26
"sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_26
}
_26
]
_26
}


Update a ConnectionPolicyTarget resource

POST https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

Path parameters

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

Request body parameters

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

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function updateConnectionPolicyTarget() {
_19
const target = await client.voice.v1
_19
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.targets("NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.update({ friendlyName: "FriendlyName" });
_19
_19
console.log(target.accountSid);
_19
}
_19
_19
updateConnectionPolicyTarget();

Output

_13
{
_13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"sid": "NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"friendly_name": "FriendlyName",
_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/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets/NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_13
}


Delete a ConnectionPolicyTarget resource

DELETE https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

Path parameters

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

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_17
// Download the helper library from https://www.twilio.com/docs/node/install
_17
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_17
_17
// Find your Account SID and Auth Token at twilio.com/console
_17
// and set the environment variables. See http://twil.io/secure
_17
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17
const authToken = process.env.TWILIO_AUTH_TOKEN;
_17
const client = twilio(accountSid, authToken);
_17
_17
async function deleteConnectionPolicyTarget() {
_17
await client.voice.v1
_17
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17
.targets("NEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17
.remove();
_17
}
_17
_17
deleteConnectionPolicyTarget();


Rate this page: