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

OriginationUrl Resource


The OriginationUrl Resource represents the Origination SIP URL(s) of your Trunk. OriginationUrls identify the network element entry point(s) into your communications infrastructure (e.g. IP-PBX, SBC). See Origination Settings in the SIP Trunking configuration page
for more information.


OriginationUrl Properties

Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The SID of the Account that created the OriginationUrl resource.

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

sidSID<OU>

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

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

trunk_sidSID<TK>

The SID of the Trunk that owns the Origination URL.

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

weightinteger

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


enabledboolean

Whether the URL is enabled. The default is true.


sip_urlstring<uri>
PII MTL: 30 days

The SIP address you want Twilio to route your Origination calls to. This must be a sip: schema.


friendly_namestring

The string that you assigned to describe the resource.


priorityinteger

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


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 an OriginationUrl resource

POST https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls

Path parameters

Property nameTypeRequiredPIIDescription
TrunkSidSID<TK>required

The SID of the Trunk to associate the resource with.

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

Request body parameters

Property nameTypeRequiredPIIDescription
Weightintegerrequired

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


Priorityintegerrequired

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


Enabledbooleanrequired

Whether the URL is enabled. The default is true.


FriendlyNamestringrequired

A descriptive string that you create to describe the resource. It can be up to 64 characters long.


SipUrlstring<uri>required

The SIP address you want Twilio to route your Origination calls to. This must be a sip: schema.

Create Origination Url

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

_24
// Download the helper library from https://www.twilio.com/docs/node/install
_24
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_24
_24
// Find your Account SID and Auth Token at twilio.com/console
_24
// and set the environment variables. See http://twil.io/secure
_24
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_24
const authToken = process.env.TWILIO_AUTH_TOKEN;
_24
const client = twilio(accountSid, authToken);
_24
_24
async function createOriginationUrl() {
_24
const originationUrl = await client.trunking.v1
_24
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_24
.originationUrls.create({
_24
enabled: false,
_24
friendlyName: "FriendlyName",
_24
priority: 402,
_24
sipUrl: "https://www.example.com",
_24
weight: 152,
_24
});
_24
_24
console.log(originationUrl.accountSid);
_24
}
_24
_24
createOriginationUrl();

Output

_13
{
_13
"weight": 152,
_13
"date_updated": "2018-05-07T20:50:58Z",
_13
"enabled": false,
_13
"friendly_name": "FriendlyName",
_13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"priority": 402,
_13
"sip_url": "https://www.example.com",
_13
"sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"date_created": "2018-05-07T20:50:58Z",
_13
"trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls/OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_13
}


Fetch an OriginationUrl resource

GET https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}

Path parameters

Property nameTypeRequiredPIIDescription
TrunkSidSID<TK>required

The SID of the Trunk from which to fetch the OriginationUrl.

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

SidSID<OU>required

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

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

Fetch Origination Url

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 fetchOriginationUrl() {
_19
const originationUrl = await client.trunking.v1
_19
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.originationUrls("OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.fetch();
_19
_19
console.log(originationUrl.accountSid);
_19
}
_19
_19
fetchOriginationUrl();

Output

_13
{
_13
"weight": 1,
_13
"date_updated": "2018-05-07T20:20:46Z",
_13
"enabled": false,
_13
"friendly_name": "friendly_name",
_13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"priority": 1,
_13
"sip_url": "sip://sip-box.com:1234",
_13
"sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"date_created": "2018-05-07T20:20:46Z",
_13
"trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls/OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_13
}


Read multiple OriginationUrl resources

GET https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls

Path parameters

Property nameTypeRequiredPIIDescription
TrunkSidSID<TK>required

The SID of the Trunk from which to read the OriginationUrl.

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

Read Origination Url

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 listOriginationUrl() {
_18
const originationUrls = await client.trunking.v1
_18
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.originationUrls.list({ limit: 20 });
_18
_18
originationUrls.forEach((o) => console.log(o.accountSid));
_18
}
_18
_18
listOriginationUrl();

Output

_26
{
_26
"meta": {
_26
"first_page_url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls?PageSize=50&Page=0",
_26
"key": "origination_urls",
_26
"next_page_url": null,
_26
"page": 0,
_26
"page_size": 50,
_26
"previous_page_url": null,
_26
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls?PageSize=50&Page=0"
_26
},
_26
"origination_urls": [
_26
{
_26
"weight": 1,
_26
"date_updated": "2018-05-09T20:47:35Z",
_26
"enabled": true,
_26
"friendly_name": "friendly_name",
_26
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_26
"priority": 1,
_26
"sip_url": "sip://sip-box.com:1234",
_26
"sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_26
"date_created": "2018-05-09T20:47:35Z",
_26
"trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_26
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls/OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_26
}
_26
]
_26
}


Update an OriginationUrl resource

POST https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}

Path parameters

Property nameTypeRequiredPIIDescription
TrunkSidSID<TK>required

The SID of the Trunk from which to update the OriginationUrl.

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

SidSID<OU>required

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

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

Request body parameters

Property nameTypeRequiredPIIDescription
WeightintegerOptional

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


PriorityintegerOptional

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


EnabledbooleanOptional

Whether the URL is enabled. The default is true.


FriendlyNamestringOptional

A descriptive string that you create to describe the resource. It can be up to 64 characters long.


SipUrlstring<uri>Optional

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

Update Origination Url

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 updateOriginationUrl() {
_19
const originationUrl = await client.trunking.v1
_19
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.originationUrls("OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.update({ weight: 226 });
_19
_19
console.log(originationUrl.accountSid);
_19
}
_19
_19
updateOriginationUrl();

Output

_13
{
_13
"weight": 226,
_13
"date_updated": "2018-05-07T20:50:58Z",
_13
"enabled": false,
_13
"friendly_name": "updated_name",
_13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"priority": 2,
_13
"sip_url": "sip://sip-updated.com:4321",
_13
"sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"date_created": "2018-05-07T20:50:58Z",
_13
"trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_13
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls/OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_13
}


Delete an OriginationUrl resource

DELETE https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}

Path parameters

Property nameTypeRequiredPIIDescription
TrunkSidSID<TK>required

The SID of the Trunk from which to delete the OriginationUrl.

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

SidSID<OU>required

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

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

Delete Origination Url

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 deleteOriginationUrl() {
_17
await client.trunking.v1
_17
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17
.originationUrls("OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17
.remove();
_17
}
_17
_17
deleteOriginationUrl();


Rate this page: