The ConnectionPolicies
resource describes a list of URI Entries that are used to route Origination traffic to a PSTN Carrier over a BYOC Trunk.
The SID of the Account that created the Connection Policy resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique string that we created to identify the Connection Policy resource.
^NY[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The date and time in GMT when the resource was created specified in RFC 2822 format.
The date and time in GMT when the resource was last updated specified in RFC 2822 format.
The URLs of related resources.
POST https://voice.twilio.com/v1/ConnectionPolicies
application/x-www-form-urlencoded
A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createConnectionPolicy() {11const connectionPolicy = await client.voice.v1.connectionPolicies.create();1213console.log(connectionPolicy.accountSid);14}1516createConnectionPolicy();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "friendly_name",5"date_created": "2020-03-18T23:31:36Z",6"date_updated": "2020-03-18T23:31:36Z",7"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"links": {9"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"10}11}
GET https://voice.twilio.com/v1/ConnectionPolicies/{Sid}
The unique string that we created to identify the Connection Policy resource to fetch.
^NY[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchConnectionPolicy() {11const connectionPolicy = await client.voice.v112.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.fetch();1415console.log(connectionPolicy.accountSid);16}1718fetchConnectionPolicy();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "friendly_name",5"date_created": "2020-03-18T23:31:36Z",6"date_updated": "2020-03-18T23:31:37Z",7"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"links": {9"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"10}11}
GET https://voice.twilio.com/v1/ConnectionPolicies
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listConnectionPolicy() {11const connectionPolicies = await client.voice.v1.connectionPolicies.list({12limit: 20,13});1415connectionPolicies.forEach((c) => console.log(c.accountSid));16}1718listConnectionPolicy();
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies?PageSize=50&Page=0",6"previous_page_url": null,7"url": "https://voice.twilio.com/v1/ConnectionPolicies?PageSize=50&Page=0",8"next_page_url": null,9"key": "connection_policies"10},11"connection_policies": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"friendly_name": "friendly_name",16"date_created": "2020-03-18T23:31:36Z",17"date_updated": "2020-03-18T23:31:37Z",18"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",19"links": {20"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"21}22}23]24}
POST https://voice.twilio.com/v1/ConnectionPolicies/{Sid}
The unique string that we created to identify the Connection Policy resource to update.
^NY[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateConnectionPolicy() {11const connectionPolicy = await client.voice.v112.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.update({ friendlyName: "FriendlyName" });1415console.log(connectionPolicy.accountSid);16}1718updateConnectionPolicy();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "FriendlyName",5"date_created": "2020-03-18T23:31:36Z",6"date_updated": "2020-03-18T23:31:37Z",7"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"links": {9"targets": "https://voice.twilio.com/v1/ConnectionPolicies/NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Targets"10}11}
DELETE https://voice.twilio.com/v1/ConnectionPolicies/{Sid}
The unique string that we created to identify the Connection Policy resource to delete.
^NY[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteConnectionPolicy() {11await client.voice.v112.connectionPolicies("NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.remove();14}1516deleteConnectionPolicy();