Skip to main content
The Trunks API lets you create and manage SIP trunks that route voice traffic between your infrastructure and Plivo’s network.

API Endpoint


The Trunk Object

A trunk represents a SIP connection between your infrastructure and Plivo’s network. Trunks can be inbound (receiving calls from Plivo) or outbound (sending calls to Plivo).

Attributes

trunk_id
string
Unique identifier for the trunk.
trunk_domain
string
Unique address on Plivo to route SIP traffic (e.g., 21784177241578.zt.plivo.com).
name
string
Friendly name for the trunk.
trunk_status
string
Status of the trunk: enabled or disabled.
trunk_direction
string
Direction of the trunk: inbound or outbound.
secure
boolean
Whether SRTP (media) and TLS (signaling) encryption is enabled.
ipacl_uuid
string
IP access control list UUID (for outbound trunks).
credential_uuid
string
Credentials list UUID (for outbound trunks).
primary_uri_uuid
string
Primary origination URI UUID (for inbound trunks).
fallback_uri_uuid
string
Fallback origination URI UUID (for inbound trunks).

Example Object


List All Trunks

Get all trunks with optional filtering.

HTTP Request

GET https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/

Query Parameters

Response

meta
object
Pagination metadata: limit (results per page), offset (items skipped), total_count (total matching trunks), previous and next (relative URLs for adjacent pages).
objects
array
Array of trunk objects — see The Trunk Object.

Example

cURL

Retrieve a Trunk

Get details of a specific trunk.

HTTP Request

GET https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/{trunk_id}/

Response

Returns the trunk object nested under the object key.
api_id
string
Unique identifier for the API request.
object
object
The trunk object — see The Trunk Object.

Example

cURL

Create a Trunk

Create a new SIP trunk for inbound or outbound traffic.

HTTP Request

POST https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/

Request Parameters

Response

api_id
string
Unique identifier for the API request.
message
string
Status of the request. Returns Trunk created successfully. on a successful creation.
trunk_id
string
Unique identifier for the trunk.

Error Codes

Outbound Trunk Example

For outbound trunks (calls from your PBX to Plivo), you need either ipacl_uuid or credential_uuid for authentication.
cURL

Inbound Trunk Example

For inbound trunks (calls from Plivo to your PBX), you need a primary_uri_uuid pointing to your server.
cURL

Update a Trunk

Modify an existing trunk’s properties.

HTTP Request

POST https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/{trunk_id}/

Request Parameters

Response

api_id
string
Unique identifier for the API request.
message
string
Status of the request. Returns Trunk updated successfully. on a successful update.
trunk_id
string
Unique identifier for the trunk.

Example

cURL

Delete a Trunk

Permanently delete a trunk.

HTTP Request

DELETE https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/{trunk_id}/

Response

HTTP 204 No Content

Example

cURL

Trunk Types

Only inbound trunks can be attached to phone numbers. If you create an outbound trunk, it will not appear in the phone number configuration dropdown. To receive calls on a Plivo number via SIP, you must create an inbound trunk.

Outbound Trunks

Route calls from your PBX/infrastructure to Plivo:
  • Your system sends SIP INVITE to the trunk domain
  • Authentication via IP ACL or credentials
  • Calls terminate on PSTN via Plivo

Inbound Trunks

Route calls from Plivo to your PBX/infrastructure:
  • Calls arrive at Plivo (from PSTN or Plivo numbers)
  • Plivo forwards to your origination URI
  • Fallback URI used if primary fails
  • Can be attached to purchased phone numbers