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

ConnectionPolicy Resource


The ConnectionPolicies resource describes a list of URI Entries that are used to route Origination traffic to a PSTN Carrier over a BYOC Trunk.


ConnectionPolicy Properties

Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The SID of the Account that created the Connection Policy resource.

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

sidSID<NY>

The unique string that we created to identify the Connection Policy resource.

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

friendly_namestring

The string that you assigned to describe the resource.


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.


linksobject<uri-map>

The URLs of related resources.


Create a ConnectionPolicy resource

POST https://voice.twilio.com/v1/ConnectionPolicies

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.

Create a ConnectionPolicy

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

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

Output

_11
{
_11
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"friendly_name": "friendly_name",
_11
"date_created": "2020-03-18T23:31:36Z",
_11
"date_updated": "2020-03-18T23:31:36Z",
_11
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"links": {
_11
"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"
_11
}
_11
}


Fetch a ConnectionPolicy resource

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

Path parameters

Property nameTypeRequiredPIIDescription
SidSID<NY>required

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

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

Fetch a ConnectionPolicy

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 fetchConnectionPolicy() {
_18
const connectionPolicy = await client.voice.v1
_18
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.fetch();
_18
_18
console.log(connectionPolicy.accountSid);
_18
}
_18
_18
fetchConnectionPolicy();

Output

_11
{
_11
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"friendly_name": "friendly_name",
_11
"date_created": "2020-03-18T23:31:36Z",
_11
"date_updated": "2020-03-18T23:31:37Z",
_11
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"links": {
_11
"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"
_11
}
_11
}


Read multiple ConnectionPolicy resources

GET https://voice.twilio.com/v1/ConnectionPolicies

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 ConnectionPolicys

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 listConnectionPolicy() {
_18
const connectionPolicies = await client.voice.v1.connectionPolicies.list({
_18
limit: 20,
_18
});
_18
_18
connectionPolicies.forEach((c) => console.log(c.accountSid));
_18
}
_18
_18
listConnectionPolicy();

Output

_24
{
_24
"meta": {
_24
"page": 0,
_24
"page_size": 50,
_24
"first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies?PageSize=50&Page=0",
_24
"previous_page_url": null,
_24
"url": "https://voice.twilio.com/v1/ConnectionPolicies?PageSize=50&Page=0",
_24
"next_page_url": null,
_24
"key": "connection_policies"
_24
},
_24
"connection_policies": [
_24
{
_24
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_24
"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_24
"friendly_name": "friendly_name",
_24
"date_created": "2020-03-18T23:31:36Z",
_24
"date_updated": "2020-03-18T23:31:37Z",
_24
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_24
"links": {
_24
"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"
_24
}
_24
}
_24
]
_24
}


Update a ConnectionPolicy resource

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

Path parameters

Property nameTypeRequiredPIIDescription
SidSID<NY>required

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

Pattern: ^NY[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.

Update a ConnectionPolicy

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 updateConnectionPolicy() {
_18
const connectionPolicy = await client.voice.v1
_18
.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.update({ friendlyName: "FriendlyName" });
_18
_18
console.log(connectionPolicy.accountSid);
_18
}
_18
_18
updateConnectionPolicy();

Output

_11
{
_11
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"friendly_name": "FriendlyName",
_11
"date_created": "2020-03-18T23:31:36Z",
_11
"date_updated": "2020-03-18T23:31:37Z",
_11
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_11
"links": {
_11
"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"
_11
}
_11
}


Delete a ConnectionPolicy resource

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

Path parameters

Property nameTypeRequiredPIIDescription
SidSID<NY>required

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

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

Delete a ConnectionPolicy

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

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


Rate this page: