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
Unique identifier for the trunk.
Unique address on Plivo to route SIP traffic (e.g.,
21784177241578.zt.plivo.com).Friendly name for the trunk.
Status of the trunk:
enabled or disabled.Direction of the trunk:
inbound or outbound.Whether SRTP (media) and TLS (signaling) encryption is enabled.
IP access control list UUID (for outbound trunks).
Credentials list UUID (for outbound trunks).
Primary origination URI UUID (for inbound trunks).
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
trunk_status | string | No | - | Filter by status: enabled, disabled |
trunk_direction | string | No | - | Filter by direction: inbound, outbound |
secure | boolean | No | - | Filter by encryption: true, false |
ipacl_uuid | string | No | - | Filter by IP ACL |
credential_uuid | string | No | - | Filter by credentials |
primary_uri_uuid | string | No | - | Filter by primary URI |
fallback_uri_uuid | string | No | - | Filter by fallback URI |
limit | integer | No | 20 | Results per page (1-20) |
offset | integer | No | 0 | Pagination offset |
Response
Example
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.Example
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | No | - | Friendly name for the trunk |
trunk_direction | string | Yes | - | Direction: inbound or outbound |
trunk_status | string | No | enabled | Status: enabled or disabled |
secure | boolean | No | false | Enable SRTP/TLS encryption |
ipacl_uuid | string | Conditional | - | IP ACL UUID. Required for outbound trunks |
credential_uuid | string | Conditional | - | Credentials UUID. Required for outbound trunks |
primary_uri_uuid | string | Conditional | - | Primary origination URI. Required for inbound trunks |
fallback_uri_uuid | string | No | - | Fallback origination URI for inbound trunks |
Response
Error Codes
| Code | Description |
|---|---|
| 400 | Invalid request parameters |
| 401 | Authentication failed |
| 422 | Missing required parameters (e.g., ipacl_uuid for outbound trunk) |
Outbound Trunk Example
For outbound trunks (calls from your PBX to Plivo), you need eitheripacl_uuid or credential_uuid for authentication.
Inbound Trunk Example
For inbound trunks (calls from Plivo to your PBX), you need aprimary_uri_uuid pointing to your server.
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | No | - | New name for the trunk |
trunk_status | string | No | - | Status: enabled or disabled |
trunk_direction | string | No | - | Direction: inbound or outbound |
secure | boolean | No | - | Enable/disable SRTP/TLS encryption |
ipacl_uuid | string | No | - | New IP ACL UUID |
credential_uuid | string | No | - | New credentials UUID |
primary_uri_uuid | string | No | - | New primary origination URI |
fallback_uri_uuid | string | No | - | New fallback origination URI |
Response
Example
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 ContentExample
Trunk Types
| Trunk Type | Purpose | Can Attach to Phone Numbers? |
|---|---|---|
| Inbound | Route calls from Plivo to your PBX/infrastructure | Yes |
| Outbound | Route calls from your PBX/infrastructure to Plivo | No |
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
Related
- Credentials - Manage SIP credentials
- IP Access Control Lists - Manage IP whitelists
- Origination URIs - Manage destination URIs