Skip to main content
The Plivo Zentrunk API lets you programmatically manage SIP trunks, authentication, and retrieve call records. The API uses standard HTTP methods and returns JSON responses.

Base URL

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

Authentication

All API requests use HTTP Basic Authentication with your Plivo credentials:
  • Username: Your Auth ID
  • Password: Your Auth Token
Find your credentials on the Plivo Console Dashboard.
cURL
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/

Request Format

  • Content-Type: application/json for POST requests
  • All request parameters should be JSON-encoded
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"name": "my-trunk", "trunk_direction": "outbound"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Trunk/

Response Format

All responses are JSON with an api_id for request tracking:
{
  "api_id": "4e1f954c-baf3-11ec-bafe-0242ac110003",
  "message": "Trunk created successfully.",
  "trunk_id": "986908123123411213"
}

HTTP Status Codes

CodeDescription
200Request executed successfully
201Resource created
202Resource modified
204Resource deleted
400Invalid or missing parameter
401Authentication failed
403Forbidden
404Resource not found
405HTTP method not allowed
429Rate limit exceeded
500Server error

Troubleshooting Common Errors

CodeCommon CausesSolution
400Missing trunk name, invalid trunk_directionCheck required parameters. Use inbound or outbound for direction
401Invalid Auth ID or Auth TokenVerify credentials at Console → API Keys
403SIP trunking not enabled, geo permissionsContact support to enable SIP trunking. Check geo permissions
404Invalid trunk ID, credential ID, or URI IDVerify the resource UUID exists
429Rate limit exceededImplement exponential backoff
500Temporary server issueRetry after a few seconds. Check status.plivo.com
For call-level errors (SIP codes), see Zentrunk Hangup Codes.

Pagination

List endpoints return paginated results:
{
  "meta": {
    "limit": 20,
    "offset": 0,
    "total_count": 100,
    "previous": null,
    "next": "/v1/Account/{auth_id}/Zentrunk/Trunk/?limit=20&offset=20"
  },
  "objects": [...]
}
ParameterDescription
limitResults per page (1-20). Default: 20
offsetNumber of results to skip. Default: 0

API Resources

Core Resources

ResourceDescription
TrunksCreate and manage SIP trunks
CallsRetrieve CDRs and call quality metrics

Authentication Resources

ResourceDescription
CredentialsManage username/password for digest auth
IP Access Control ListsManage IP whitelists

Routing Resources

ResourceDescription
Origination URIsManage inbound call destinations

Trunk Configuration

Outbound Trunks

Route calls from your PBX to Plivo’s network:
  1. Create Credentials or IP ACL
  2. Create Trunk with trunk_direction: outbound
  3. Attach credentials or IP ACL to the trunk
  4. Configure your PBX to send SIP INVITE to the trunk domain

Inbound Trunks

Route calls from Plivo to your PBX:
  1. Create Origination URIs pointing to your servers
  2. Create Trunk with trunk_direction: inbound
  3. Attach primary and optionally fallback URIs
  4. Configure a Plivo number to use the trunk

Rate Limits

API requests are rate limited. If you exceed the limit, you’ll receive a 429 response.