Skip to main content

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

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

ActionPattern
ListGET https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI
Get by IDGET https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI
Get extension by numberGET https://pbx.example.com/pbx/openapi.php/extensions/number/100?tenant=CANISTRACCI
Get live extension stateGET https://pbx.example.com/pbx/openapi.php/extensions/state?tenant=CANISTRACCI&number=100
DialPOST https://pbx.example.com/pbx/openapi.php/dial?tenant=CANISTRACCI
Transfer live callPOST https://pbx.example.com/pbx/openapi.php/calls/transfer?tenant=CANISTRACCI
Queue agent actionPOST https://pbx.example.com/pbx/openapi.php/queues/QUEUE_ID/agents/EXTENSION_ID/{login|logout|pause|unpause}?tenant=CANISTRACCI
CreatePOST https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI
ModifyPATCH https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI
DeleteDELETE https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI

Supported Objects

Each supported object has its own page in this chapter. Most configuration objects support CRUD operations. CDR, Simple CDR, AI Analysis, and AI Logs are read-only reporting endpoints. The examples use fictional IDs, numbers, names, and keys; replace them with values from the target PBX.

ObjectPrimary pathAuthentication scopeOperations or required fields
Auth Token/auth/tokenGlobal full API keyPOST generate, DELETE reset
Dial/dialTenant full API keyPOST only; requires source and dest
Live Call Transfer/calls/transferWritable full tenant or global API key; exact tenant requiredPOST blind or attended transfer of an active tenant-owned channel
CDR/cdrsTenant API key or global key; GET onlyGET only
Simple CDR/simplecdrsTenant API key or global key; GET onlyGET only
AI Analysis/aianalysisTenant API key or global key; GET onlyGET only; requires uniqueid
AI Logs/ailogsTenant full or read-only API key, or global key; GET onlyGET only; JSON or CSV; defaults to the current day
Extension/extensionsTenant API keynumber or ex_number; GET /extensions/state for live state
Tenant/tenantsGlobal API keyte_name, te_code
User/usersGlobal API keyus_username
User Profile/userprofilesGlobal API keyup_name
Routing Profile/routingprofilesGlobal API keyrp_name
Provider/providersGlobal API keypr_name
Voicemail/voicemailsTenant API keymailbox
IVR/ivrsTenant API keyiv_name
Custom Destination/customdestinationsTenant API key or global key with global=1cu_name, cu_ct_id
Condition/conditionsTenant API keyco_type
Hunt List/huntlistsTenant API keyhu_name
DID/didsTenant API keydi_number
Queue/queuesTenant API key; agent actions require a writable full key and an exact tenantCRUD; GET /queues/{id}/state for live state; POST /queues/{queueId}/agents/{agentId}/{login|logout|pause|unpause} for agent actions
Setting/settingsTenant API key or global key with global=1se_code
Media File/mediafiles; /mediafiles/{id}/downloadTenant or global key for metadata; full key required to download audiome_name; binary download examples
Music On Hold/musiconholdsTenant API key or global key with global=1mu_name
Paging Group/paginggroupsTenant API keypa_name, pa_number
Conference Room/conferenceroomsTenant API keycr_name, cr_number
Flow/flowsTenant API keyfl_name
Tenant Variable/tenantvariablesTenant API keytv_al_id
DISA/disasTenant API keyds_name
Caller ID Blacklist/calleridblacklistsTenant API key or global key with global=1bl_callerid
Campaign/campaignsTenant API keyca_name
Campaign Number/campaignnumbersTenant API keycn_ca_id, cn_number
Cron Job/cronjobsTenant API key or global key with global=1cr_name
Feature Code/featurecodesTenant API key or global key with global=1fe_code
Short Number/shortnumbersTenant API key or global key with global=1sn_number
Phone Book/phonebooksTenant API keypb_name
Phone Book Entry/phonebookentriesTenant API keyphonebook_id, at least one value
Provisioning Phone/provisioningphonesTenant API keyph_name, ph_mac

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.

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.