API Reference

Complete REST API for the ZPBX platform. All endpoints return JSON and require authentication via session cookie unless noted otherwise.

Base URL

https://api.zpbx.es/v1

All paths below are relative to the base URL. Authentication uses Bearer API keys (Authorization: Bearer zpbx_...).

Voice & Calls

POST
/calls/ingest

Ingest a CDR from FreeSWITCH (XML payload)

GET
/calls

List call detail records with filters and pagination

GET
/calls?recordingOnly=true

List calls that have recordings

GET
/recordings/:id/download

Download a call recording (WAV)

GET
/live-calls

List currently active calls (real-time)

Numbers (DIDs)

GET
/numbers

List all numbers with ownership and assignment info

POST
/numbers

Add a new DID number

PUT
/numbers/:id

Update a number (routing, whitelist, etc.)

DELETE
/numbers/:id

Delete a number and clean up child records

GET
/numbers/:id/rates

Get the rate matching this number's prefix

POST
/numbers/:id/assign

Assign a number to a sub-reseller

Billing & Balance

GET
/balances

Get current account balance (CGRateS)

GET
/dashboard

Dashboard stats: calls, minutes, revenue, margin

GET
/stats/overview

Platform-wide stats overview

GET
/stats/clients

Stats per client/billing group

GET
/stats/clients/detailed

Detailed stats with date/reseller filters

Routing & Restrictions

GET
/restrictions

List call restrictions (whitelist rules)

POST
/restrictions

Create a restriction with scope (trunk/reseller/bg)

GET
/lists

List ANI collections (caller number lists)

POST
/lists

Create or update a caller number list

Authentication

POST
/auth/login

Authenticate with username + password → API key

GET
/auth/me

Get current session context (role, billing group)

POST
/auth/keys

Create a new API key

DELETE
/auth/keys/:id

Revoke an API key