Overview and Examples
The MiRTA PBX OpenAPI endpoint exposes configuration and reporting APIs as an OpenAPI 3.0.3 JSON specification. OpenAPI describes the available paths, methods, authentication schemes, request bodies, and response schemas in a machine-readable format.
Using the OpenAPI specification makes integrations easier to test and maintain: developers can generate client code, import the API into tools such as Postman or Swagger UI, validate request shapes, and keep documentation aligned with the endpoint implementation.
Base URL
https://pbx.example.com/pbx/openapi.php
https://pbx.example.com/pbx/openapi.php?spec=1
https://pbx.example.com/pbx/openapi.php/openapi.json
https://pbx.example.com/pbx/openapi.php/swagger.json
The global administrator controls access to the specification in Admin / Settings / API Interface / OpenAPI documentation:
- Public (default): opening
openapi.phpor requesting the specification explicitly returns the full catalog. - Protected by API key: opening
openapi.phpwithout a specification selector returns HTTP 404. Request the specification explicitly with a global or tenant API key. Global keys see the full catalog; tenant keys must include their tenant code or name and see the tenant operations. Read-only and full keys see the same documentation for their scope. The key's IP filter and the tenant's OpenAPI access setting apply. Extension Dial API Keys cannot retrieve the protected specification. - Hidden: every specification request returns HTTP 404, including requests with a global key.
curl -H "X-API-Key: TENANT_API_KEY" \
"https://pbx.example.com/pbx/openapi.php?spec=1&tenant=CANISTRACCI"
The protected specification looks up the tenant by exact code first, then by exact name. All three modes support the existing REST and query-style API calls.
Authentication
Send the API key as a key query parameter, an X-API-Key header, or an Authorization: Bearer token. Tenant API keys require a tenant parameter. Global keys can access global administration objects and can list tenant-scoped objects across tenants when no tenant parameter is supplied.
curl -H "X-API-Key: TENANT_API_KEY" \
"https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI"
curl -H "Authorization: Bearer TENANT_API_KEY" \
"https://pbx.example.com/pbx/openapi.php/extensions/number/100?tenant=CANISTRACCI"
curl "https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI&key=TENANT_API_KEY"
Endpoint Patterns
| Action | Pattern |
|---|---|
| List | GET https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI |
| Get by ID | GET https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI |
| Get extension by number | GET https://pbx.example.com/pbx/openapi.php/extensions/number/100?tenant=CANISTRACCI |
| Get live extension state | GET https://pbx.example.com/pbx/openapi.php/extensions/state?tenant=CANISTRACCI&number=100 |
| Count peers | GET https://pbx.example.com/pbx/openapi.php/countpeers?tenant=CANISTRACCI |
| Outbound caller IDs | GET https://pbx.example.com/pbx/openapi.php/outbounddids?tenant=CANISTRACCI |
| Resync a registered phone | POST https://pbx.example.com/pbx/openapi.php/phones/resync?tenant=CANISTRACCI |
| List tenants by code or name | GET /tenants |
| Tenant server placement | GET|POST https://pbx.example.com/pbx/openapi.php/tenants/TENANT_ID/placement |
| Download call recording | GET https://pbx.example.com/pbx/openapi.php/recordings/UNIQUEID?tenant=CANISTRACCI |
| Translations | GET https://pbx.example.com/pbx/openapi.php/translations?language=it-IT |
| Dial | POST https://pbx.example.com/pbx/openapi.php/dial?tenant=CANISTRACCI |
| Transfer live call | POST https://pbx.example.com/pbx/openapi.php/calls/transfer?tenant=CANISTRACCI |
| Queue agent action | POST https://pbx.example.com/pbx/openapi.php/queues/QUEUE_ID/agents/EXTENSION_ID/{login|logout|pause|unpause}?tenant=CANISTRACCI |
| Queue agent action by queue number | POST https://pbx.example.com/pbx/openapi.php/queues/by-number/QUEUE_NUMBER/agents/EXTENSION_ID/{login|logout|pause|unpause}?tenant=CANISTRACCI |
| External queue agent action | POST https://pbx.example.com/pbx/openapi.php/queues/QUEUE_ID/external-agents/EXTERNAL_AGENT_ID/{login|logout|pause|unpause}?tenant=CANISTRACCI |
| External queue agent by queue number | POST https://pbx.example.com/pbx/openapi.php/queues/by-number/QUEUE_NUMBER/external-agents/EXTERNAL_AGENT_ID/{login|logout|pause|unpause}?tenant=CANISTRACCI |
| All-queues extension action | POST https://pbx.example.com/pbx/openapi.php/queues/all/agents/EXTENSION_ID/{login|logout|pause|unpause}?tenant=CANISTRACCI |
| All-queues external agent action | POST https://pbx.example.com/pbx/openapi.php/queues/all/external-agents/EXTERNAL_AGENT_ID/{login|logout|pause|unpause}?tenant=CANISTRACCI |
| Queue History | GET https://pbx.example.com/pbx/openapi.php/queuelogs/history?tenant=CANISTRACCI |
| Raw queue logs | GET https://pbx.example.com/pbx/openapi.php/queuelogs/raw?tenant=CANISTRACCI |
| Queue log CSV download | GET https://pbx.example.com/pbx/openapi.php/queuelogs/raw/download?tenant=CANISTRACCI |
| Create | POST https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI |
| Modify | PATCH https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI |
| Delete | DELETE https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI |
| Read firewall | GET https://pbx.example.com/pbx/openapi.php/firewall |
| Read user activity | GET https://pbx.example.com/pbx/openapi.php/useractivity |
| Read PBX nodes | GET https://pbx.example.com/pbx/openapi.php/nodes?live=false |
| List all extension states | GET https://pbx.example.com/pbx/openapi.php/extensions/states?tenant=CANISTRACCI |
Request bodies
For JSON writes, send Content-Type: application/json and a JSON body, for example with curl --data-binary. Use JSON booleans (true/false) for boolean options. A valid raw JSON body takes precedence over form fields, including when a client sends it with a form content type. Do not mix a JSON body with form fields. Ordinary form submissions and the legacy jsondata parameter remain supported; form-based clients can use jsondata to retain JSON types. Malformed JSON returns invalid_json.
Supported Objects
Each supported object has its own page in this chapter. Most configuration objects support CRUD operations. CDR, Simple CDR, AI Analysis, AI Logs, Queue Logs, Peer Counts and Translations are read-only endpoints. The examples use fictional IDs, numbers, names, and keys; replace them with values from the target PBX.
| Object | Primary path | Authentication scope | Operations or required fields |
|---|---|---|---|
| Auth Token | /auth/token | Global full API key | POST generate, DELETE reset |
| Dial | /dial | Tenant full API key | POST only; requires source and dest |
| Live Call Transfer | /calls/transfer | Writable full tenant or global API key; exact tenant required | POST blind or attended transfer of an active tenant-owned channel |
| CDR | /cdrs | Tenant API key or global key; GET only | GET only |
| Simple CDR | /simplecdrs | Tenant API key or global key; GET only | GET only |
| AI Analysis | /aianalysis | Tenant API key or global key; GET only | GET only; requires uniqueid |
| AI Logs | /ailogs | Tenant full or read-only API key, or global key; GET only | GET only; JSON or CSV; defaults to the current day |
| SMS and MMS | /sms, /mms | Concrete tenant required, including global keys. Full key for sending and attachment downloads; full or read-only key for history. | POST queue messages; GET filtered history, individual messages and MMS attachments. See SMS and MMS. |
| Faxes | /faxes, /faxes/{id}/download | Concrete tenant required, including global keys. Full key for sending/downloading; full or read-only key for metadata. | POST PDF/TIFF for delivery; GET history, status, attempts and PDF documents. See Faxes. |
| Peer Counts | /countpeers | Full or read-only tenant/global key; tenant required for tenant keys | GET counts per node and total; SIP monitored online peers plus PJSIP contacts. See Peer Counts. |
| Translations | /translations | Full or read-only global key | GET interface texts of one language with stable ID and version; /translations/languages lists the languages. See Translations. |
| Extension | /extensions | Tenant API key | number or ex_number; GET /extensions/state for live state |
| Tenant | /tenants | Global API key | te_name, te_code |
| User | /users | Global API key | us_username |
| User Profile | /userprofiles | Global API key | up_name |
| Routing Profile | /routingprofiles | Global API key | rp_name |
| Provider | /providers | Global API key | pr_name |
| Voicemail | /voicemails | Tenant API key | mailbox |
| IVR | /ivrs | Tenant API key | iv_name |
| Custom Destination | /customdestinations | Tenant API key or global key with global=1 | cu_name, cu_ct_id |
| Condition | /conditions | Tenant API key | co_type |
| Hunt List | /huntlists | Tenant API key | hu_name |
| DID | /dids | Tenant API key | di_number |
| Queue | /queues | Tenant API key; agent actions require a writable full key and an exact tenant | CRUD; GET /queues/{id}/state for live state; POST /queues/{queueId}/agents/{agentId}/{login|logout|pause|unpause} for agent actions; use POST /queues/by-number/{queueNumber}/agents/{agentId}/{login|logout|pause|unpause} to select a dialable queue number. See Queue Agent Actions. External agents use /queues/{queueId}/external-agents/{externalAgentId}/{login|logout|pause|unpause} or the /queues/by-number/{queueNumber}/external-agents/{externalAgentId}/{login|logout|pause|unpause} variant. Use ea_id; login accepts optional JSON integer penalty and booleans confirm and monitor_state. Both extension and external-agent login accept penalty 0 to 2147483647, default 0; repeated login preserves the current penalty. See Login with a Penalty. See External Agents. Use /queues/all/agents/{agentId}/{login|logout|pause|unpause} or /queues/all/external-agents/{externalAgentId}/{login|logout|pause|unpause} for bulk actions. Login targets every queue in the tenant; other actions target existing memberships only. HTTP 200 can contain per-queue failures; inspect success, summary, and results. See All-Queues Actions |
| Queue Logs | /queuelogs, /queuelogs/raw | Tenant or global full/read-only API key; one exact tenant is required | GET only; historical Queue History aggregation or raw events; JSON and paginated CSV downloads |
| Setting | /settings | Tenant API key or global key with global=1 | se_code |
| Media File | /mediafiles; /mediafiles/{id}/download | Tenant or global key for metadata; full key required to download audio | me_name; binary download examples |
| Music On Hold | /musiconholds | Tenant API key or global key with global=1 | mu_name |
| Paging Group | /paginggroups | Tenant API key | pa_name, pa_number |
| Conference Room | /conferencerooms | Tenant API key | cr_name, cr_number |
| Flow | /flows | Tenant API key | fl_name |
| Tenant Variable | /tenantvariables | Tenant API key | tv_al_id |
| DISA | /disas | Tenant API key | ds_name |
| Caller ID Blacklist | /calleridblacklists | Tenant API key or global key with global=1 | bl_callerid |
| Campaign | /campaigns | Tenant API key | ca_name |
| Campaign Number | /campaignnumbers | Tenant API key | cn_ca_id, cn_number |
| Cron Job | /cronjobs | Tenant API key or global key with global=1 | cr_name |
| Feature Code | /featurecodes | Tenant API key or global key with global=1 | fe_code |
| Short Number | /shortnumbers | Tenant API key or global key with global=1 | sn_number |
| Phone Book | /phonebooks | Tenant API key | pb_name |
| Phone Book Entry | /phonebookentries | Tenant API key | phonebook_id, at least one value |
| Provisioning Phone | /provisioningphones | Tenant API key | ph_name, ph_mac |
| Firewall | /firewall | Global key only; writes require a full global key | Read or change GeoIP/Fail2Ban options and allowed countries; read cached node status. See Firewall. |
| User Activity | /useractivity | Global full or read-only key; GET only | Read and search administrative user activity, with tenant and metadata filters, literal text search and pagination. See User Activity. |
| PBX Nodes | /nodes, /nodes/{id} | Full or read-only global key; omit tenant | Read node health, cron/devstate checks, services, OS updates, processing backlogs and optional live Asterisk/ODBC readings. See PBX Nodes. |
| Extension States | /extensions/states | Full or read-only tenant/global key; advanced keys require getExtensionStates and the selected tenant | All extension states in one array, including offline extensions, DND and active channel counts. Optional live=false. See Extension States. |
Errors
Errors are returned as JSON with an error code and message. Common errors include missing_api_key, invalid_api_key, tenant_not_found, invalid_json, missing_required_field, read_only_api_key, method_not_allowed, and not_found.
Phone book collection operations
The /phonebooks/{id}/entries endpoint supports downloading all stored contacts (GET), adding 1–500 contacts in an atomic batch (POST), and clearing only the selected phone book (DELETE). A tenant must be selected. Read-only keys can download; writes require a full key. See Phone Book for examples.
Configuration API additions (1.2.0)
Thirty additional resources cover Configuration/Settings and child records, with full create/read/update/delete operations. Extension technology conversion and voicemail messages/greetings now have dedicated endpoints. The generated internal directory is read-only; its source configuration objects remain editable.
See Additional Configuration Operations for complete request fields, scope rules and examples.
For a shared outbound caller ID selector with per-extension BLF, see the Flow example and PJSIP enrollment.
Scheduled calls and text-to-speech
POST /scheduledcalls?tenant=TENANT_CODE queues an outbound message call using prerecorded WAV audio or text with tts: true. TTS uses the tenant/global speech engine and default voice; text is limited to 5,000 UTF-8 bytes. A full API key is required. Set notbefore to schedule a future call, or omit it for the current time when no New Item Default overrides it. See Scheduled calls: text-to-speech, curl examples, regeneration and errors. Send "dispatch": true on creation, or use POST /scheduledcalls/{id}/dispatch, to start the call immediately instead of waiting for the once-a-minute worker; see Dispatch a call immediately.
Media File Downloads
GET /mediafiles/{id}/download?tenant=TENANTCODE returns the original audio file as a binary attachment. It requires a full tenant or global API key; read-only keys cannot download audio. Tenant scoping is enforced. Global full keys can use global=yes for shared media. List/detail media endpoints return metadata only, and download errors remain JSON. See Media File: Download a Media File for curl examples, response headers, storage support and errors.
SMS and MMS
POST /sms and POST /mms queue outgoing messages using the existing tenant SMS routing. HTTP 202 confirms queuing, not delivery. GET /sms and GET /mms list stored history with exact-match filters and cursor pagination; append /{id} for one message. MMS details list attachment IDs for GET /mms/{id}/attachments/{attachment_id}/download. Every request requires a concrete tenant. Sending and attachment downloads require a full API key; read-only keys can retrieve history text and attachment metadata. See SMS and MMS for request fields, curl examples, scheduling, limits, stored-status behavior and errors.
Fax Sending and Retrieval
POST /faxes converts an uploaded PDF/TIFF and queues it for the existing fax worker. HTTP 202 confirms queuing; GET /faxes/{id} returns status and recent delivery attempts. GET /faxes provides tenant-scoped history with filters and cursor pagination. GET /faxes/{id}/download returns the document as PDF from database or S3 storage. Sending/downloading require a full key, and every request requires a concrete tenant. See Faxes for complete request fields, uuencode/curl examples, scheduling, storage, limits and errors.
Media Generation, Uploads and DID Assignment
| Task | Documentation |
|---|---|
| Generate or replace saved audio | Media File: TTS, WAV/MP3 uploads and audio replacement. Use tts: true for generation or POST /mediafiles/{id}/upload for uploads. |
| Assign, transfer or release numbers | DID assignment: POST /dids/{id}/assign, owner checks, tenant permissions and pool behavior. |
| Update hold music | Music On Hold: ordered media selection, automatic playlist rebuilding and reload warnings. |
| Create or convert extensions | Extension availability, defaults and caller ID rules. |
No comments to display
No comments to display