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

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

The Trunk Object

AttributeTypeDescription
trunk_idstringUnique identifier for the trunk
trunk_domainstringUnique address on Plivo to route SIP traffic (e.g., 21784177241578.zt.plivo.com)
namestringFriendly name for the trunk
trunk_statusstringStatus: enabled or disabled
trunk_directionstringDirection: inbound or outbound
securebooleanWhether SRTP (media) and TLS (signaling) encryption is enabled
ipacl_uuidstringIP access control list UUID (outbound trunks)
credential_uuidstringCredentials list UUID (outbound trunks)
primary_uri_uuidstringPrimary origination URI UUID (inbound trunks)
fallback_uri_uuidstringFallback origination URI UUID (inbound trunks)

Example Response

{
  "name": "trunk_name_1",
  "trunk_id": "21784177241578",
  "trunk_domain": "21784177241578.zt.plivo.com",
  "trunk_status": "enabled",
  "secure": true,
  "trunk_direction": "outbound",
  "ipacl_uuid": "90b6eb07-796c-4d86-a4fd-44ed11667ddb",
  "credential_uuid": "eb07-796c-4d86-a4fd-44ed11667ddb",
  "primary_uri_uuid": null,
  "fallback_uri_uuid": null
}

Create a Trunk

Create a new SIP trunk for inbound or outbound traffic.
POST https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/

Parameters

ParameterTypeRequiredDescription
namestringNoFriendly name for the trunk
trunk_directionstringYesDirection: inbound or outbound
trunk_statusstringNoStatus: enabled or disabled. Default: enabled
securebooleanNoEnable SRTP/TLS encryption. Default: false
ipacl_uuidstringConditionalIP ACL UUID. Required for outbound trunks
credential_uuidstringConditionalCredentials UUID. Required for outbound trunks
primary_uri_uuidstringConditionalPrimary origination URI. Required for inbound trunks
fallback_uri_uuidstringNoFallback origination URI for inbound trunks

Outbound Trunk

For outbound trunks (calls from your PBX to Plivo), you need either ipacl_uuid or credential_uuid for authentication.
cURL
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{
      "name": "outbound-trunk",
      "trunk_direction": "outbound",
      "trunk_status": "enabled",
      "ipacl_uuid": "1c13de4c-423d-11e3-9899-22000abfa5d5"
    }' \
    https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/

Inbound Trunk

For inbound trunks (calls from Plivo to your PBX), you need a primary_uri_uuid pointing to your server.
cURL
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{
      "name": "inbound-trunk",
      "trunk_direction": "inbound",
      "trunk_status": "enabled",
      "primary_uri_uuid": "90b6eb07-796c-4d86-a4fd-44ed11667ddb",
      "fallback_uri_uuid": "796c-4d86-a4fd-44ed11667ddb-eb07"
    }' \
    https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/

Response

{
  "api_id": "4e1f954c-baf3-11ec-bafe-0242ac110003",
  "message": "Trunk created successfully.",
  "trunk_id": "986908123123411213"
}

Retrieve a Trunk

Get details of a specific trunk.
GET https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/{trunk_id}/
cURL
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/21784177241578/

Response

Returns the trunk object.
{
  "name": "trunk_name_1",
  "trunk_id": "21784177241578",
  "trunk_domain": "21784177241578.zt.plivo.com",
  "trunk_status": "enabled",
  "secure": true,
  "trunk_direction": "outbound",
  "ipacl_uuid": "90b6eb07-796c-4d86-a4fd-44ed11667ddb",
  "credential_uuid": "eb07-796c-4d86-a4fd-44ed11667ddb",
  "primary_uri_uuid": null,
  "fallback_uri_uuid": null
}

List All Trunks

Get all trunks with optional filtering.
GET https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/

Query Parameters

ParameterTypeDescription
trunk_statusstringFilter by status: enabled, disabled
trunk_directionstringFilter by direction: inbound, outbound
securebooleanFilter by encryption: true, false
ipacl_uuidstringFilter by IP ACL
credential_uuidstringFilter by credentials
primary_uri_uuidstringFilter by primary URI
fallback_uri_uuidstringFilter by fallback URI
limitintegerResults per page (1-20). Default: 20
offsetintegerPagination offset. Default: 0
cURL
curl -i --user AUTH_ID:AUTH_TOKEN \
    "https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/?trunk_direction=outbound&limit=10"

Response

{
  "api_id": "a04ad809-3b78-4bbe-9baf-acfc7800b10f",
  "meta": {
    "limit": 2,
    "offset": 0,
    "total_count": 10,
    "previous": null,
    "next": "v1/Account/{auth_id}/Zentrunk/Trunk/?limit=2&offset=2"
  },
  "objects": [
    {
      "name": "trunk_name_1",
      "trunk_id": "21784177241578",
      "trunk_domain": "21784177241578.zt.plivo.com",
      "trunk_status": "enabled",
      "secure": true,
      "trunk_direction": "outbound",
      "ipacl_uuid": "90b6eb07-796c-4d86-a4fd-44ed11667ddb",
      "credential_uuid": "eb07-796c-4d86-a4fd-44ed11667ddb",
      "primary_uri_uuid": null,
      "fallback_uri_uuid": null
    },
    {
      "name": "trunk_name_2",
      "trunk_id": "31784177241575",
      "trunk_domain": "31784177241575.zt.plivo.com",
      "trunk_status": "enabled",
      "secure": false,
      "trunk_direction": "inbound",
      "ipacl_uuid": null,
      "credential_uuid": null,
      "primary_uri_uuid": "90b6eb07-796c-4d86-a4fd-44ed11667ddb",
      "fallback_uri_uuid": "796c-4d86-a4fd-44ed11667ddb-eb07"
    }
  ]
}

Update a Trunk

Modify an existing trunk’s properties.
POST https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/{trunk_id}/

Parameters

ParameterTypeDescription
namestringNew name for the trunk
trunk_statusstringStatus: enabled or disabled
trunk_directionstringDirection: inbound or outbound
securebooleanEnable/disable SRTP/TLS encryption
ipacl_uuidstringNew IP ACL UUID
credential_uuidstringNew credentials UUID
primary_uri_uuidstringNew primary origination URI
fallback_uri_uuidstringNew fallback origination URI
cURL
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"name": "updated-trunk-name", "trunk_status": "disabled"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/{trunk_id}/

Response

{
  "api_id": "4e1f954c-baf3-11ec-bafe-0242ac110003",
  "message": "Trunk updated successfully.",
  "trunk_id": "986908123123411213"
}

Delete a Trunk

Permanently delete a trunk.
DELETE https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/{trunk_id}/
cURL
curl -X DELETE -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/{trunk_id}/
Response: HTTP 204 No Content

Trunk Types

Trunk TypePurposeCan Attach to Phone Numbers?
InboundRoute calls from Plivo to your PBX/infrastructure✅ Yes
OutboundRoute calls from your PBX/infrastructure to Plivo❌ No
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