Skip to contentSkip to navigationSkip to topbar
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

originationurl-properties page anchor
Property nameTypeRequiredDescriptionChild properties
account_sidSID<AC>Optional
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>Optional

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>Optional

The SID of the Trunk that owns the Origination URL.

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

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.

Default: 0

enabledbooleanOptional

Whether the URL is enabled. The default is true.


sip_urlstring<uri>Optional
PII MTL: 30 days

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


friendly_namestringOptional

The string that you assigned to describe the resource.


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.

Default: 0

date_updatedstring<date-time>Optional

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>Optional

The absolute URL of the resource.


Create an OriginationUrl resource

create-an-originationurl-resource page anchor
POST https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls

Path parameters

path-parameters page anchor
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
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
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 UrlLink to code sample: Create Origination Url
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createOriginationUrl() {
11
const originationUrl = await client.trunking.v1
12
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.originationUrls.create({
14
enabled: false,
15
friendlyName: "FriendlyName",
16
priority: 42,
17
sipUrl: "https://www.example.com",
18
weight: 42,
19
});
20
21
console.log(originationUrl.accountSid);
22
}
23
24
createOriginationUrl();

Output

1
{
2
"weight": 42,
3
"date_updated": "2018-05-07T20:50:58Z",
4
"enabled": false,
5
"friendly_name": "FriendlyName",
6
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"priority": 42,
8
"sip_url": "https://www.example.com",
9
"sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
10
"date_created": "2018-05-07T20:50:58Z",
11
"trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls/OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
13
}

Fetch an OriginationUrl resource

fetch-an-originationurl-resource page anchor
GET https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}

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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchOriginationUrl() {
11
const originationUrl = await client.trunking.v1
12
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.originationUrls("OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.fetch();
15
16
console.log(originationUrl.accountSid);
17
}
18
19
fetchOriginationUrl();

Output

1
{
2
"weight": 1,
3
"date_updated": "2018-05-07T20:20:46Z",
4
"enabled": false,
5
"friendly_name": "friendly_name",
6
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"priority": 1,
8
"sip_url": "sip://sip-box.com:1234",
9
"sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
10
"date_created": "2018-05-07T20:20:46Z",
11
"trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls/OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
13
}

Read multiple OriginationUrl resources

read-multiple-originationurl-resources page anchor
GET https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls

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

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listOriginationUrl() {
11
const originationUrls = await client.trunking.v1
12
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.originationUrls.list({ limit: 20 });
14
15
originationUrls.forEach((o) => console.log(o.accountSid));
16
}
17
18
listOriginationUrl();

Output

1
{
2
"meta": {
3
"first_page_url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls?PageSize=50&Page=0",
4
"key": "origination_urls",
5
"next_page_url": null,
6
"page": 0,
7
"page_size": 50,
8
"previous_page_url": null,
9
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls?PageSize=50&Page=0"
10
},
11
"origination_urls": [
12
{
13
"weight": 1,
14
"date_updated": "2018-05-09T20:47:35Z",
15
"enabled": true,
16
"friendly_name": "friendly_name",
17
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
18
"priority": 1,
19
"sip_url": "sip://sip-box.com:1234",
20
"sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
21
"date_created": "2018-05-09T20:47:35Z",
22
"trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
23
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls/OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
24
}
25
]
26
}

Update an OriginationUrl resource

update-an-originationurl-resource page anchor
POST https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}

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
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
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.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateOriginationUrl() {
11
const originationUrl = await client.trunking.v1
12
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.originationUrls("OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.update({ weight: 42 });
15
16
console.log(originationUrl.accountSid);
17
}
18
19
updateOriginationUrl();

Output

1
{
2
"weight": 42,
3
"date_updated": "2018-05-07T20:50:58Z",
4
"enabled": false,
5
"friendly_name": "updated_name",
6
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"priority": 2,
8
"sip_url": "sip://sip-updated.com:4321",
9
"sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
10
"date_created": "2018-05-07T20:50:58Z",
11
"trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
12
"url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls/OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
13
}

Delete an OriginationUrl resource

delete-an-originationurl-resource page anchor
DELETE https://trunking.twilio.com/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}

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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteOriginationUrl() {
11
await client.trunking.v1
12
.trunks("TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.originationUrls("OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.remove();
15
}
16
17
deleteOriginationUrl();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.