# API

Reference guide for the legacy ProxyAPI and the newer OpenAPI JSON endpoint, including authentication, object scope, request patterns, examples, and error handling.

# OpenAPI

OpenAPI JSON endpoint reference and examples.

# 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

<table id="bkmrk-actionpatternlistget"><thead><tr><th>Action</th><th>Pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI`</td></tr><tr><td>Get extension by number</td><td>`GET https://pbx.example.com/pbx/openapi.php/extensions/number/100?tenant=CANISTRACCI`</td></tr><tr><td>Get live extension state</td><td>`GET https://pbx.example.com/pbx/openapi.php/extensions/state?tenant=CANISTRACCI&number=100`</td></tr><tr><td>Dial</td><td>`POST https://pbx.example.com/pbx/openapi.php/dial?tenant=CANISTRACCI`</td></tr><tr><td>Transfer live call</td><td>`POST https://pbx.example.com/pbx/openapi.php/calls/transfer?tenant=CANISTRACCI`</td></tr><tr><td>Queue agent action</td><td>`POST https://pbx.example.com/pbx/openapi.php/queues/QUEUE_ID/agents/EXTENSION_ID/{login|logout|pause|unpause}?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI`</td></tr><tr><td>Modify</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## 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.

<table id="bkmrk-objectprimary-pathau"><thead><tr><th>Object</th><th>Primary path</th><th>Authentication scope</th><th>Operations or required fields</th></tr></thead><tbody><tr><td>**Auth Token**</td><td>`/auth/token`</td><td>Global full API key</td><td>`POST` generate, `DELETE` reset</td></tr><tr><td>**Dial**</td><td>`/dial`</td><td>Tenant full API key</td><td>`POST` only; requires `source` and `dest`</td></tr><tr><td>**Live Call Transfer**</td><td>`/calls/transfer`</td><td>Writable full tenant or global API key; exact tenant required</td><td>`POST` blind or attended transfer of an active tenant-owned channel</td></tr><tr><td>**CDR**</td><td>`/cdrs`</td><td>Tenant API key or global key; GET only</td><td>`GET` only</td></tr><tr><td>**Simple CDR**</td><td>`/simplecdrs`</td><td>Tenant API key or global key; GET only</td><td>`GET` only</td></tr><tr><td>**AI Analysis**</td><td>`/aianalysis`</td><td>Tenant API key or global key; GET only</td><td>`GET` only; requires `uniqueid`</td></tr><tr><td>**AI Logs**</td><td>`/ailogs`</td><td>Tenant full or read-only API key, or global key; GET only</td><td>`GET` only; JSON or CSV; defaults to the current day</td></tr><tr><td>**Extension**</td><td>`/extensions`</td><td>Tenant API key</td><td>`number or ex_number`; `GET /extensions/state` for live state</td></tr><tr><td>**Tenant**</td><td>`/tenants`</td><td>Global API key</td><td>`te_name`, `te_code`</td></tr><tr><td>**User**</td><td>`/users`</td><td>Global API key</td><td>`us_username`</td></tr><tr><td>**User Profile**</td><td>`/userprofiles`</td><td>Global API key</td><td>`up_name`</td></tr><tr><td>**Routing Profile**</td><td>`/routingprofiles`</td><td>Global API key</td><td>`rp_name`</td></tr><tr><td>**Provider**</td><td>`/providers`</td><td>Global API key</td><td>`pr_name`</td></tr><tr><td>**Voicemail**</td><td>`/voicemails`</td><td>Tenant API key</td><td>`mailbox`</td></tr><tr><td>**IVR**</td><td>`/ivrs`</td><td>Tenant API key</td><td>`iv_name`</td></tr><tr><td>**Custom Destination**</td><td>`/customdestinations`</td><td>Tenant API key or global key with global=1</td><td>`cu_name`, `cu_ct_id`</td></tr><tr><td>**Condition**</td><td>`/conditions`</td><td>Tenant API key</td><td>`co_type`</td></tr><tr><td>**Hunt List**</td><td>`/huntlists`</td><td>Tenant API key</td><td>`hu_name`</td></tr><tr><td>**DID**</td><td>`/dids`</td><td>Tenant API key</td><td>`di_number`</td></tr><tr><td>**Queue**</td><td>`/queues`</td><td>Tenant API key; agent actions require a writable full key and an exact tenant</td><td>CRUD; `GET /queues/{id}/state` for live state; `POST /queues/{queueId}/agents/{agentId}/{login|logout|pause|unpause}` for agent actions</td></tr><tr><td>**Setting**</td><td>`/settings`</td><td>Tenant API key or global key with global=1</td><td>`se_code`</td></tr><tr><td>**Media File**</td><td>`/mediafiles`; `/mediafiles/{id}/download`</td><td>Tenant or global key for metadata; full key required to download audio</td><td>`me_name`; [binary download examples](/link/1701#bkmrk-download-a-media-fil)</td></tr><tr><td>**Music On Hold**</td><td>`/musiconholds`</td><td>Tenant API key or global key with global=1</td><td>`mu_name`</td></tr><tr><td>**Paging Group**</td><td>`/paginggroups`</td><td>Tenant API key</td><td>`pa_name`, `pa_number`</td></tr><tr><td>**Conference Room**</td><td>`/conferencerooms`</td><td>Tenant API key</td><td>`cr_name`, `cr_number`</td></tr><tr><td>**Flow**</td><td>`/flows`</td><td>Tenant API key</td><td>`fl_name`</td></tr><tr><td>**Tenant Variable**</td><td>`/tenantvariables`</td><td>Tenant API key</td><td>`tv_al_id`</td></tr><tr><td>**DISA**</td><td>`/disas`</td><td>Tenant API key</td><td>`ds_name`</td></tr><tr><td>**Caller ID Blacklist**</td><td>`/calleridblacklists`</td><td>Tenant API key or global key with global=1</td><td>`bl_callerid`</td></tr><tr><td>**Campaign**</td><td>`/campaigns`</td><td>Tenant API key</td><td>`ca_name`</td></tr><tr><td>**Campaign Number**</td><td>`/campaignnumbers`</td><td>Tenant API key</td><td>`cn_ca_id`, `cn_number`</td></tr><tr><td>**Cron Job**</td><td>`/cronjobs`</td><td>Tenant API key or global key with global=1</td><td>`cr_name`</td></tr><tr><td>**Feature Code**</td><td>`/featurecodes`</td><td>Tenant API key or global key with global=1</td><td>`fe_code`</td></tr><tr><td>**Short Number**</td><td>`/shortnumbers`</td><td>Tenant API key or global key with global=1</td><td>`sn_number`</td></tr><tr><td>**Phone Book**</td><td>`/phonebooks`</td><td>Tenant API key</td><td>`pb_name`</td></tr><tr><td>**Phone Book Entry**</td><td>`/phonebookentries`</td><td>Tenant API key</td><td>`phonebook_id`, `at least one value`</td></tr><tr><td>**Provisioning Phone**</td><td>`/provisioningphones`</td><td>Tenant API key</td><td>`ph_name`, `ph_mac`</td></tr></tbody></table>

## 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](/link/1977#phonebook-entry-collection) 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](/books/api/page/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](/link/1701#bkmrk-download-a-media-fil) for curl examples, response headers, storage support and errors.

# Extension State

The **Extension State** endpoint returns live call-state information for one extension. It is a read-only OpenAPI endpoint and supports `GET` only.

This endpoint checks the extension registration server and queries Asterisk manager for the active channel, matching the purpose of `proxyapi.php?reqtype=info&info=extstate`. The regular extension `GET` endpoint still returns the cached `st_states` value.

## Endpoint

```
GET https://pbx.example.com/pbx/openapi.php/extensions/state?tenant=CANISTRACCI&number=100
```

<table id="bkmrk-parameterrequireddes"><thead><tr><th>Parameter</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>`tenant`</td><td>Yes</td><td>Tenant code or tenant name.</td></tr><tr><td>`number`</td><td>Yes, unless `ext` is used</td><td>Extension number to check.</td></tr><tr><td>`ext`</td><td>Yes, unless `number` is used</td><td>Compatibility alias for `number`.</td></tr><tr><td>`key`</td><td>No, if using headers</td><td>API key. The key can also be sent with `X-API-Key` or `Authorization: Bearer`.</td></tr></tbody></table>

## Examples

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/extensions/state?tenant=CANISTRACCI&number=100"

curl -H "Authorization: Bearer TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/extensions/state?tenant=CANISTRACCI&ext=100"
```

## Response

When an active matching channel is found, the endpoint returns the live channel fields used to identify the call and the other party.

```
{
  "UniqueID": "1717240000.42",
  "LinkedID": "1717240000.42",
  "Connected Line ID": "39055123456",
  "Connected Line ID Name": "Customer",
  "Context": "authenticated",
  "Extension": "39055123456",
  "Direction": "IN",
  "OtherParty": "39055123456"
}
```

When the extension exists but no registration server is available, the endpoint returns:

```
{
  "UniqueID": "KO",
  "LinkedID": "Extension not registered",
  "Connected Line ID": "",
  "Connected Line ID Name": "",
  "Context": "",
  "Extension": "",
  "Direction": "",
  "OtherParty": ""
}
```

## Notes

- The endpoint requires a tenant context, even when using a global API key.
- If the extension is registered but has no active channel, the live fields are returned empty.
- The response is always JSON.

# Auth Token

The **Auth Token** endpoint generates or resets temporary login tokens for web users and extension web identities. The generated token can be used in place of the user password on the MiRTA PBX login page.

## Authentication Scope

This endpoint always requires the global full API key. Tenant API keys and read-only API keys are rejected. The token is returned only once when it is generated, so store it securely in the calling system if it needs to be delivered to the user.

<table id="bkmrk-operationpathapi-key"><thead><tr><th>Operation</th><th>Path</th><th>API key</th></tr></thead><tbody><tr><td>Generate token</td><td>`POST https://pbx.example.com/pbx/openapi.php/auth/token`</td><td>`GLOBAL_API_KEY`</td></tr><tr><td>Reset token</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/auth/token`</td><td>`GLOBAL_API_KEY`</td></tr></tbody></table>

## Supported Identities

The user value is resolved in the same order as the legacy ProxyAPI token feature: MiRTA PBX web users first, then extension web users, then SIP extension usernames, then PJSIP endpoint IDs when the extension does not have a separate web user.

<table id="bkmrk-identity-typematched"><thead><tr><th>Identity type</th><th>Matched field</th></tr></thead><tbody><tr><td>Web user</td><td>`us_users.us_username`</td></tr><tr><td>Extension web user</td><td>`ex_extensions.ex_webuser`</td></tr><tr><td>SIP extension username</td><td>`sipfriends.name` when `ex_webuser` is empty</td></tr><tr><td>PJSIP endpoint ID</td><td>`ps_endpoints.id` when `ex_webuser` is empty</td></tr></tbody></table>

## Generate Token

Use `validity` set to `ONCE` for a single-use token, or provide a date/time string to make the token valid until that time.

```
curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user":"100","validity":"ONCE"}' \
  "https://pbx.example.com/pbx/openapi.php/auth/token"
```

Successful response:

```
{
  "token": "generated-token-value",
  "user": "100",
  "target_type": "WEBPASSWORD"
}
```

## Generate Expiring Token

```
curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user":"api.operator","validity":"2026-06-30 23:59:59"}' \
  "https://pbx.example.com/pbx/openapi.php/auth/token"
```

## Reset Token

Resetting a token clears the stored token hash and validity for the resolved user identity.

```
curl -X DELETE \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user":"100"}' \
  "https://pbx.example.com/pbx/openapi.php/auth/token"
```

Successful response:

```
{
  "reset": true,
  "user": "100",
  "target_type": "WEBPASSWORD"
}
```

## Important Notes

- Only the generated token value is returned. MiRTA PBX stores a SHA-256 hash of the token.
- A single-use token is cleared after a successful login.
- Generating a new token replaces any previous token for that user identity.
- This endpoint manages login tokens only. It does not create or rotate OpenAPI API keys.

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match a valid API key.</td></tr><tr><td>`admin_required`</td><td>A global API key is required.</td></tr><tr><td>`read_only_api_key`</td><td>The supplied key is read-only and cannot generate or reset tokens.</td></tr><tr><td>`missing_user`</td><td>The request body did not include a user value.</td></tr><tr><td>`invalid_validity`</td><td>The validity value was not ONCE and could not be parsed as a date/time.</td></tr><tr><td>`user_not_found`</td><td>No supported web user or extension identity matched the requested user value.</td></tr></tbody></table>

# Dial

The **Dial** endpoint originates a call between a source extension and a destination number. It is the OpenAPI equivalent of `proxyapi.php?reqtype=DIAL` and uses the same PBX dialplan contexts.

The endpoint requires a tenant context and a full API key. Read-only API keys cannot originate calls.

## Endpoint

```
POST https://pbx.example.com/pbx/openapi.php/dial?tenant=CANISTRACCI
```

<table id="bkmrk-parameterrequireddes"><thead><tr><th>Parameter</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>`tenant`</td><td>Yes</td><td>Tenant code or tenant name.</td></tr><tr><td>`key`</td><td>No, if using headers</td><td>Full API key. The key can also be sent with `X-API-Key` or `Authorization: Bearer`.</td></tr></tbody></table>

## Request Body

<table id="bkmrk-fieldrequireddescrip"><thead><tr><th>Field</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>`source`</td><td>Yes</td><td>Source extension. Compatibility aliases are `exten` and `?exten`.</td></tr><tr><td>`dest`</td><td>Yes</td><td>Destination number. Compatibility alias is `phone`.</td></tr><tr><td>`dialtimeout`</td><td>No</td><td>Originate timeout in seconds. Defaults to `30`.</td></tr><tr><td>`timeout`</td><td>No</td><td>Sets the dialplan variable `SETTIMEOUT`.</td></tr><tr><td>`sourceclid`</td><td>No</td><td>Sets `SETSOURCECLID`.</td></tr><tr><td>`destclid`</td><td>No</td><td>Sets `SETDESTCLID`.</td></tr><tr><td>`logqueueoutbound`</td><td>No</td><td>Sets `SETLOGQUEUEOUTBOUND`.</td></tr><tr><td>`recording`</td><td>No</td><td>Sets `SETRECORDING`.</td></tr><tr><td>`autoanswer`</td><td>No</td><td>Sets `AUTOANSWER`.</td></tr><tr><td>`nofollow`</td><td>No</td><td>Sets `SETNOFOLLOWEXTENSION`.</td></tr><tr><td>`account`</td><td>No</td><td>Peer account name to set as `SETPEERNAME`. Use `SOURCE` to resolve it from the source extension.</td></tr><tr><td>`server`</td><td>No</td><td>PBX node peer name to use when the source or destination registration server cannot be found.</td></tr><tr><td>`var`</td><td>No</td><td>Comma-separated custom variables, for example `campaign=summer,lead=42`.</td></tr><tr><td>`vars`</td><td>No</td><td>Custom variables as a JSON object. Variables are tenant-prefixed and listed in `VARLIST`.</td></tr></tbody></table>

## Example

```
curl -X POST "https://pbx.example.com/pbx/openapi.php/dial?tenant=CANISTRACCI" \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "100",
    "dest": "39055123456",
    "dialtimeout": 30,
    "sourceclid": "100",
    "recording": "yes",
    "vars": {
      "campaign": "summer",
      "lead": "42"
    }
  }'
```

## Response

The response includes the Asterisk manager originate result, the generated originate ID, and the selected PBX node.

```
{
  "Response": "Success",
  "Message": "Originate successfully queued",
  "ID": "6867c1c5.12345678",
  "source": "100",
  "dest": "39055123456",
  "server": "pbx-node-1",
  "node": "PBX Node 1"
}
```

## Compatibility Notes

- `source=ACCOUNT` resolves the source extension number from the `account` peer name.
- `account=SOURCE` resolves the peer name from the source extension and sets `SETPEERNAME`.
- If a source or destination registration server is found, that node is used. If no registration server is found, pass `server` with the node peer name.
- The endpoint returns JSON only.

# Live Call Transfer

The **Live Call Transfer** endpoint transfers an active Asterisk channel. It supports blind transfer through the Asterisk Manager `Redirect` action and attended transfer through `Atxfer`.

## Endpoint

```
POST https://pbx.example.com/pbx/openapi.php/calls/transfer?tenant=CANISTRACCI
```

A writable tenant or global full API key is required. The `tenant` query parameter must exactly match the tenant code or tenant name; wildcards and read-only keys are rejected. Before sending the manager action, the API verifies that the selected live channel has the selected tenant's account code.

## Request Body

<table id="bkmrk-fieldrequireddescrip"> <thead><tr><th>Field</th><th>Required</th><th>Description</th></tr></thead> <tbody> <tr><td>`channel`</td><td>One of `channel` or `uniqueid`</td><td>Exact active Asterisk channel name, for example `PJSIP/101-00000042`.</td></tr> <tr><td>`uniqueid`</td><td>One of `channel` or `uniqueid`</td><td>Asterisk channel UniqueID. If both identifiers are supplied, they must resolve to the same live channel.</td></tr> <tr><td>`destination`</td><td>Yes</td><td>Destination run at priority `1` in the `authenticated` dialplan context.</td></tr> <tr><td>`type`</td><td>No</td><td>`blind` or `attended`. Defaults to `blind`.</td></tr> <tr><td>`extra_channel`</td><td>No</td><td>Optional second channel sent with a blind `Redirect`. It must be a different channel on the same PBX node and belong to the same tenant. It is not accepted for an attended transfer.</td></tr> <tr><td>`server`</td><td>No</td><td>PBX node peer name. Use it to limit channel discovery or disambiguate an identical channel name found on more than one node.</td></tr> </tbody></table>

The `UniqueID` returned by the Extension State endpoint can be supplied as `uniqueid`. Queue State also returns the live channel name for waiting callers.

## Blind Transfer

A blind transfer immediately redirects the selected channel to the destination. This is the default type.

```
curl -X POST "https://pbx.example.com/pbx/openapi.php/calls/transfer?tenant=CANISTRACCI" \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "uniqueid": "1783680000.25",
    "destination": "200",
    "type": "blind"
  }'
```

When a dual-channel redirect is required, include the other active channel in `extra_channel`. Both channels are checked on the same node and against the same tenant before Asterisk receives the request.

## Attended Transfer

An attended transfer starts Asterisk's attended-transfer process on the selected channel. The person controlling that channel conducts the consultation and completes or cancels it using the normal Asterisk transfer behavior.

```
curl -X POST "https://pbx.example.com/pbx/openapi.php/calls/transfer?tenant=CANISTRACCI" \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "PJSIP/101-00000042",
    "destination": "200",
    "type": "attended"
  }'
```

## Response

```
{
  "object": "call_transfer",
  "status": "accepted",
  "type": "blind",
  "channel": "PJSIP/101-00000042",
  "uniqueid": "1783680000.25",
  "extra_channel": "",
  "destination": "200",
  "context": "authenticated",
  "priority": 1,
  "server": {
    "id": 1,
    "name": "PBX 01",
    "peername": "pbx01"
  },
  "asterisk": {
    "response": "Success",
    "message": "Redirect successful",
    "actionid": "openapi-transfer-..."
  }
}
```

`status=accepted` means Asterisk accepted the manager action. It does not confirm that the destination answered or that the transfer completed successfully.

## Channel Selection and Safety

- Channel discovery reads current state directly from the configured PBX nodes.
- Only channels whose Asterisk account code exactly matches the selected tenant can be transferred.
- If the same channel identifier exists on more than one node, the request returns an ambiguity error. Supply `server` to choose the intended node.
- The channel and optional extra channel are checked again immediately before the transfer action to detect a call that ended or changed during the request.
- The dialplan context and priority are fixed to `authenticated,1` and cannot be overridden by the request.

## Relevant Errors

<table id="bkmrk-http-statuscodedescr"> <thead><tr><th>HTTP status</th><th>Code</th><th>Description</th></tr></thead> <tbody> <tr><td>400</td><td>`exact_tenant_required`</td><td>The tenant is missing, uses a wildcard, or does not exactly match the authenticated tenant.</td></tr> <tr><td>400</td><td>`missing_call_identifier`</td><td>Neither `channel` nor `uniqueid` was supplied.</td></tr> <tr><td>400</td><td>`invalid_transfer_type`</td><td>`type` is not `blind` or `attended`.</td></tr> <tr><td>400</td><td>`extra_channel_not_allowed`</td><td>An extra channel was supplied for an attended transfer.</td></tr> <tr><td>404</td><td>`channel_not_found`</td><td>No active channel matches the identifier and tenant.</td></tr> <tr><td>404</td><td>`extra_channel_not_found`</td><td>The extra channel is not active on the selected node for the same tenant.</td></tr> <tr><td>409</td><td>`ambiguous_channel`</td><td>More than one PBX node has a matching channel; supply `server`.</td></tr> <tr><td>409</td><td>`call_state_changed`</td><td>The call changed between discovery and execution; obtain current channel information and retry.</td></tr> <tr><td>502</td><td>`channel_state_unavailable`</td><td>Live channel state could not be read from the selected PBX nodes.</td></tr> <tr><td>502</td><td>`transfer_rejected`</td><td>Asterisk rejected the `Redirect` or `Atxfer` action.</td></tr> </tbody></table>

# CDR

The **CDR** endpoint is a read-only reporting endpoint. It supports `GET` only; create, update, and delete methods return `method_not_allowed`. Tenant API keys must include `tenant=CANISTRACCI`. Global API keys can query one tenant by code or name, or use SQL-style `%` wildcards in the tenant parameter.

## Object Summary

<table id="bkmrk-propertyvalueobjectc"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`cdr`</td></tr><tr><td>Primary path</td><td>`/cdrs`</td></tr><tr><td>Path aliases</td><td>`/cdr`, `/cdrs`, `/call`, `/calls`</td></tr><tr><td>Supported method</td><td>`GET`</td></tr><tr><td>Default format</td><td>`json`</td></tr><tr><td>Compatibility formats</td><td>`template`, `xml`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List records</td><td>`GET https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI`</td></tr><tr><td>Filter by date range</td><td>`GET https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&start=2026-06-01%2000%3A00%3A00&end=2026-06-01%2023%3A59%3A59`</td></tr><tr><td>Filter by ID from the path</td><td>`GET https://pbx.example.com/pbx/openapi.php/cdrs/RECORD_ID?tenant=CANISTRACCI`</td></tr><tr><td>Template/XML compatibility output</td><td>`GET https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&format=template&template=Docs%20Export`</td></tr></tbody></table>

## Query Parameters

<table id="bkmrk-parameterdescription"><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`tenant`</td><td>Tenant code or tenant name. Global API keys can use % wildcards; tenant API keys are restricted to their tenant.</td></tr><tr><td>`start`</td><td>Start date and time. Defaults to today at 00:00:00.</td></tr><tr><td>`end`</td><td>End date and time. Defaults to today at 23:59:59.</td></tr><tr><td>`id`</td><td>Comma-separated CDR ID values. A path value such as /cdrs/123 also maps to this filter.</td></tr><tr><td>`uniqueid`</td><td>Comma-separated Asterisk unique ID values.</td></tr><tr><td>`linkedid`</td><td>Comma-separated linked ID values used to group call legs.</td></tr><tr><td>`src`</td><td>Comma-separated source values.</td></tr><tr><td>`firstdst`</td><td>Comma-separated first destination values.</td></tr><tr><td>`disposition`</td><td>Comma-separated disposition values such as ANSWERED, NO ANSWER, BUSY, or FAILED.</td></tr><tr><td>`direction`</td><td>Direction filter based on the CDR userfield mapping. Accepted values are IN, OUT, IN,OUT, and OUT,IN.</td></tr><tr><td>`phone`</td><td>Comma-separated phone values searched across src, dst, firstdst, lastdst, realsrc, and wherelanded.</td></tr><tr><td>`format`</td><td>Response format. Defaults to json. Use template or xml for template-based compatibility output.</td></tr><tr><td>`template`</td><td>Template name from the tenant XML templates. Used only with format=template or format=xml.</td></tr><tr><td>`contenttype`</td><td>Optional Content-Type header for rendered template output.</td></tr></tbody></table>

## Response Fields

<table id="bkmrk-fielddescriptionacco"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td>`accountcode`</td><td>Tenant code stored on the CDR.</td></tr><tr><td>`ID`</td><td>Internal CDR row ID.</td></tr><tr><td>`start`</td><td>Call start timestamp.</td></tr><tr><td>`answer`</td><td>Answer timestamp when the call was answered.</td></tr><tr><td>`end`</td><td>Call end timestamp.</td></tr><tr><td>`clid`</td><td>Full caller ID string.</td></tr><tr><td>`realsrc`</td><td>Normalized or real source value.</td></tr><tr><td>`firstdst`</td><td>First dialed destination tracked by MiRTA PBX.</td></tr><tr><td>`duration`</td><td>Total call duration in seconds.</td></tr><tr><td>`billsec`</td><td>Answered talk time in seconds.</td></tr><tr><td>`disposition`</td><td>Asterisk call disposition.</td></tr><tr><td>`cc_cost`</td><td>Calculated tenant-side call cost when available.</td></tr><tr><td>`dcontext`</td><td>Asterisk destination context.</td></tr><tr><td>`dstchannel`</td><td>Destination channel.</td></tr><tr><td>`userfield`</td><td>MiRTA PBX call marker, commonly including inbound or outbound direction information.</td></tr><tr><td>`uniqueid`</td><td>Asterisk unique ID for the CDR leg.</td></tr><tr><td>`prevuniqueid`</td><td>Previous unique ID for linked call-leg processing.</td></tr><tr><td>`lastdst`</td><td>Last destination reached by the call.</td></tr><tr><td>`wherelanded`</td><td>Final PBX object or destination where the call landed.</td></tr><tr><td>`src`</td><td>Asterisk source value.</td></tr><tr><td>`dst`</td><td>Asterisk destination value.</td></tr><tr><td>`lastapp`</td><td>Last Asterisk application executed.</td></tr><tr><td>`srcCallID`</td><td>Source SIP Call-ID when available.</td></tr><tr><td>`linkedid`</td><td>Asterisk linked ID used to group related CDR legs.</td></tr><tr><td>`peeraccount`</td><td>Asterisk peer account value.</td></tr><tr><td>`originateid`</td><td>Origination tracking ID when available.</td></tr><tr><td>`cc_country`</td><td>Rated country when rating data is available.</td></tr><tr><td>`cc_network`</td><td>Rated network when rating data is available.</td></tr><tr><td>`pincode`</td><td>PIN code associated with the call when present.</td></tr><tr><td>`cc_buy`</td><td>Calculated buy-side cost when available.</td></tr></tbody></table>

## Important Notes

- When neither id nor uniqueid is supplied, the endpoint applies the start/end date range.
- When neither id nor linkedid is supplied, the endpoint also applies the start/end date range.
- Template and XML compatibility output require the request to resolve to exactly one tenant.
- The endpoint may repair attended-transfer and where-landed CDR metadata while preparing results.

## Examples

### List Today CDRs

Returns CDR rows for the selected tenant using today as the default date range.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI"
```

### CDR Date Range

Limits results to an explicit date and time window.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&start=2026-06-01%2000%3A00%3A00&end=2026-06-01%2023%3A59%3A59"
```

### CDR by Path ID

Uses the path segment after /cdrs as a CDR ID filter.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs/123456?tenant=CANISTRACCI"
```

### CDR by ID and Unique ID

Filters by one or more CDR row IDs and one or more Asterisk unique IDs.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&id=123456%2C123457&uniqueid=1717240000.42"
```

### CDR by Linked ID

Returns all matching CDR legs associated with one linked call.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&linkedid=1717240000.42"
```

### CDR Source Destination and Disposition

Combines source, first destination, and disposition filters.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&src=100&firstdst=15551234567&disposition=ANSWERED"
```

### CDR Direction

Filters by outbound calls using the MiRTA PBX CDR userfield mapping.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&direction=OUT"
```

### CDR Phone Search

Searches phone values across the main CDR source and destination columns.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&phone=100%2C15551234567"
```

### CDR Global Tenant Wildcard

Uses a global key and a tenant wildcard to query matching tenants.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CAN%25&start=2026-06-01%2000%3A00%3A00&end=2026-06-01%2023%3A59%3A59"
```

### CDR Template Output

Renders rows through a tenant XML/template definition. This requires exactly one tenant.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&format=template&template=Docs%20CDR%20Export&contenttype=text%2Fcsv"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code or tenant name is required when using a tenant API key.</td></tr><tr><td>`single_tenant_required`</td><td>Template output requires the request to resolve to exactly one tenant.</td></tr><tr><td>`template_not_found`</td><td>The selected XML/template output template does not exist for the tenant.</td></tr><tr><td>`method_not_allowed`</td><td>The endpoint is read-only and only supports GET.</td></tr></tbody></table>

# Simple CDR

The **Simple CDR** endpoint is a read-only reporting endpoint. It supports `GET` only; create, update, and delete methods return `method_not_allowed`. Tenant API keys must include `tenant=CANISTRACCI`. Global API keys can query one tenant by code or name, or use SQL-style `%` wildcards in the tenant parameter.

## Object Summary

<table id="bkmrk-propertyvalueobjects"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`simplecdr`</td></tr><tr><td>Primary path</td><td>`/simplecdrs`</td></tr><tr><td>Path aliases</td><td>`/simplecdr`, `/simplecdrs`, `/simple_cdr`, `/simple_cdrs`</td></tr><tr><td>Supported method</td><td>`GET`</td></tr><tr><td>Default format</td><td>`json`</td></tr><tr><td>Compatibility formats</td><td>`template`, `xml`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List records</td><td>`GET https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI`</td></tr><tr><td>Filter by date range</td><td>`GET https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&start=2026-06-01%2000%3A00%3A00&end=2026-06-01%2023%3A59%3A59`</td></tr><tr><td>Filter by ID from the path</td><td>`GET https://pbx.example.com/pbx/openapi.php/simplecdrs/RECORD_ID?tenant=CANISTRACCI`</td></tr><tr><td>Template/XML compatibility output</td><td>`GET https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&format=template&template=Docs%20Export`</td></tr></tbody></table>

## Query Parameters

<table id="bkmrk-parameterdescription"><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`tenant`</td><td>Tenant code or tenant name. Global API keys can use % wildcards; tenant API keys are restricted to their tenant.</td></tr><tr><td>`start`</td><td>Start date and time. Defaults to today at 00:00:00.</td></tr><tr><td>`end`</td><td>End date and time. Defaults to today at 23:59:59.</td></tr><tr><td>`id`</td><td>Comma-separated simple CDR ID values. A path value such as /simplecdrs/123 also maps to this filter.</td></tr><tr><td>`uniqueid`</td><td>Comma-separated Asterisk unique ID values.</td></tr><tr><td>`calleridnum`</td><td>Comma-separated caller ID number values.</td></tr><tr><td>`calleridname`</td><td>Comma-separated caller ID name values.</td></tr><tr><td>`disposition`</td><td>Comma-separated disposition values such as ANSWERED, NO ANSWER, BUSY, or FAILED.</td></tr><tr><td>`direction`</td><td>Comma-separated simple CDR directions, such as IN, OUT, or LOCAL.</td></tr><tr><td>`dialednum`</td><td>Comma-separated dialed number values.</td></tr><tr><td>`whoanswered`</td><td>Comma-separated values for the extension, user, or object that answered.</td></tr><tr><td>`phone`</td><td>Comma-separated phone values searched across sc\_whoanswered, sc\_calleridnum, and sc\_dialednum.</td></tr><tr><td>`minduration`</td><td>Minimum total call duration in seconds, exclusive.</td></tr><tr><td>`mintalktime`</td><td>Minimum answered talk time in seconds, exclusive.</td></tr><tr><td>`format`</td><td>Response format. Defaults to json. Use template or xml for template-based compatibility output.</td></tr><tr><td>`template`</td><td>Template name from the tenant XML templates. Used only with format=template or format=xml.</td></tr><tr><td>`contenttype`</td><td>Optional Content-Type header for rendered template output.</td></tr></tbody></table>

## Response Fields

<table id="bkmrk-fielddescriptionsc_t"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td>`sc_te_id`</td><td>Internal tenant ID.</td></tr><tr><td>`tenantcode`</td><td>Tenant code.</td></tr><tr><td>`sc_start`</td><td>Simple CDR start timestamp.</td></tr><tr><td>`sc_direction`</td><td>Simple direction value, such as IN, OUT, or LOCAL.</td></tr><tr><td>`sc_calleridnum`</td><td>Caller ID number.</td></tr><tr><td>`sc_calleridname`</td><td>Caller ID name.</td></tr><tr><td>`sc_dialednum`</td><td>Dialed number.</td></tr><tr><td>`sc_disposition`</td><td>Call disposition.</td></tr><tr><td>`sc_duration`</td><td>Total call duration in seconds.</td></tr><tr><td>`sc_billsec`</td><td>Answered talk time in seconds.</td></tr><tr><td>`sc_uniqueid`</td><td>Asterisk unique ID represented by the simple CDR row.</td></tr><tr><td>`sc_whoanswered`</td><td>Extension, user, or object that answered the call.</td></tr></tbody></table>

## Template Variables

When `format=template` or `format=xml` is used, variables inside the `{row_loop}` section are replaced for each returned row.

<table id="bkmrk-variabledescription%7B"><thead><tr><th>Variable</th><th>Description</th></tr></thead><tbody><tr><td>`{$end}`</td><td>Computed end timestamp from sc\_start plus sc\_duration seconds.</td></tr><tr><td>`{$clid}`</td><td>CDR-style caller ID formatted as "sc\_calleridname" &lt;sc\_calleridnum&gt;.</td></tr><tr><td>`{$callerid_number}`</td><td>Alias for sc\_calleridnum.</td></tr><tr><td>`{$callerid_name}`</td><td>Alias for sc\_calleridname.</td></tr><tr><td>`{$firstdst}`</td><td>Alias for sc\_dialednum.</td></tr><tr><td>`{$talk_time}`</td><td>Alias for sc\_billsec.</td></tr><tr><td>`{$who_answered}`</td><td>Alias for sc\_whoanswered.</td></tr></tbody></table>

## Important Notes

- When neither id nor uniqueid is supplied, the endpoint applies the start/end date range.
- The mintalktime filter uses the stored simple CDR billsec/talk-time value.
- Template and XML compatibility output require the request to resolve to exactly one tenant.

## Examples

### List Today Simple CDRs

Returns simplified call history rows for the selected tenant using today as the default date range.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI"
```

### Simple CDR Date Range

Limits simple CDR results to an explicit date and time window.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&start=2026-06-01%2000%3A00%3A00&end=2026-06-01%2023%3A59%3A59"
```

### Simple CDR by Path ID

Uses the path segment after /simplecdrs as a simple CDR ID filter.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs/98765?tenant=CANISTRACCI"
```

### Simple CDR by ID and Unique ID

Filters by one or more simple CDR row IDs and unique IDs.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&id=98765%2C98766&uniqueid=1717240000.42"
```

### Simple CDR Caller and Dialed Number

Combines caller number, caller name, and dialed number filters.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&calleridnum=15551234567&calleridname=Docs%20Caller&dialednum=100"
```

### Simple CDR Direction and Disposition

Filters by simple direction values and disposition.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&direction=IN%2COUT&disposition=ANSWERED"
```

### Simple CDR Who Answered

Filters by the extension or object that answered the call.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&whoanswered=100"
```

### Simple CDR Phone Search

Searches across caller ID number, dialed number, and who answered.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&phone=100%2C15551234567"
```

### Simple CDR Minimum Durations

Returns calls longer than the supplied total duration and talk-time thresholds.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&minduration=30&mintalktime=10"
```

### Simple CDR Global Tenant Wildcard

Uses a global key and a tenant wildcard to query matching tenants.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CAN%25&start=2026-06-01%2000%3A00%3A00&end=2026-06-01%2023%3A59%3A59"
```

### Simple CDR Template Output

Renders simple CDR rows through a tenant XML/template definition. This requires exactly one tenant.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/simplecdrs?tenant=CANISTRACCI&format=template&template=Docs%20Simple%20CDR%20Export&contenttype=text%2Fcsv"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code or tenant name is required when using a tenant API key.</td></tr><tr><td>`single_tenant_required`</td><td>Template output requires the request to resolve to exactly one tenant.</td></tr><tr><td>`template_not_found`</td><td>The selected XML/template output template does not exist for the tenant.</td></tr><tr><td>`method_not_allowed`</td><td>The endpoint is read-only and only supports GET.</td></tr></tbody></table>

# Extension

The **Extension** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjecte"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`extension`</td></tr><tr><td>Primary path</td><td>`/extensions`</td></tr><tr><td>ID field</td><td>`ex_id`</td></tr><tr><td>Label field</td><td>`ex_number`</td></tr><tr><td>Primary source table</td><td>`ex_extensions`</td></tr><tr><td>Required on create</td><td>`number or ex_number`</td></tr><tr><td>Path aliases</td><td>`/extensions`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`number`</td><td>`ex_number`</td></tr><tr><td>`name`</td><td>`ex_name`</td></tr><tr><td>`tech`</td><td>`ex_tech`</td></tr><tr><td>`sipusername`</td><td>`username`</td></tr><tr><td>`mailbox`</td><td>`ex_mailbox`</td></tr><tr><td>`email`</td><td>`ex_email`</td></tr><tr><td>`password`</td><td>`technology secret/password`</td></tr><tr><td>`callgroups`</td><td>`ex_callgroup`</td></tr><tr><td>`pickupgroups`</td><td>`ex_pickupgroup`</td></tr><tr><td>`realextensions`</td><td>`virtual_items`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`EXT-UNCONDITIONAL`</td><td>`unconditional`</td></tr><tr><td>`EXT-NOANSWER`</td><td>`onnoanswer`, `noanswer`, `no_answer`</td></tr><tr><td>`EXT-BUSY`</td><td>`onbusy`, `busy`</td></tr><tr><td>`EXT-OFFLINE`</td><td>`onoffline`, `offline`</td></tr><tr><td>`EXT-ONCONDITION`</td><td>`oncondition`, `condition`</td></tr><tr><td>`EXT-DIALBYNAME`</td><td>`dialbyname`, `dial_by_name`</td></tr><tr><td>`EXT-ONLYALLOWCALL`</td><td>`onlyallowcall`, `only_allow_call`</td></tr><tr><td>`EXT-DONOTCALL`</td><td>`donotcall`, `do_not_call`</td></tr></tbody></table>

## Important Notes

- Supported technologies are SIP, PJSIP, CUSTOM, and VIRTUAL.
- When username is not supplied, the API generates number-tenantcode, for example 100-CANISTRACCI.
- Nested technology data can be supplied with sipfriends, ps\_endpoints, ps\_aors, ps\_auths, ce\_customextensions, or ve\_virtualextensions.

## Examples

### List Extensions

Returns extension ID, number, name, and technology for the tenant.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI"
```

### Get Extension

Reads one extension by internal ID and includes related technology data.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Get Extension by Number

Reads an extension by PBX number. Keep the tenant parameter when the same number may exist in multiple tenants.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/extensions/number/100?tenant=CANISTRACCI"
```

### Create PJSIP Extension

Creates a PJSIP extension and optional endpoint/AOR details.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "100",
  "name": "Ada Rivera",
  "tech": "PJSIP",
  "password": "change-this-secret",
  "email": "ada.rivera@example.com",
  "ps_endpoints": {
    "transport": "transport-udp",
    "direct_media": "no"
  },
  "ps_aors": {
    "max_contacts": 1,
    "remove_existing": "yes"
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI"
```

### Create SIP Extension

Creates a chan\_sip extension and optional SIP peer fields.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "101",
  "name": "Bruno Long",
  "tech": "SIP",
  "password": "change-this-secret",
  "sipfriends": {
    "host": "dynamic",
    "nat": "force_rport,comedia"
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI"
```

### Create Custom Extension

Creates an extension that points to a custom dial string or custom endpoint behavior.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "102",
  "name": "Custom Doorphone",
  "tech": "CUSTOM",
  "ce_customextensions": {
    "ce_peername": "doorphone-main",
    "ce_destination": "Local/100@from-internal"
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI"
```

### Create Virtual Extension

Creates a virtual extension and maps it to real extension IDs.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "103",
  "name": "After Hours Virtual",
  "tech": "VIRTUAL",
  "realextensions": [
    100,
    101
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions?tenant=CANISTRACCI"
```

### Edit Extension

Updates only the supplied extension fields. To switch between SIP and PJSIP, use the dedicated [extension technology conversion endpoint](#bkmrk-extension-technology), or a technology-only PATCH. Send other extension edits separately.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Ada Rivera - Desk",
  "email": "ada.desk@example.com",
  "callgroups": [
    1
  ],
  "pickupgroups": [
    1
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Delete Extension

Deletes the extension, its technology row, and extension destinations.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension Unconditional Destination

Sets the `EXT-UNCONDITIONAL` destination using the `unconditional` alias.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "unconditional": [
    "EXT-101"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension No Answer Destination

Sets the `EXT-NOANSWER` destination using the `onnoanswer` alias.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onnoanswer": [
    "EXT-101"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension Busy Destination

Sets the `EXT-BUSY` destination using the `onbusy` alias.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onbusy": [
    "EXT-101"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension Offline Destination

Sets the `EXT-OFFLINE` destination using the `onoffline` alias.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onoffline": [
    "EXT-101"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension On Condition Destination

Sets the `EXT-ONCONDITION` destination using the `oncondition` alias.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "oncondition": [
    "EXT-101"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension Dial by Name Destination

Sets the `EXT-DIALBYNAME` destination using the `dialbyname` alias.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "dialbyname": [
    "EXT-101"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension Only Allow Call Destination

Sets the `EXT-ONLYALLOWCALL` destination using the `onlyallowcall` alias.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onlyallowcall": [
    "EXT-101"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension Do Not Call Destination

Sets the `EXT-DONOTCALL` destination using the `donotcall` alias.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "donotcall": [
    "EXT-101"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension Destinations Object Form

The destination aliases are convenient, but integrations can also send the database destination type names inside the destinations object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "destinations": {
    "EXT-BUSY": [
      "EXT-101"
    ],
    "EXT-NOANSWER": [
      "VOICEMAIL-100"
    ]
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/EXTENSION_ID?tenant=CANISTRACCI"
```

### Extension UNCONDITIONAL Destination

Updates the `EXT-UNCONDITIONAL` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "unconditional": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI"
```

### Extension NOANSWER Destination

Updates the `EXT-NOANSWER` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onnoanswer": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI"
```

### Extension BUSY Destination

Updates the `EXT-BUSY` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onbusy": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI"
```

### Extension OFFLINE Destination

Updates the `EXT-OFFLINE` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onoffline": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI"
```

### Extension ONCONDITION Destination

Updates the `EXT-ONCONDITION` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "oncondition": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI"
```

### Extension DIALBYNAME Destination

Updates the `EXT-DIALBYNAME` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "dialbyname": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI"
```

### Extension ONLYALLOWCALL Destination

Updates the `EXT-ONLYALLOWCALL` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onlyallowcall": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI"
```

### Extension DONOTCALL Destination

Updates the `EXT-DONOTCALL` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "donotcall": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/extensions/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

## Extension technology conversion

The endpoint requires a full API key and the appropriate tenant scope. The `{id}` is the extension database ID, not its dialled number. Use `{"technology":"PJSIP"}` for SIP-to-PJSIP conversion, or `{"technology":"SIP"}` to change back. Send other extension edits separately.

`POST /extensions/{id}/technology` changes an extension between SIP, PJSIP, CUSTOM and VIRTUAL in one transaction. The extension ID, number, peer name, routing and queue memberships are preserved. SIP/PJSIP conversions retain the password and codec list unless replacements are supplied. Other technology fields are initialized from the target technology’s new-item defaults. Review target-specific settings after conversion; settings without an equivalent in the new technology are not migrated.

```
curl -X POST -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"technology":"PJSIP"}' \
  'https://pbx.example.com/pbx/openapi.php/extensions/8/technology?tenant=TENANT_CODE'
```

Optional fields: `secret` (or `password`), `allow` (codec string), `custom`, `virtual`, `providers` (CUSTOM provider IDs), and `items` (VIRTUAL member extension IDs). The custom object accepts `ce_dialoption, ce_auth_type, ce_auth_parameter, ce_usecid, ce_custom_param1`. The virtual object accepts supported columns among `ve_callerid, ve_mailbox, ve_timeout, ve_strategy`; unavailable installation columns are rejected. Send other extension edits in a separate request.

A technology-only PATCH to `/extensions/{id}` with `{"tech":"PJSIP"}` also converts. Query routing: POST `?object=extension&action=technology&id=8&tenant=TENANT_CODE`. Shared/custom PJSIP authentication or AOR links block conversion until normalized. An extension already used inside another virtual extension cannot become virtual. The response identifies the previous and new technology; a live PBX refresh failure returns a warning after the database change has committed. A database failure rolls the conversion back.

See [Additional Configuration Operations](/books/api/page/additional-configuration-operations) for complete request fields, scope rules and examples.

# Tenant

The **Tenant** object is supported by the MiRTA PBX OpenAPI endpoint. This object is managed at system scope and requires a global API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectt"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`tenant`</td></tr><tr><td>Primary path</td><td>`/tenants`</td></tr><tr><td>ID field</td><td>`te_id`</td></tr><tr><td>Label field</td><td>`te_name`</td></tr><tr><td>Primary source table</td><td>`te_tenants`</td></tr><tr><td>Required on create</td><td>`te_name`, `te_code`</td></tr><tr><td>Path aliases</td><td>`/tenants`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/tenants`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/tenants/OBJECT_ID`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/tenants`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/tenants/OBJECT_ID`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/tenants/OBJECT_ID`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`te_name`</td></tr><tr><td>`code`</td><td>`te_code`</td></tr><tr><td>`billingcode`</td><td>`te_billingcode`</td></tr><tr><td>`billing_code`</td><td>`te_billingcode`</td></tr><tr><td>`timezone`</td><td>`te_timezone`</td></tr><tr><td>`routing_profile_id`</td><td>`te_rp_id`</td></tr><tr><td>`campaign_routing_profile_id`</td><td>`te_campaign_rp_id`</td></tr><tr><td>`fax_routing_profile_id`</td><td>`te_fax_rp_id`</td></tr></tbody></table>

## Examples

### List Tenants

Returns the tenants visible to the key and scope.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/tenants"
```

### Get Tenant

Reads one object by its internal ID.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/tenants/OBJECT_ID"
```

### Create Tenant

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Tenant",
  "code": "DOCSAPI",
  "timezone": "Europe/Rome"
}' \
  "https://pbx.example.com/pbx/openapi.php/tenants"
```

### Edit Tenant

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "routing_profile_id": 3,
  "te_payment_type": "Post Paid"
}' \
  "https://pbx.example.com/pbx/openapi.php/tenants/OBJECT_ID"
```

### Delete Tenant

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/tenants/OBJECT_ID"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# User

The **User** object is supported by the MiRTA PBX OpenAPI endpoint. This object is managed at system scope and requires a global API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectu"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`user`</td></tr><tr><td>Primary path</td><td>`/users`</td></tr><tr><td>ID field</td><td>`us_id`</td></tr><tr><td>Label field</td><td>`us_username`</td></tr><tr><td>Primary source table</td><td>`us_users`</td></tr><tr><td>Required on create</td><td>`us_username`</td></tr><tr><td>Path aliases</td><td>`/user`, `/users`, `/nuser`, `/nusers`, `/us_user`, `/us_users`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/users`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/users`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`username`</td><td>`us_username`</td></tr><tr><td>`name`</td><td>`us_username`</td></tr><tr><td>`description`</td><td>`us_description`</td></tr><tr><td>`email`</td><td>`us_email`</td></tr><tr><td>`profile_id`</td><td>`us_up_id`</td></tr><tr><td>`userprofile_id`</td><td>`us_up_id`</td></tr><tr><td>`password`</td><td>`us_password`</td></tr><tr><td>`use_ldap`</td><td>`us_useldap`</td></tr><tr><td>`ip_filter`</td><td>`us_ipfilter`</td></tr><tr><td>`two_factor_type`</td><td>`us_2fatype`</td></tr><tr><td>`never_expire`</td><td>`us_neverexpire`</td></tr><tr><td>`dynamic_ip`</td><td>`us_dynamicip`</td></tr></tbody></table>

## Examples

### List Users

Returns the users visible to the key and scope.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/users"
```

### Get User

Reads one object by its internal ID.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"
```

### Create User

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "username": "docs-api-user",
  "description": "Documentation API user",
  "email": "docs-api-user@example.com",
  "profile_id": 2,
  "password": "change-this-password",
  "tenant_ids": [
    1
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/users"
```

### Edit User

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "docs-api-user-updated@example.com",
  "force_change": true
}' \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"
```

### Delete User

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"
```

### User Tenant and Routing Profile Relations

Replaces the user tenant, routing profile, and allowed profile relations with the supplied IDs.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "tenant_ids": [
    1
  ],
  "routingprofile_ids": [
    3
  ],
  "allowed_userprofile_ids": [
    2
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"
```

### User Object Restrictions

Restricts the user to specific queues, extensions, or providers.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "queue_restrictions": [
    12
  ],
  "extension_restrictions": [
    45
  ],
  "provider_restrictions": [
    7
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# User Profile

The **User Profile** object is supported by the MiRTA PBX OpenAPI endpoint. This object is managed at system scope and requires a global API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectu"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`userprofile`</td></tr><tr><td>Primary path</td><td>`/userprofiles`</td></tr><tr><td>ID field</td><td>`up_id`</td></tr><tr><td>Label field</td><td>`up_name`</td></tr><tr><td>Primary source table</td><td>`up_userprofiles`</td></tr><tr><td>Required on create</td><td>`up_name`</td></tr><tr><td>Path aliases</td><td>`/userprofile`, `/userprofiles`, `/user_profile`, `/user_profiles`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/userprofiles`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/userprofiles/OBJECT_ID`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/userprofiles`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/userprofiles/OBJECT_ID`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/userprofiles/OBJECT_ID`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`up_name`</td></tr><tr><td>`description`</td><td>`up_description`</td></tr><tr><td>`reserved`</td><td>`up_reserved`</td></tr><tr><td>`userpanel`</td><td>`up_userpanel`</td></tr><tr><td>`user_panel`</td><td>`up_userpanel`</td></tr><tr><td>`extension_user_profile`</td><td>`up_userpanel`</td></tr></tbody></table>

## Examples

### List User Profiles

Returns the user profiles visible to the key and scope.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/userprofiles"
```

### Get User Profile

Reads one object by its internal ID.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/userprofiles/OBJECT_ID"
```

### Create User Profile

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Profile",
  "description": "Documentation profile",
  "user_panel": "yes"
}' \
  "https://pbx.example.com/pbx/openapi.php/userprofiles"
```

### Edit User Profile

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "description": "Updated documentation profile"
}' \
  "https://pbx.example.com/pbx/openapi.php/userprofiles/OBJECT_ID"
```

### Delete User Profile

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/userprofiles/OBJECT_ID"
```

### User Profile Privileges

Replaces the profile privilege list. Privilege IDs must exist in the system privilege table.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "privileges": [
    {
      "id": 1,
      "param1": "read"
    },
    {
      "id": 2,
      "param1": "write"
    }
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/userprofiles/OBJECT_ID"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Routing Profile

The **Routing Profile** object is supported by the MiRTA PBX OpenAPI endpoint. This object is managed at system scope and requires a global API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectr"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`routingprofile`</td></tr><tr><td>Primary path</td><td>`/routingprofiles`</td></tr><tr><td>ID field</td><td>`rp_id`</td></tr><tr><td>Label field</td><td>`rp_name`</td></tr><tr><td>Primary source table</td><td>`rp_routingprofiles`</td></tr><tr><td>Required on create</td><td>`rp_name`</td></tr><tr><td>Path aliases</td><td>`/routingprofiles`, `/routing_profiles`, `/routing_profile`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/routingprofiles`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/routingprofiles/OBJECT_ID`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/routingprofiles`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/routingprofiles/OBJECT_ID`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/routingprofiles/OBJECT_ID`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`rp_name`</td></tr><tr><td>`description`</td><td>`rp_description`</td></tr><tr><td>`type`</td><td>`rp_type`</td></tr></tbody></table>

## Examples

### List Routing Profiles

Returns the routing profiles visible to the key and scope.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/routingprofiles"
```

### Get Routing Profile

Reads one object by its internal ID.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/routingprofiles/OBJECT_ID"
```

### Create Routing Profile

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Voice Routing",
  "description": "Documentation outbound routing",
  "type": "VOICE"
}' \
  "https://pbx.example.com/pbx/openapi.php/routingprofiles"
```

### Edit Routing Profile

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "description": "Updated documentation routing profile"
}' \
  "https://pbx.example.com/pbx/openapi.php/routingprofiles/OBJECT_ID"
```

### Delete Routing Profile

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/routingprofiles/OBJECT_ID"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Provider

The **Provider** object is supported by the MiRTA PBX OpenAPI endpoint. This object is managed at system scope and requires a global API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectp"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`provider`</td></tr><tr><td>Primary path</td><td>`/providers`</td></tr><tr><td>ID field</td><td>`pr_id`</td></tr><tr><td>Label field</td><td>`pr_name`</td></tr><tr><td>Primary source table</td><td>`pr_providers`</td></tr><tr><td>Required on create</td><td>`pr_name`</td></tr><tr><td>Path aliases</td><td>`/provider`, `/providers`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/providers`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/providers`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`pr_name`</td></tr><tr><td>`peername`</td><td>`pr_peername`</td></tr><tr><td>`peer_name`</td><td>`pr_peername`</td></tr><tr><td>`tech`</td><td>`pr_tech`</td></tr><tr><td>`host`</td><td>`pr_host`</td></tr><tr><td>`disabled`</td><td>`pr_disabled`</td></tr><tr><td>`penalty`</td><td>`pr_penalty`</td></tr><tr><td>`realtime`</td><td>`pr_userealtime`</td></tr><tr><td>`use_realtime`</td><td>`pr_userealtime`</td></tr><tr><td>`calleridmod_id`</td><td>`pr_ca_id`</td></tr><tr><td>`callerid`</td><td>`pr_callerid`</td></tr><tr><td>`caller_id`</td><td>`pr_callerid`</td></tr><tr><td>`callerid_number`</td><td>`pr_callerid`</td></tr><tr><td>`caller_id_number`</td><td>`pr_callerid`</td></tr><tr><td>`calleridname`</td><td>`pr_calleridname`</td></tr><tr><td>`callerid_name`</td><td>`pr_calleridname`</td></tr><tr><td>`caller_id_name`</td><td>`pr_calleridname`</td></tr><tr><td>`did_mod_id`</td><td>`pr_did_ca_id`</td></tr><tr><td>`max_out_channels`</td><td>`pr_maxoutchannels`</td></tr><tr><td>`ignore_sip_cause`</td><td>`pr_ignoresipcause`</td></tr><tr><td>`ignore_busy`</td><td>`pr_ignorebusy`</td></tr><tr><td>`sms_protocol`</td><td>`pr_smsprotocol`</td></tr><tr><td>`sms_url`</td><td>`pr_smsurl`</td></tr><tr><td>`sms_user`</td><td>`pr_smsuser`</td></tr><tr><td>`sms_password`</td><td>`pr_smspassword`</td></tr><tr><td>`canreinvite`</td><td>`sipfriends.canreinvite for chan_sip direct media`</td></tr><tr><td>`direct_media`</td><td>`ps_endpoints.direct_media for PJSIP direct media`</td></tr></tbody></table>

## Important Notes

- Providers are global system objects and always require a global API key.
- Readonly global API keys can list and read providers, but create, update, and delete require the full global API key.
- SIP providers manage the related sipfriends realtime row when realtime is enabled.
- PJSIP providers manage the related ps\_endpoints, ps\_aors, ps\_auths, and ps\_endpoint\_id\_ips rows when realtime is enabled.
- When a provider changes technology, the API removes old realtime rows before creating rows for the new technology.
- Provider callerid and callerid\_name values are optional. When set, calls routed through the provider use those caller ID values instead of extension-derived caller ID.
- Use canreinvite for chan\_sip direct media values. Use direct\_media for PJSIP direct media values.

## Examples

### List Providers

Returns the providers visible to the key and scope.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/providers"
```

### Get Provider

Reads one object by its internal ID.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID"
```

### Create Provider

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API PJSIP Provider",
  "peername": "docs-pjsip-provider",
  "tech": "PJSIP",
  "realtime": "on",
  "host": "198.51.100.20",
  "username": "docs-trunk",
  "password": "change-this-secret",
  "transport": "UDP",
  "codecs": [
    "ulaw",
    "alaw"
  ],
  "qualify": "yes",
  "qualifyfreq": 60,
  "direct_media": "no",
  "callerid": "+15551230000",
  "callerid_name": "Docs API Provider"
}' \
  "https://pbx.example.com/pbx/openapi.php/providers"
```

### Edit Provider

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "disabled": "",
  "penalty": 10,
  "max_out_channels": 25,
  "callerid": "+15551230001",
  "callerid_name": "Docs API Main"
}' \
  "https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID"
```

### Delete Provider

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID"
```

### Create SIP Provider

Creates a chan\_sip provider and the related sipfriends realtime peer.

```
curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API SIP Provider",
  "peername": "docs-sip-provider",
  "tech": "SIP",
  "realtime": "on",
  "host": "198.51.100.10",
  "username": "docs-sip-trunk",
  "password": "change-this-secret",
  "transport": "UDP",
  "nat": "force_rport,comedia",
  "codecs": [
    "ulaw",
    "alaw"
  ],
  "canreinvite": "no"
}' \
  "https://pbx.example.com/pbx/openapi.php/providers"
```

### Edit PJSIP Realtime Settings

Updates provider fields and related PJSIP endpoint, AOR, auth, and endpoint identification rows.

```
curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "host": "198.51.100.21",
  "password": "new-secret",
  "direct_media": "no",
  "sendrpid": "pai",
  "codecs": [
    "ulaw",
    "alaw",
    "opus"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Voicemail

The **Voicemail** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectv"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`voicemail`</td></tr><tr><td>Primary path</td><td>`/voicemails`</td></tr><tr><td>ID field</td><td>`uniqueid`</td></tr><tr><td>Label field</td><td>`mailbox`</td></tr><tr><td>Primary source table</td><td>`voicemail`</td></tr><tr><td>Required on create</td><td>`mailbox`</td></tr><tr><td>Path aliases</td><td>`/voicemails`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/voicemails?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/voicemails?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`fullname`</td></tr><tr><td>`number`</td><td>`mailbox`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`VOICEMAIL-OPERATOR`</td><td>`operator`, `voicemail_operator`</td></tr><tr><td>`VOICEMAIL-FOLLOW`</td><td>`follow`, `voicemail_follow`</td></tr><tr><td>`VOICEMAIL-BROADCAST`</td><td>`broadcast`, `voicemail_broadcast`</td></tr></tbody></table>

## Examples

### List Voicemails

Returns the voicemails visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/voicemails?tenant=CANISTRACCI"
```

### Get Voicemail

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Voicemail

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "240",
  "name": "Docs API Mailbox",
  "email": "voicemail@example.com",
  "password": "1234"
}' \
  "https://pbx.example.com/pbx/openapi.php/voicemails?tenant=CANISTRACCI"
```

### Edit Voicemail

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Mailbox Updated",
  "email": "voicemail-updated@example.com"
}' \
  "https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Voicemail

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI"
```

### Voicemail OPERATOR Destination

Updates the `VOICEMAIL-OPERATOR` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "operator": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI"
```

### Voicemail FOLLOW Destination

Updates the `VOICEMAIL-FOLLOW` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "follow": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI"
```

### Voicemail BROADCAST Destination

Updates the `VOICEMAIL-BROADCAST` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "broadcast": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/voicemails/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

## Voicemail messages and greetings

<table id="bkmrk-resourcesupported-me"><thead><tr><th>Resource</th><th>Supported methods</th></tr></thead><tbody><tr><td>/voicemails/{id}/messages</td><td>GET list, POST create</td></tr><tr><td>/voicemails/{id}/messages/{messageId}</td><td>GET, PUT, PATCH, DELETE</td></tr><tr><td>/voicemails/{id}/greetings</td><td>GET list, POST create</td></tr><tr><td>/voicemails/{id}/greetings/{name}</td><td>GET, PUT, PATCH, DELETE</td></tr></tbody></table>

The voicemail ID is the mailbox configuration ID, and messageId is the recording’s database ID, not its position number. Greeting names: `busy`, `unavail`, `greet`, `temp`. Every operation checks both tenant and mailbox ownership. Use `limit` and `offset` for lists (100 by default, maximum 1000).

POST requires `data_base64`; greeting POST also requires `name`. Audio must be PCM WAV, mono, 8000 Hz, 16 bit, at most 16 MiB decoded, and the installation’s VOICEMAILFORMAT must be wav. Full-key detail GET returns data\_base64; list responses and read-only keys omit audio. An existing greeting is replaced with PUT/PATCH, not another POST.

Message fields: `folder` (INBOX by default; also Old, Work, Family, Friends, Cust1–Cust5), `callerid`, `flag` (empty, Urgent or PRIORITY), `category`, `origtime` (Unix timestamp), and `data_base64`. PATCH folder moves the message within that mailbox. Storage paths, mailbox identity, message positions and analysis fields are generated/read-only. Replacing audio clears stale transcripts and summaries.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  'https://pbx.example.com/pbx/openapi.php/voicemails/8/messages?tenant=TENANT_CODE'

curl -X PATCH -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"folder":"Old"}' \
  'https://pbx.example.com/pbx/openapi.php/voicemails/8/messages/42?tenant=TENANT_CODE'

curl -X PUT -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"data_base64":"BASE64_ENCODED_WAV"}' \
  'https://pbx.example.com/pbx/openapi.php/voicemails/8/greetings/busy?tenant=TENANT_CODE'
```

Query routing is supported using `object=voicemail&action=messages&id=8&item=42` or `action=greetings&id=8&item=busy`. Omit item for collection requests. DELETE requires one item and does not clear the entire mailbox.

See [Additional Configuration Operations](/books/api/page/additional-configuration-operations) for complete request fields, scope rules and examples.

# IVR

The **IVR** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjecti"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`ivr`</td></tr><tr><td>Primary path</td><td>`/ivrs`</td></tr><tr><td>ID field</td><td>`iv_id`</td></tr><tr><td>Label field</td><td>`iv_name`</td></tr><tr><td>Primary source table</td><td>`iv_ivrs`</td></tr><tr><td>Required on create</td><td>`iv_name`</td></tr><tr><td>Path aliases</td><td>`/ivrs`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/ivrs?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/ivrs?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`iv_name`</td></tr><tr><td>`mediafile_id`</td><td>`iv_me_id`</td></tr><tr><td>`timeout`</td><td>`iv_timeout`</td></tr><tr><td>`digit_timeout`</td><td>`iv_digittimeout`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`IVR_1`</td><td>`ivr_1`, `key_1`, `1`</td></tr><tr><td>`IVR_2`</td><td>`ivr_2`, `key_2`, `2`</td></tr><tr><td>`IVR_3`</td><td>`ivr_3`, `key_3`, `3`</td></tr><tr><td>`IVR_4`</td><td>`ivr_4`, `key_4`, `4`</td></tr><tr><td>`IVR_5`</td><td>`ivr_5`, `key_5`, `5`</td></tr><tr><td>`IVR_6`</td><td>`ivr_6`, `key_6`, `6`</td></tr><tr><td>`IVR_7`</td><td>`ivr_7`, `key_7`, `7`</td></tr><tr><td>`IVR_8`</td><td>`ivr_8`, `key_8`, `8`</td></tr><tr><td>`IVR_9`</td><td>`ivr_9`, `key_9`, `9`</td></tr><tr><td>`IVR_0`</td><td>`ivr_0`, `key_0`, `0`</td></tr><tr><td>`IVR_STAR`</td><td>`ivr_star`, `key_star`, `star`</td></tr><tr><td>`IVR_SHARP`</td><td>`ivr_sharp`, `key_sharp`, `sharp`</td></tr><tr><td>`IVR_WRONG`</td><td>`ivr_wrong`, `wrong`</td></tr><tr><td>`IVR_TIMEOUT`</td><td>`ivr_timeout`, `timeout`</td></tr><tr><td>`IVR_HANGUP`</td><td>`ivr_hangup`, `hangup`</td></tr><tr><td>`IVR_FEATURE`</td><td>`ivr_feature`, `feature`</td></tr><tr><td>`IVR_EXTENSION`</td><td>`ivr_extension`, `extension`</td></tr><tr><td>`IVR_MEDIAFILE`</td><td>`ivr_mediafile`, `mediafile`</td></tr><tr><td>`IVR_OPTIONSMEDIAFILE`</td><td>`ivr_optionsmediafile`, `optionsmediafile`</td></tr><tr><td>`CUSTOMIVR_SUPPORT`</td><td>`customivr_support`</td></tr></tbody></table>

## Important Notes

- Custom IVR destination names matching CUSTOMIVR\_\* are also accepted.

## Examples

### List IVRs

Returns the ivrs visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/ivrs?tenant=CANISTRACCI"
```

### Get IVR

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### Create IVR

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API IVR",
  "mediafile_id": 22,
  "timeout": 5,
  "digit_timeout": 3
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs?tenant=CANISTRACCI"
```

### Edit IVR

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "timeout": 8,
  "digit_timeout": 4
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete IVR

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 1 Destination

Updates the `IVR_1` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_1": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 2 Destination

Updates the `IVR_2` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_2": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 3 Destination

Updates the `IVR_3` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_3": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 4 Destination

Updates the `IVR_4` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_4": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 5 Destination

Updates the `IVR_5` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_5": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 6 Destination

Updates the `IVR_6` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_6": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 7 Destination

Updates the `IVR_7` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_7": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 8 Destination

Updates the `IVR_8` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_8": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 9 Destination

Updates the `IVR_9` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_9": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR 0 Destination

Updates the `IVR_0` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_0": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR STAR Destination

Updates the `IVR_STAR` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_star": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR SHARP Destination

Updates the `IVR_SHARP` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_sharp": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR WRONG Destination

Updates the `IVR_WRONG` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_wrong": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR TIMEOUT Destination

Updates the `IVR_TIMEOUT` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_timeout": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR HANGUP Destination

Updates the `IVR_HANGUP` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_hangup": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR FEATURE Destination

Updates the `IVR_FEATURE` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_feature": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR EXTENSION Destination

Updates the `IVR_EXTENSION` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_extension": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR MEDIAFILE Destination

Updates the `IVR_MEDIAFILE` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_mediafile": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR OPTIONSMEDIAFILE Destination

Updates the `IVR_OPTIONSMEDIAFILE` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ivr_optionsmediafile": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

### IVR SUPPORT Destination

Updates the `CUSTOMIVR_SUPPORT` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "customivr_support": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/ivrs/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Custom Destination

The **Custom Destination** object is supported by the MiRTA PBX OpenAPI endpoint. This object is normally tenant-scoped. With a global API key, use `global=1` to manage the shared/global record set. Tenant writes still require `tenant=CANISTRACCI`.

## Object Summary

<table id="bkmrk-propertyvalueobjectc"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`customdestination`</td></tr><tr><td>Primary path</td><td>`/customdestinations`</td></tr><tr><td>ID field</td><td>`cu_id`</td></tr><tr><td>Label field</td><td>`cu_name`</td></tr><tr><td>Primary source table</td><td>`cu_customs`</td></tr><tr><td>Required on create</td><td>`cu_name`, `cu_ct_id`</td></tr><tr><td>Path aliases</td><td>`/custom`, `/customs`, `/customdestinations`, `/custom_destinations`, `/custom_destination`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/customdestinations?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/customdestinations?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`cu_name`</td></tr><tr><td>`type_id`</td><td>`cu_ct_id`</td></tr><tr><td>`custom_type_id`</td><td>`cu_ct_id`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`PRIVACY-DONTCALL`</td><td>`privacy_dontcall`, `dontcall`</td></tr><tr><td>`PRIVACY-TORTURE`</td><td>`privacy_torture`, `torture`</td></tr><tr><td>`CTONANSWER`</td><td>`onanswer`</td></tr><tr><td>`CALLBACK-CONNECTED`</td><td>`callback_connected`</td></tr><tr><td>`CTONCALLERHANGUP`</td><td>`caller_hangup`</td></tr><tr><td>`SPLITCHANNELACTION-CALLER`</td><td>`split_caller`</td></tr><tr><td>`SPLITCHANNELACTION-CALLED`</td><td>`split_called`</td></tr><tr><td>`RANDOMDESTINATION`</td><td>`randomdestination`, `random_destination`</td></tr><tr><td>`RANDOMDESTINATION1`</td><td>`randomdestination1`, `random_destination1`</td></tr><tr><td>`RANDOMDESTINATION2`</td><td>`randomdestination2`, `random_destination2`</td></tr><tr><td>`RANDOMDESTINATION3`</td><td>`randomdestination3`, `random_destination3`</td></tr><tr><td>`RANDOMDESTINATION4`</td><td>`randomdestination4`, `random_destination4`</td></tr><tr><td>`RANDOMDESTINATION5`</td><td>`randomdestination5`, `random_destination5`</td></tr><tr><td>`RANDOMDESTINATION6`</td><td>`randomdestination6`, `random_destination6`</td></tr><tr><td>`RANDOMDESTINATION7`</td><td>`randomdestination7`, `random_destination7`</td></tr><tr><td>`RANDOMDESTINATION8`</td><td>`randomdestination8`, `random_destination8`</td></tr><tr><td>`RANDOMDESTINATION9`</td><td>`randomdestination9`, `random_destination9`</td></tr><tr><td>`RANDOMDESTINATION10`</td><td>`randomdestination10`, `random_destination10`</td></tr><tr><td>`RANDOMDESTINATION11`</td><td>`randomdestination11`, `random_destination11`</td></tr><tr><td>`RANDOMDESTINATION12`</td><td>`randomdestination12`, `random_destination12`</td></tr><tr><td>`RANDOMDESTINATION13`</td><td>`randomdestination13`, `random_destination13`</td></tr><tr><td>`RANDOMDESTINATION14`</td><td>`randomdestination14`, `random_destination14`</td></tr><tr><td>`RANDOMDESTINATION15`</td><td>`randomdestination15`, `random_destination15`</td></tr><tr><td>`RANDOMDESTINATION16`</td><td>`randomdestination16`, `random_destination16`</td></tr><tr><td>`RANDOMDESTINATION17`</td><td>`randomdestination17`, `random_destination17`</td></tr><tr><td>`RANDOMDESTINATION18`</td><td>`randomdestination18`, `random_destination18`</td></tr><tr><td>`RANDOMDESTINATION19`</td><td>`randomdestination19`, `random_destination19`</td></tr><tr><td>`RANDOMDESTINATION20`</td><td>`randomdestination20`, `random_destination20`</td></tr></tbody></table>

## Examples

### List Custom Destinations

Returns the custom destinations visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/customdestinations?tenant=CANISTRACCI"
```

### Get Custom Destination

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Custom Destination

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Custom Destination",
  "type_id": 1
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations?tenant=CANISTRACCI"
```

### Edit Custom Destination

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Custom Destination Updated"
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Custom Destination

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### List Global Custom Destinations

Uses the shared/global record set for object types that support global rows.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/customdestinations?global=1"
```

### Custom Destination DONTCALL Destination

Updates the `PRIVACY-DONTCALL` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "privacy_dontcall": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination TORTURE Destination

Updates the `PRIVACY-TORTURE` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "privacy_torture": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination Destination

Updates the `CTONANSWER` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onanswer": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination CONNECTED Destination

Updates the `CALLBACK-CONNECTED` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "callback_connected": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination Destination

Updates the `CTONCALLERHANGUP` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "caller_hangup": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination CALLER Destination

Updates the `SPLITCHANNELACTION-CALLER` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "split_caller": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination CALLED Destination

Updates the `SPLITCHANNELACTION-CALLED` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "split_called": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination Destination

Updates the `RANDOMDESTINATION` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 1 Destination

Updates the `RANDOMDESTINATION1` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination1": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 2 Destination

Updates the `RANDOMDESTINATION2` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination2": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 3 Destination

Updates the `RANDOMDESTINATION3` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination3": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 4 Destination

Updates the `RANDOMDESTINATION4` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination4": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 5 Destination

Updates the `RANDOMDESTINATION5` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination5": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 6 Destination

Updates the `RANDOMDESTINATION6` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination6": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 7 Destination

Updates the `RANDOMDESTINATION7` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination7": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 8 Destination

Updates the `RANDOMDESTINATION8` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination8": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 9 Destination

Updates the `RANDOMDESTINATION9` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination9": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 10 Destination

Updates the `RANDOMDESTINATION10` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination10": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 11 Destination

Updates the `RANDOMDESTINATION11` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination11": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 12 Destination

Updates the `RANDOMDESTINATION12` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination12": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 13 Destination

Updates the `RANDOMDESTINATION13` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination13": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 14 Destination

Updates the `RANDOMDESTINATION14` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination14": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 15 Destination

Updates the `RANDOMDESTINATION15` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination15": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 16 Destination

Updates the `RANDOMDESTINATION16` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination16": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 17 Destination

Updates the `RANDOMDESTINATION17` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination17": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 18 Destination

Updates the `RANDOMDESTINATION18` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination18": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 19 Destination

Updates the `RANDOMDESTINATION19` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination19": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination 20 Destination

Updates the `RANDOMDESTINATION20` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "randomdestination20": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

### Custom Destination Extended Data

Adds or replaces custom destination extended rows when the custom type uses extra parameters.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "extended_infos": [
    {
      "ce_param1": "DOCS_VARIABLE",
      "ce_param2": "example"
    }
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/customdestinations/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

## Individual extended rows and binary files

Use CRUD on `/customdestinationinfos` and `/customdestinationfiles`. Each row is scoped by `customdestination_id`. Extended rows use `param1`, `param2`, `param3`; binary files use `name` and `data_base64` (maximum 16 MiB decoded). List with `?customdestination_id=8&tenant=TENANT_CODE`; full-key detail GET downloads binary content.

See [Additional Configuration Operations](/books/api/page/additional-configuration-operations) for complete request fields, scope rules and examples.

# Condition

The **Condition** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectc"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`condition`</td></tr><tr><td>Primary path</td><td>`/conditions`</td></tr><tr><td>ID field</td><td>`co_id`</td></tr><tr><td>Label field</td><td>`co_name`</td></tr><tr><td>Primary source table</td><td>`co_conditions`</td></tr><tr><td>Required on create</td><td>`co_type`</td></tr><tr><td>Path aliases</td><td>`/conditions`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/conditions?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/conditions?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`co_name`</td></tr><tr><td>`type`</td><td>`co_type`</td></tr><tr><td>`timezone`</td><td>`co_timezone`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`CONDITION`</td><td>`condition`, `true`, `yes`, `destination`</td></tr><tr><td>`NOTCONDITION`</td><td>`notcondition`, `false`, `no`, `notdestination`</td></tr><tr><td>`CONDITION1`</td><td>`condition1`, `destination1`, `destinationmvv1`</td></tr><tr><td>`CONDITION2`</td><td>`condition2`, `destination2`, `destinationmvv2`</td></tr><tr><td>`CONDITION3`</td><td>`condition3`, `destination3`, `destinationmvv3`</td></tr><tr><td>`CONDITION4`</td><td>`condition4`, `destination4`, `destinationmvv4`</td></tr><tr><td>`CONDITION5`</td><td>`condition5`, `destination5`, `destinationmvv5`</td></tr><tr><td>`CONDITION6`</td><td>`condition6`, `destination6`, `destinationmvv6`</td></tr><tr><td>`CONDITION7`</td><td>`condition7`, `destination7`, `destinationmvv7`</td></tr><tr><td>`CONDITION8`</td><td>`condition8`, `destination8`, `destinationmvv8`</td></tr><tr><td>`CONDITION9`</td><td>`condition9`, `destination9`, `destinationmvv9`</td></tr><tr><td>`CONDITION10`</td><td>`condition10`, `destination10`, `destinationmvv10`</td></tr><tr><td>`CONDITION11`</td><td>`condition11`, `destination11`, `destinationmvv11`</td></tr><tr><td>`CONDITION12`</td><td>`condition12`, `destination12`, `destinationmvv12`</td></tr><tr><td>`CONDITION13`</td><td>`condition13`, `destination13`, `destinationmvv13`</td></tr><tr><td>`CONDITION14`</td><td>`condition14`, `destination14`, `destinationmvv14`</td></tr><tr><td>`CONDITION15`</td><td>`condition15`, `destination15`, `destinationmvv15`</td></tr><tr><td>`CONDITION16`</td><td>`condition16`, `destination16`, `destinationmvv16`</td></tr><tr><td>`CONDITION17`</td><td>`condition17`, `destination17`, `destinationmvv17`</td></tr><tr><td>`CONDITION18`</td><td>`condition18`, `destination18`, `destinationmvv18`</td></tr><tr><td>`CONDITION19`</td><td>`condition19`, `destination19`, `destinationmvv19`</td></tr><tr><td>`CONDITION20`</td><td>`condition20`, `destination20`, `destinationmvv20`</td></tr></tbody></table>

## Examples

### List Conditions

Returns the conditions visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/conditions?tenant=CANISTRACCI"
```

### Get Condition

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Condition

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Office Hours",
  "type": "WEEKTIME",
  "timezone": "Europe/Rome"
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions?tenant=CANISTRACCI"
```

### Edit Condition

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "timezone": "UTC"
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Condition

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition Destination

Updates the `CONDITION` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition Destination

Updates the `NOTCONDITION` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "notcondition": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 1 Destination

Updates the `CONDITION1` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition1": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 2 Destination

Updates the `CONDITION2` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition2": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 3 Destination

Updates the `CONDITION3` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition3": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 4 Destination

Updates the `CONDITION4` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition4": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 5 Destination

Updates the `CONDITION5` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition5": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 6 Destination

Updates the `CONDITION6` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition6": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 7 Destination

Updates the `CONDITION7` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition7": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 8 Destination

Updates the `CONDITION8` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition8": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 9 Destination

Updates the `CONDITION9` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition9": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 10 Destination

Updates the `CONDITION10` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition10": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 11 Destination

Updates the `CONDITION11` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition11": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 12 Destination

Updates the `CONDITION12` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition12": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 13 Destination

Updates the `CONDITION13` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition13": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 14 Destination

Updates the `CONDITION14` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition14": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 15 Destination

Updates the `CONDITION15` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition15": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 16 Destination

Updates the `CONDITION16` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition16": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 17 Destination

Updates the `CONDITION17` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition17": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 18 Destination

Updates the `CONDITION18` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition18": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 19 Destination

Updates the `CONDITION19` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition19": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition 20 Destination

Updates the `CONDITION20` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "condition20": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

### Condition Extended Rows

Supplies the extended rows used by condition types that require additional values.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "extended_infos": [
    {
      "ce_type": "weekday",
      "ce_value": "mon-fri"
    },
    {
      "ce_type": "hours",
      "ce_value": "09:00-18:00"
    }
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/conditions/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Hunt List

The **Hunt List** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjecth"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`huntlist`</td></tr><tr><td>Primary path</td><td>`/huntlists`</td></tr><tr><td>ID field</td><td>`hu_id`</td></tr><tr><td>Label field</td><td>`hu_name`</td></tr><tr><td>Primary source table</td><td>`hu_huntlists`</td></tr><tr><td>Required on create</td><td>`hu_name`</td></tr><tr><td>Path aliases</td><td>`/huntlists`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/huntlists?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/huntlists/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/huntlists?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/huntlists/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/huntlists/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`hu_name`</td></tr><tr><td>`number`</td><td>`hu_number`</td></tr><tr><td>`type`</td><td>`hu_type`</td></tr><tr><td>`ringtime`</td><td>`hu_ringtime`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`HUNTLIST`</td><td>`extensions`, `members`, `huntlist`</td></tr><tr><td>`HUNTLIST-TIMEOUT`</td><td>`timeout`, `huntlist_timeout`</td></tr></tbody></table>

## Examples

### List Hunt Lists

Returns the hunt lists visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/huntlists?tenant=CANISTRACCI"
```

### Get Hunt List

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/huntlists/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Hunt List

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Hunt List",
  "number": "820",
  "type": "RINGALL",
  "ringtime": 20
}' \
  "https://pbx.example.com/pbx/openapi.php/huntlists?tenant=CANISTRACCI"
```

### Edit Hunt List

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ringtime": 25
}' \
  "https://pbx.example.com/pbx/openapi.php/huntlists/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Hunt List

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/huntlists/OBJECT_ID?tenant=CANISTRACCI"
```

### Hunt List Destination

Updates the `HUNTLIST` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "extensions": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/huntlists/OBJECT_ID?tenant=CANISTRACCI"
```

### Hunt List TIMEOUT Destination

Updates the `HUNTLIST-TIMEOUT` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "timeout": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/huntlists/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# DID

The **DID** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectd"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`did`</td></tr><tr><td>Primary path</td><td>`/dids`</td></tr><tr><td>ID field</td><td>`di_id`</td></tr><tr><td>Label field</td><td>`di_number`</td></tr><tr><td>Primary source table</td><td>`di_dids`</td></tr><tr><td>Required on create</td><td>`di_number`</td></tr><tr><td>Path aliases</td><td>`/dids`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/dids?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/dids?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`number`</td><td>`di_number`</td></tr><tr><td>`country`</td><td>`di_country`</td></tr><tr><td>`area`</td><td>`di_area`</td></tr><tr><td>`comment`</td><td>`di_comment`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`DID`</td><td>`destination`, `did`</td></tr><tr><td>`DID-UNCONDITIONAL`</td><td>`unconditional`</td></tr><tr><td>`DID-SMS`</td><td>`sms`</td></tr><tr><td>`DID-FAXSUCCESS`</td><td>`faxsuccess`, `fax_success`</td></tr></tbody></table>

## Examples

### List DIDs

Returns the dids visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/dids?tenant=CANISTRACCI"
```

### Get DID

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI"
```

### Create DID

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "+15551234567",
  "country": "US",
  "area": "212",
  "comment": "Docs API inbound DID"
}' \
  "https://pbx.example.com/pbx/openapi.php/dids?tenant=CANISTRACCI"
```

### Edit DID

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "comment": "Docs API DID updated"
}' \
  "https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete DID

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI"
```

### DID Destination

Updates the `DID` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "destination": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI"
```

### DID UNCONDITIONAL Destination

Updates the `DID-UNCONDITIONAL` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "unconditional": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI"
```

### DID SMS Destination

Updates the `DID-SMS` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "sms": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI"
```

### DID FAXSUCCESS Destination

Updates the `DID-FAXSUCCESS` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "faxsuccess": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/dids/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Queue

The **Queue** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectq"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`queue`</td></tr><tr><td>Primary path</td><td>`/queues`</td></tr><tr><td>ID field</td><td>`qu_id`</td></tr><tr><td>Label field</td><td>`qu_name`</td></tr><tr><td>Primary source table</td><td>`qu_queues`</td></tr><tr><td>Path aliases</td><td>`/queues`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/queues?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/queues?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`qu_name`</td></tr><tr><td>`number`</td><td>`qu_number`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`QUEUE-FULL`</td><td>`full`</td></tr><tr><td>`QUEUE-TIMEOUT`</td><td>`timeout_destination`, `timeout`</td></tr><tr><td>`QUEUE-EXITKEY`</td><td>`exitkey`</td></tr><tr><td>`QUEUE-ONCALLBACK`</td><td>`oncallback`</td></tr><tr><td>`QUEUE-NOBODYHOME`</td><td>`nobodyhome`</td></tr><tr><td>`QUEUE-NOFREEMEMBER`</td><td>`nofreemember`</td></tr><tr><td>`QUEUE-PERIODICANNOUNCE`</td><td>`periodicannounce`</td></tr><tr><td>`QUEUE-BEFORERINGING`</td><td>`beforeringing`</td></tr><tr><td>`QUEUE-ONAUTOPAUSE`</td><td>`onautopause`</td></tr><tr><td>`QUEUE-ONABANDONEDCALL`</td><td>`onabandonedcall`</td></tr></tbody></table>

## Examples

### List Queues

Returns the queues visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/queues?tenant=CANISTRACCI"
```

### Get Queue

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Queue

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Accounting Queue",
  "number": "700"
}' \
  "https://pbx.example.com/pbx/openapi.php/queues?tenant=CANISTRACCI"
```

### Edit Queue

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Accounting Queue Updated"
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Queue

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue FULL Destination

Updates the `QUEUE-FULL` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "full": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue TIMEOUT Destination

Updates the `QUEUE-TIMEOUT` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "timeout_destination": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue EXITKEY Destination

Updates the `QUEUE-EXITKEY` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "exitkey": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue ONCALLBACK Destination

Updates the `QUEUE-ONCALLBACK` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "oncallback": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue NOBODYHOME Destination

Updates the `QUEUE-NOBODYHOME` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "nobodyhome": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue NOFREEMEMBER Destination

Updates the `QUEUE-NOFREEMEMBER` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "nofreemember": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue PERIODICANNOUNCE Destination

Updates the `QUEUE-PERIODICANNOUNCE` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "periodicannounce": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue BEFORERINGING Destination

Updates the `QUEUE-BEFORERINGING` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "beforeringing": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue ONAUTOPAUSE Destination

Updates the `QUEUE-ONAUTOPAUSE` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onautopause": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue ONABANDONEDCALL Destination

Updates the `QUEUE-ONABANDONEDCALL` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onabandonedcall": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue Members

Replaces queue members. Use extension IDs and optional member fields such as penalty when needed.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "members": [
    {
      "extension_id": 45,
      "penalty": 0
    },
    {
      "extension_id": 46,
      "penalty": 1
    }
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

### Queue Allowed Members

Controls which extensions are allowed to be used as queue members.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "allowed_members": [
    45,
    46,
    47
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/queues/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Queue Agent Actions

The **Queue Agent Actions** endpoints log an extension into or out of one queue, pause it with or without a reason, and unpause it. Each request changes only the selected extension's membership; it does not replace or rebuild the other queue members.

## Endpoints

<table id="bkmrk-actionendpoint-login"> <thead><tr><th>Action</th><th>Endpoint</th></tr></thead> <tbody> <tr><td>Login</td><td>`POST /queues/{queueId}/agents/{agentId}/login`</td></tr> <tr><td>Logout</td><td>`POST /queues/{queueId}/agents/{agentId}/logout`</td></tr> <tr><td>Pause</td><td>`POST /queues/{queueId}/agents/{agentId}/pause`</td></tr> <tr><td>Unpause</td><td>`POST /queues/{queueId}/agents/{agentId}/unpause`</td></tr> </tbody></table>

## Authentication and Identifiers

These endpoints require a writable full tenant or global API key. Read-only keys are rejected. The `tenant` query parameter is required and must exactly match the tenant code or tenant name; wildcard tenant selection is not accepted.

<table id="bkmrk-valuerequireddescrip"> <thead><tr><th>Value</th><th>Required</th><th>Description</th></tr></thead> <tbody> <tr><td>`queueId`</td><td>Yes</td><td>The queue's internal ID (`qu_id`), not its dialable queue number.</td></tr> <tr><td>`agentId`</td><td>Yes</td><td>The extension's internal ID (`ex_id`), not its extension number.</td></tr> <tr><td>`tenant`</td><td>Yes</td><td>Exact tenant code or tenant name.</td></tr> <tr><td>`key`</td><td>No, if using headers</td><td>The API key can be sent with `X-API-Key`, `Authorization: Bearer`, or the `key` query parameter.</td></tr> </tbody></table>

## Request Body

Login, logout, and unpause do not need a request body. A pause request accepts an optional JSON body:

```
{
  "reason": "Lunch"
}
```

The reason can contain up to 80 characters. Omit the body, send an empty object, or use an empty reason to pause without a reason. `pausereason` is accepted as a compatibility alias for `reason`; if both names are supplied, their values must match. A pause reason cannot be sent to the other actions.

## Examples

### Log In

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/queues/25/agents/101/login?tenant=CANISTRACCI"
```

### Pause Without a Reason

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/queues/25/agents/101/pause?tenant=CANISTRACCI"
```

### Pause With a Reason

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reason":"Lunch"}' \
  "https://pbx.example.com/pbx/openapi.php/queues/25/agents/101/pause?tenant=CANISTRACCI"
```

### Unpause and Log Out

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/queues/25/agents/101/unpause?tenant=CANISTRACCI"

curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/queues/25/agents/101/logout?tenant=CANISTRACCI"
```

## Response

```
{
  "object": "queue_agent_action",
  "action": "pause",
  "status": "paused",
  "changed": true,
  "queue": {
    "id": 25,
    "number": "700",
    "name": "Support"
  },
  "agent": {
    "id": 101,
    "number": "100",
    "name": "Reception",
    "peer": "101"
  },
  "members": [
    {
      "membername": "100",
      "interface": "Local/AG-000-NF-101@fromotherpbx/n",
      "state_interface": "Custom:101",
      "member_device": "101",
      "penalty": 0,
      "paused": true,
      "pause_reason": "Lunch"
    }
  ],
  "pbx_refresh": "confirmed",
  "warnings": []
}
```

`changed` is `false` when the requested state was already active. Login and logout are idempotent. Pause and unpause are also idempotent after the agent is logged in; attempting either operation for an extension that is not a member of the queue returns HTTP 409.

`pbx_refresh` reports whether the live Asterisk refresh was confirmed. If the database action succeeds but the refresh cannot be confirmed, the request still returns the saved state with `pbx_refresh` set to `failed` and an explanation in `warnings`. Retrying the same action is safe and requests another refresh.

## Behavior

- Login uses the queue's Agent Identification, Allow Call Optimization, and Ring Offline settings when constructing the member.
- A changed state writes the matching `LOGIN`, `LOGOUT`, `PAUSE`, or `UNPAUSE` queue log event and an activity audit entry.
- Unpause clears the stored pause reason.
- The final database state is checked before a successful response is returned.

## Relevant Errors

<table id="bkmrk-http-statuscodedescr"> <thead><tr><th>HTTP status</th><th>Code</th><th>Description</th></tr></thead> <tbody> <tr><td>400</td><td>`exact_tenant_required`</td><td>The tenant was omitted, does not exactly match the authenticated tenant, or uses a wildcard.</td></tr> <tr><td>400</td><td>`invalid_pause_reason`</td><td>The pause reason is invalid or longer than 80 characters.</td></tr> <tr><td>400</td><td>`conflicting_pause_reason`</td><td>`reason` and `pausereason` contain different values.</td></tr> <tr><td>400</td><td>`pause_reason_not_allowed`</td><td>A reason was sent to login, logout, or unpause.</td></tr> <tr><td>404</td><td>`queue_not_found`</td><td>The queue does not exist in the selected tenant.</td></tr> <tr><td>409</td><td>`agent_not_logged_in`</td><td>Pause or unpause was requested before the extension was logged into the queue.</td></tr> <tr><td>409</td><td>`agent_peer_unavailable`</td><td>The extension does not have a valid queue member device.</td></tr> <tr><td>409</td><td>`queue_agent_state_changed`</td><td>A concurrent change prevented the requested final state from being confirmed; retry the request.</td></tr> <tr><td>500</td><td>`queue_agent_update_failed`</td><td>The membership database operation failed.</td></tr> </tbody></table>

# Setting

The **Setting** object is supported by the MiRTA PBX OpenAPI endpoint. This object is normally tenant-scoped. With a global API key, use `global=1` to manage the shared/global record set. Tenant writes still require `tenant=CANISTRACCI`.

## Object Summary

<table id="bkmrk-propertyvalueobjects"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`setting`</td></tr><tr><td>Primary path</td><td>`/settings`</td></tr><tr><td>ID field</td><td>`se_id`</td></tr><tr><td>Label field</td><td>`se_code`</td></tr><tr><td>Primary source table</td><td>`se_settings`</td></tr><tr><td>Required on create</td><td>`se_code`</td></tr><tr><td>Path aliases</td><td>`/settings`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/settings?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/settings/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/settings?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/settings/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/settings/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`code`</td><td>`se_code`</td></tr><tr><td>`value`</td><td>`se_value`</td></tr></tbody></table>

## Examples

### List Settings

Returns the settings visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/settings?tenant=CANISTRACCI"
```

### Get Setting

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/settings/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Setting

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "code": "API_DOCS_EXAMPLE",
  "value": "enabled"
}' \
  "https://pbx.example.com/pbx/openapi.php/settings?tenant=CANISTRACCI"
```

### Edit Setting

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "value": "disabled"
}' \
  "https://pbx.example.com/pbx/openapi.php/settings/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Setting

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/settings/OBJECT_ID?tenant=CANISTRACCI"
```

### List Global Settings

Uses the shared/global record set for object types that support global rows.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/settings?global=1"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

## Configuration/Settings objects

Manager users, pickup group names, internal routing, parking, privacy rules, autoanswers, Dial By Name directories/entries, digital faxes, alarm bindings, Mail to Fax/Call, scheduled calls, dashboards, line monitors, XML templates, cause codes, CNAM cache and extension dialing exceptions now have dedicated CRUD resources. User-owned quick shortcuts require a global API key.

See [Additional Configuration Operations](/books/api/page/additional-configuration-operations) for complete request fields, scope rules and examples.

# Media File

The **Media File** object is supported by the MiRTA PBX OpenAPI endpoint. This object is normally tenant-scoped. With a global API key, use `global=1` to manage the shared/global record set. Tenant writes still require `tenant=CANISTRACCI`.

## Object Summary

<table id="bkmrk-propertyvalueobjectm"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`mediafile`</td></tr><tr><td>Primary path</td><td>`/mediafiles`</td></tr><tr><td>ID field</td><td>`me_id`</td></tr><tr><td>Label field</td><td>`me_name`</td></tr><tr><td>Primary source table</td><td>`me_mediafiles`</td></tr><tr><td>Required on create</td><td>`me_name`</td></tr><tr><td>Path aliases</td><td>`/mediafiles`, `/media_files`, `/media_file`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/mediafiles?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/mediafiles/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Download file</td><td>`GET https://pbx.example.com/pbx/openapi.php/mediafiles/OBJECT_ID/download?tenant=CANISTRACCI` (full API key)</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/mediafiles?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/mediafiles/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/mediafiles/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`me_name`</td></tr><tr><td>`description`</td><td>`me_description`</td></tr><tr><td>`format`</td><td>`me_format`</td></tr><tr><td>`type`</td><td>`me_type`</td></tr><tr><td>`text`</td><td>`me_text`</td></tr><tr><td>`engine`</td><td>`me_engine`</td></tr><tr><td>`language`</td><td>`me_language`</td></tr><tr><td>`data_base64`</td><td>`me_data`</td></tr></tbody></table>

## Examples

### List Media Files

Returns the media files visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/mediafiles?tenant=CANISTRACCI"
```

### Get Media File

Reads metadata by its internal ID. List and detail responses omit `me_data` and do not contain audio, even when using a global full API key. Use the download endpoint to retrieve the file.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/mediafiles/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Media File

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Welcome Prompt",
  "description": "Generated prompt for documentation",
  "type": "tts",
  "text": "Welcome to Kartoon Cars. Press 1 for sales or 2 for support.",
  "engine": "azure",
  "language": "en-US"
}' \
  "https://pbx.example.com/pbx/openapi.php/mediafiles?tenant=CANISTRACCI"
```

### Edit Media File

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "description": "Updated generated prompt"
}' \
  "https://pbx.example.com/pbx/openapi.php/mediafiles/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Media File

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/mediafiles/OBJECT_ID?tenant=CANISTRACCI"
```

### List Global Media Files

Uses the shared/global record set for object types that support global rows.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/mediafiles?global=1"
```

### Media File Binary Upload

Sends audio data as base64. Replace the shortened example with the complete encoded file.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Uploaded Prompt",
  "format": "wav",
  "data_base64": "UklGRiQAAABXQVZFZm10IBAAAAABAAEA..."
}' \
  "https://pbx.example.com/pbx/openapi.php/mediafiles?tenant=CANISTRACCI"
```

## Download a Media File

`GET /mediafiles/{id}/download?tenant=TENANTCODE` returns the original stored file as an attachment. Use the positive `me_id` returned by the media list. The audio is returned as binary bytes, without base64 encoding or transcoding.

**A full API key is required.** Tenant full keys can download only their own tenant's media files and must supply `tenant`. Read-only keys receive HTTP 403, with error code `full_api_key_required`. A global full key can select a tenant or omit `tenant` to download a media file by ID across tenants. For shared/global media, use `global=yes` with a global full key.

### Download Tenant Media

```
curl --fail --show-error \
  -H 'X-API-Key: TENANT_API_KEY' \
  --output /tmp/media.wav \
  'https://pbx.example.com/pbx/openapi.php/mediafiles/123/download?tenant=CANISTRACCI'
```

Replace `123` with the media file ID. The example writes WAV bytes to `/tmp/media.wav`; choose a filename matching the stored format when downloading MP3, GSM or another format. The server does not convert the audio based on the output filename.

### Download Global Media

```
curl --fail --show-error \
  -H 'X-API-Key: GLOBAL_API_KEY' \
  --output /tmp/global-media.wav \
  'https://pbx.example.com/pbx/openapi.php/mediafiles/123/download?global=yes'
```

### Download Response and Storage

- `Content-Disposition: attachment` supplies a filename derived from the media name and stored extension.
- `Content-Type` reflects the stored format, such as `audio/wav`, `audio/mpeg` or `audio/gsm`. Other formats may use `application/octet-stream`.
- `Content-Length` reports the actual file size. Successful responses contain file bytes; failures remain JSON.
- Database, filesystem, FTP, SSL-FTP, SFTP and S3 storage are supported. The storage lookup uses the media file's actual tenant owner and the system media-storage settings when inherited.

The singular alias `/mediafile/123/download` is also accepted. The equivalent query form is `openapi.php?object=mediafile&action=download&id=123&tenant=CANISTRACCI`. Downloads support GET only.

<table id="bkmrk-http-statusmeaning40"><thead><tr><th>HTTP status</th><th>Meaning</th></tr></thead><tbody><tr><td>400</td><td>Invalid or missing media ID.</td></tr><tr><td>401 / 403</td><td>Missing/invalid key, read-only key, denied IP address or insufficient scope.</td></tr><tr><td>404</td><td>Media record is outside the selected scope, does not exist, or has no stored audio.</td></tr><tr><td>405</td><td>A method other than GET was used.</td></tr><tr><td>409</td><td>The stored media format is unavailable.</td></tr><tr><td>500 / 502 / 503</td><td>Database, storage retrieval or configuration failure. Errors are JSON; no file download starts.</td></tr></tbody></table>

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Music On Hold

The **Music On Hold** object is supported by the MiRTA PBX OpenAPI endpoint. This object is normally tenant-scoped. With a global API key, use `global=1` to manage the shared/global record set. Tenant writes still require `tenant=CANISTRACCI`.

## Object Summary

<table id="bkmrk-propertyvalueobjectm"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`musiconhold`</td></tr><tr><td>Primary path</td><td>`/musiconholds`</td></tr><tr><td>ID field</td><td>`mu_id`</td></tr><tr><td>Label field</td><td>`mu_name`</td></tr><tr><td>Primary source table</td><td>`mu_musiconholds`</td></tr><tr><td>Required on create</td><td>`mu_name`</td></tr><tr><td>Path aliases</td><td>`/moh`, `/music`, `/musiconholds`, `/music_on_hold`, `/music_on_holds`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/musiconholds?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/musiconholds/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/musiconholds?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/musiconholds/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/musiconholds/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`mu_name`</td></tr><tr><td>`custom`</td><td>`mu_custom`</td></tr><tr><td>`volume`</td><td>`mu_volume`</td></tr><tr><td>`randomizeorder`</td><td>`mu_randomizeorder`</td></tr><tr><td>`streamengine`</td><td>`mu_streamengine`</td></tr><tr><td>`format`</td><td>`format`</td></tr><tr><td>`application`</td><td>`application`</td></tr><tr><td>`mode`</td><td>`mode`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`MUSICONHOLD`</td><td>`mediafile`, `mediafiles`, `destination`</td></tr></tbody></table>

## Examples

### List Music On Hold Classes

Returns the music on hold classes visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/musiconholds?tenant=CANISTRACCI"
```

### Get Music On Hold

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/musiconholds/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Music On Hold

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Music On Hold",
  "custom": "yes",
  "volume": 0,
  "mode": "playlist",
  "format": "slin"
}' \
  "https://pbx.example.com/pbx/openapi.php/musiconholds?tenant=CANISTRACCI"
```

### Edit Music On Hold

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "volume": -3
}' \
  "https://pbx.example.com/pbx/openapi.php/musiconholds/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Music On Hold

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/musiconholds/OBJECT_ID?tenant=CANISTRACCI"
```

### List Global Music On Hold Classes

Uses the shared/global record set for object types that support global rows.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/musiconholds?global=1"
```

### Music On Hold Destination

Updates the `MUSICONHOLD` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "mediafile": [
    22
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/musiconholds/OBJECT_ID?tenant=CANISTRACCI"
```

### Music On Hold Entries and Default

Replaces music-on-hold entries and marks the class as the default class for the scope.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "entries": [
    {
      "me_id": 22,
      "order": 1
    },
    {
      "me_id": 23,
      "order": 2
    }
  ],
  "default": true
}' \
  "https://pbx.example.com/pbx/openapi.php/musiconholds/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Paging Group

The **Paging Group** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectp"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`paginggroup`</td></tr><tr><td>Primary path</td><td>`/paginggroups`</td></tr><tr><td>ID field</td><td>`pa_id`</td></tr><tr><td>Label field</td><td>`pa_name`</td></tr><tr><td>Primary source table</td><td>`pa_paginggroups`</td></tr><tr><td>Required on create</td><td>`pa_name`, `pa_number`</td></tr><tr><td>Path aliases</td><td>`/paging`, `/pagings`, `/paginggroup`, `/paginggroups`, `/intercom`, `/intercoms`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/paginggroups?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/paginggroups/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/paginggroups?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/paginggroups/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/paginggroups/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`pa_name`</td></tr><tr><td>`number`</td><td>`pa_number`</td></tr><tr><td>`pin`</td><td>`pa_pin`</td></tr><tr><td>`bidirectional`</td><td>`pa_bidirectional`</td></tr><tr><td>`checkinuse`</td><td>`pa_checkinuse`</td></tr><tr><td>`mediafile_id`</td><td>`pa_me_id`</td></tr><tr><td>`manualheader`</td><td>`pa_manualheader`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`PAGING`</td><td>`extensions`, `peers`, `members`, `destination`</td></tr></tbody></table>

## Examples

### List Paging Groups

Returns the paging groups visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/paginggroups?tenant=CANISTRACCI"
```

### Get Paging Group

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/paginggroups/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Paging Group

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Paging Group",
  "number": "830",
  "pin": "1234",
  "bidirectional": "no"
}' \
  "https://pbx.example.com/pbx/openapi.php/paginggroups?tenant=CANISTRACCI"
```

### Edit Paging Group

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "bidirectional": "yes"
}' \
  "https://pbx.example.com/pbx/openapi.php/paginggroups/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Paging Group

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/paginggroups/OBJECT_ID?tenant=CANISTRACCI"
```

### Paging Group Destination

Updates the `PAGING` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "extensions": [
    100,
    101
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/paginggroups/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Conference Room

The **Conference Room** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectc"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`conferenceroom`</td></tr><tr><td>Primary path</td><td>`/conferencerooms`</td></tr><tr><td>ID field</td><td>`cr_id`</td></tr><tr><td>Label field</td><td>`cr_name`</td></tr><tr><td>Primary source table</td><td>`cr_conferencerooms`</td></tr><tr><td>Required on create</td><td>`cr_name`, `cr_number`</td></tr><tr><td>Path aliases</td><td>`/conference`, `/conferences`, `/conferencerooms`, `/conference_rooms`, `/conference_room`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/conferencerooms?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/conferencerooms/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/conferencerooms?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/conferencerooms/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/conferencerooms/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`cr_name`</td></tr><tr><td>`number`</td><td>`cr_number`</td></tr><tr><td>`hosted`</td><td>`cr_hosted`</td></tr><tr><td>`rate_id`</td><td>`cr_rrid`</td></tr><tr><td>`startdate`</td><td>`starttime`</td></tr><tr><td>`enddate`</td><td>`endtime`</td></tr><tr><td>`request_pin_mediafile_id`</td><td>`cr_requestpinmeid`</td></tr></tbody></table>

## Important Notes

- The API creates and updates the related meetme row. If confno is not supplied, the conference number is combined with the tenant code.

## Examples

### List Conference Rooms

Returns the conference rooms visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/conferencerooms?tenant=CANISTRACCI"
```

### Get Conference Room

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/conferencerooms/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Conference Room

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Conference",
  "number": "840",
  "hosted": "yes",
  "meetme": {
    "pin": "1234",
    "adminpin": "4321",
    "opts": "T",
    "adminopts": "AaT"
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/conferencerooms?tenant=CANISTRACCI"
```

### Edit Conference Room

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "meetme": {
    "pin": "2468",
    "adminpin": "8642"
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/conferencerooms/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Conference Room

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/conferencerooms/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Flow

The **Flow** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectf"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`flow`</td></tr><tr><td>Primary path</td><td>`/flows`</td></tr><tr><td>ID field</td><td>`fl_id`</td></tr><tr><td>Label field</td><td>`fl_name`</td></tr><tr><td>Primary source table</td><td>`fl_flows`</td></tr><tr><td>Required on create</td><td>`fl_name`</td></tr><tr><td>Path aliases</td><td>`/flow`, `/flows`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/flows?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/flows/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/flows?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/flows/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/flows/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`fl_name`</td></tr><tr><td>`comment`</td><td>`fl_comment`</td></tr><tr><td>`number`</td><td>`fl_number`</td></tr><tr><td>`value`</td><td>`fl_value`</td></tr><tr><td>`variable_name`</td><td>`fl_variable_name`</td></tr><tr><td>`monitor_type`</td><td>`fl_monitor_type`</td></tr><tr><td>`monitor_type_id`</td><td>`fl_monitor_type_id`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`FLOW`</td><td>`destination`, `destinations`</td></tr></tbody></table>

## Examples

### List Flows

Returns the flows visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/flows?tenant=CANISTRACCI"
```

### Get Flow

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/flows/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Flow

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Flow",
  "number": "850",
  "variable_name": "DOCS_FLOW_STATE",
  "value": "open"
}' \
  "https://pbx.example.com/pbx/openapi.php/flows?tenant=CANISTRACCI"
```

### Edit Flow

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "value": "closed"
}' \
  "https://pbx.example.com/pbx/openapi.php/flows/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Flow

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/flows/OBJECT_ID?tenant=CANISTRACCI"
```

### Flow Destination

Updates the `FLOW` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "destination": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/flows/OBJECT_ID?tenant=CANISTRACCI"
```

### Flow State Change

Sets the current flow state using one of the accepted state aliases: status, state, or st\_state.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "status": "open"
}' \
  "https://pbx.example.com/pbx/openapi.php/flows/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Tenant Variable

The **Tenant Variable** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectt"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`tenantvariable`</td></tr><tr><td>Primary path</td><td>`/tenantvariables`</td></tr><tr><td>ID field</td><td>`tv_id`</td></tr><tr><td>Label field</td><td>`tv_value`</td></tr><tr><td>Primary source table</td><td>`tv_tenantvariables`</td></tr><tr><td>Required on create</td><td>`tv_al_id`</td></tr><tr><td>Path aliases</td><td>`/variable`, `/variables`, `/tenantvariable`, `/tenantvariables`, `/tenant_variable`, `/tenant_variables`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/tenantvariables?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/tenantvariables/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/tenantvariables?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/tenantvariables/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/tenantvariables/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`variable_id`</td><td>`tv_al_id`</td></tr><tr><td>`value`</td><td>`tv_value`</td></tr><tr><td>`comment`</td><td>`tv_comment`</td></tr><tr><td>`locked`</td><td>`tv_locked`</td></tr></tbody></table>

## Examples

### List Tenant Variables

Returns the tenant variables visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/tenantvariables?tenant=CANISTRACCI"
```

### Get Tenant Variable

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/tenantvariables/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Tenant Variable

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "variable_id": 1,
  "value": "docs-value",
  "comment": "Docs API variable value"
}' \
  "https://pbx.example.com/pbx/openapi.php/tenantvariables?tenant=CANISTRACCI"
```

### Edit Tenant Variable

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "value": "docs-updated-value"
}' \
  "https://pbx.example.com/pbx/openapi.php/tenantvariables/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Tenant Variable

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/tenantvariables/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# DISA

The **DISA** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectd"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`disa`</td></tr><tr><td>Primary path</td><td>`/disas`</td></tr><tr><td>ID field</td><td>`ds_id`</td></tr><tr><td>Label field</td><td>`ds_name`</td></tr><tr><td>Primary source table</td><td>`ds_disas`</td></tr><tr><td>Required on create</td><td>`ds_name`</td></tr><tr><td>Path aliases</td><td>`/disa`, `/disas`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/disas?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/disas/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/disas?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/disas/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/disas/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`ds_name`</td></tr><tr><td>`mediafile_id`</td><td>`ds_me_id`</td></tr><tr><td>`pin`</td><td>`ds_pin`</td></tr><tr><td>`outbound`</td><td>`ds_outbound`</td></tr><tr><td>`blockcid`</td><td>`ds_blockcid`</td></tr><tr><td>`calleridnum`</td><td>`ds_calleridnum`</td></tr><tr><td>`calleridname`</td><td>`ds_calleridname`</td></tr><tr><td>`digitstimeout`</td><td>`ds_digitstimeout`</td></tr><tr><td>`responsetimeout`</td><td>`ds_responsetimeout`</td></tr><tr><td>`looponattempt`</td><td>`ds_looponattempt`</td></tr></tbody></table>

## Examples

### List DISAs

Returns the disas visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/disas?tenant=CANISTRACCI"
```

### Get DISA

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/disas/OBJECT_ID?tenant=CANISTRACCI"
```

### Create DISA

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API DISA",
  "mediafile_id": 22,
  "pin": "2468",
  "outbound": "yes"
}' \
  "https://pbx.example.com/pbx/openapi.php/disas?tenant=CANISTRACCI"
```

### Edit DISA

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "pin": "1357"
}' \
  "https://pbx.example.com/pbx/openapi.php/disas/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete DISA

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/disas/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Caller ID Blacklist

The **Caller ID Blacklist** object is supported by the MiRTA PBX OpenAPI endpoint. This object is normally tenant-scoped. With a global API key, use `global=1` to manage the shared/global record set. Tenant writes still require `tenant=CANISTRACCI`.

## Object Summary

<table id="bkmrk-propertyvalueobjectc"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`calleridblacklist`</td></tr><tr><td>Primary path</td><td>`/calleridblacklists`</td></tr><tr><td>ID field</td><td>`bl_id`</td></tr><tr><td>Label field</td><td>`bl_callerid`</td></tr><tr><td>Primary source table</td><td>`bl_blacklists`</td></tr><tr><td>Required on create</td><td>`bl_callerid`</td></tr><tr><td>Path aliases</td><td>`/calleridblacklist`, `/calleridblacklists`, `/callerid_blacklist`, `/callerid_blacklists`, `/blacklist`, `/blacklists`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/calleridblacklists?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/calleridblacklists/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/calleridblacklists?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/calleridblacklists/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/calleridblacklists/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`callerid`</td><td>`bl_callerid`</td></tr><tr><td>`reason`</td><td>`bl_reason`</td></tr><tr><td>`inserted`</td><td>`bl_inserted`</td></tr></tbody></table>

## Examples

### List Caller ID Blacklists

Returns the caller id blacklists visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/calleridblacklists?tenant=CANISTRACCI"
```

### Get Caller ID Blacklist

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/calleridblacklists/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Caller ID Blacklist

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "callerid": "+15559990000",
  "reason": "Docs API blocked caller"
}' \
  "https://pbx.example.com/pbx/openapi.php/calleridblacklists?tenant=CANISTRACCI"
```

### Edit Caller ID Blacklist

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "Updated documentation example"
}' \
  "https://pbx.example.com/pbx/openapi.php/calleridblacklists/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Caller ID Blacklist

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/calleridblacklists/OBJECT_ID?tenant=CANISTRACCI"
```

### List Global Caller ID Blacklists

Uses the shared/global record set for object types that support global rows.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/calleridblacklists?global=1"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Campaign

The **Campaign** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectc"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`campaign`</td></tr><tr><td>Primary path</td><td>`/campaigns`</td></tr><tr><td>ID field</td><td>`ca_id`</td></tr><tr><td>Label field</td><td>`ca_name`</td></tr><tr><td>Primary source table</td><td>`ca_campaigns`</td></tr><tr><td>Required on create</td><td>`ca_name`</td></tr><tr><td>Path aliases</td><td>`/campaign`, `/campaigns`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/campaigns?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/campaigns?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`ca_name`</td></tr><tr><td>`type`</td><td>`ca_type`</td></tr><tr><td>`tech`</td><td>`ca_tech`</td></tr><tr><td>`datestart`</td><td>`ca_datestart`</td></tr><tr><td>`dateend`</td><td>`ca_dateend`</td></tr><tr><td>`condition_id`</td><td>`ca_co_id`</td></tr><tr><td>`callerid`</td><td>`ca_callerid`</td></tr><tr><td>`calleridname`</td><td>`ca_calleridname`</td></tr><tr><td>`state`</td><td>`ca_state`</td></tr><tr><td>`queue_id`</td><td>`ca_qu_id`</td></tr><tr><td>`message`</td><td>`ca_message`</td></tr><tr><td>`confirmmessage_id`</td><td>`ca_confirmmessage_me_id`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`CAMPAIGN-ONCONNECT`</td><td>`onconnect`, `on_connect`</td></tr><tr><td>`CAMPAIGN-DONOTCALL`</td><td>`donotcall`, `do_not_call`</td></tr></tbody></table>

## Examples

### List Campaigns

Returns the campaigns visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/campaigns?tenant=CANISTRACCI"
```

### Get Campaign

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Campaign

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Campaign",
  "type": "VOICE",
  "tech": "PJSIP",
  "callerid": "+15551234567",
  "state": "PAUSED"
}' \
  "https://pbx.example.com/pbx/openapi.php/campaigns?tenant=CANISTRACCI"
```

### Edit Campaign

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "state": "ACTIVE"
}' \
  "https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Campaign

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI"
```

### Campaign ONCONNECT Destination

Updates the `CAMPAIGN-ONCONNECT` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "onconnect": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI"
```

### Campaign DONOTCALL Destination

Updates the `CAMPAIGN-DONOTCALL` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "donotcall": [
    22
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI"
```

### Campaign Binary File References

Adds binary or fax-related files to the campaign. Use complete base64 data in production integrations.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "binary_files": [
    {
      "name": "docs-script.txt",
      "data_base64": "VGhpcyBpcyBhIGRvY3VtZW50YXRpb24gZXhhbXBsZS4="
    }
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/campaigns/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Campaign Number

The **Campaign Number** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectc"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`campaignnumber`</td></tr><tr><td>Primary path</td><td>`/campaignnumbers`</td></tr><tr><td>ID field</td><td>`cn_id`</td></tr><tr><td>Label field</td><td>`cn_number`</td></tr><tr><td>Primary source table</td><td>`cn_campaignnumbers`</td></tr><tr><td>Required on create</td><td>`cn_ca_id`, `cn_number`</td></tr><tr><td>Path aliases</td><td>`/campaignnumber`, `/campaignnumbers`, `/campaign_number`, `/campaign_numbers`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/campaignnumbers?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/campaignnumbers/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/campaignnumbers?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/campaignnumbers/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/campaignnumbers/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`campaign_id`</td><td>`cn_ca_id`</td></tr><tr><td>`number`</td><td>`cn_number`</td></tr><tr><td>`description`</td><td>`cn_description`</td></tr><tr><td>`disposition`</td><td>`cn_disposition`</td></tr><tr><td>`attempts`</td><td>`cn_attempts`</td></tr><tr><td>`lastattempt`</td><td>`cn_lastattempt`</td></tr><tr><td>`billsec`</td><td>`cn_billsec`</td></tr></tbody></table>

## Examples

### List Campaign Numbers

Returns the campaign numbers visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/campaignnumbers?tenant=CANISTRACCI"
```

### Get Campaign Number

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/campaignnumbers/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Campaign Number

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "campaign_id": 44,
  "number": "+15557654321",
  "description": "Docs API campaign target"
}' \
  "https://pbx.example.com/pbx/openapi.php/campaignnumbers?tenant=CANISTRACCI"
```

### Edit Campaign Number

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "disposition": "CALLBACK",
  "attempts": 1
}' \
  "https://pbx.example.com/pbx/openapi.php/campaignnumbers/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Campaign Number

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/campaignnumbers/OBJECT_ID?tenant=CANISTRACCI"
```

### List Campaign Numbers for One Campaign

Filters the list by the parent campaign ID. The aliases caid and cn\_ca\_id are also accepted.

```
curl -X GET \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/campaignnumbers?tenant=CANISTRACCI&campaign_id=44"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Cron Job

The **Cron Job** object is supported by the MiRTA PBX OpenAPI endpoint. This object is normally tenant-scoped. With a global API key, use `global=1` to manage the shared/global record set. Tenant writes still require `tenant=CANISTRACCI`.

## Object Summary

<table id="bkmrk-propertyvalueobjectc"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`cronjob`</td></tr><tr><td>Primary path</td><td>`/cronjobs`</td></tr><tr><td>ID field</td><td>`cr_id`</td></tr><tr><td>Label field</td><td>`cr_name`</td></tr><tr><td>Primary source table</td><td>`cr_cronjobs`</td></tr><tr><td>Required on create</td><td>`cr_name`</td></tr><tr><td>Path aliases</td><td>`/cronjob`, `/cronjobs`, `/cron_job`, `/cron_jobs`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/cronjobs?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/cronjobs/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/cronjobs?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/cronjobs/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/cronjobs/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`cr_name`</td></tr><tr><td>`type`</td><td>`cr_type`</td></tr><tr><td>`node_id`</td><td>`cr_no_id`</td></tr><tr><td>`active`</td><td>`cr_active`</td></tr><tr><td>`once`</td><td>`cr_once`</td></tr><tr><td>`minute`</td><td>`cr_minute`</td></tr><tr><td>`hour`</td><td>`cr_hour`</td></tr><tr><td>`day`</td><td>`cr_day`</td></tr><tr><td>`month`</td><td>`cr_month`</td></tr><tr><td>`year`</td><td>`cr_year`</td></tr><tr><td>`weekday`</td><td>`cr_weekday`</td></tr><tr><td>`timezone`</td><td>`cr_timezone`</td></tr><tr><td>`run`</td><td>`cr_run`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`CRONJOB`</td><td>`destination`, `destinations`</td></tr></tbody></table>

## Examples

### List Cron Jobs

Returns the cron jobs visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cronjobs?tenant=CANISTRACCI"
```

### Get Cron Job

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cronjobs/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Cron Job

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Nightly Job",
  "type": "CALL",
  "active": "yes",
  "minute": "0",
  "hour": "2",
  "timezone": "Europe/Rome"
}' \
  "https://pbx.example.com/pbx/openapi.php/cronjobs?tenant=CANISTRACCI"
```

### Edit Cron Job

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "active": "no"
}' \
  "https://pbx.example.com/pbx/openapi.php/cronjobs/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Cron Job

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cronjobs/OBJECT_ID?tenant=CANISTRACCI"
```

### List Global Cron Jobs

Uses the shared/global record set for object types that support global rows.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/cronjobs?global=1"
```

### Cron Job Destination

Updates the `CRONJOB` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "destination": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/cronjobs/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Feature Code

The **Feature Code** object is supported by the MiRTA PBX OpenAPI endpoint. This object is normally tenant-scoped. With a global API key, use `global=1` to manage the shared/global record set. Tenant writes still require `tenant=CANISTRACCI`.

## Object Summary

<table id="bkmrk-propertyvalueobjectf"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`featurecode`</td></tr><tr><td>Primary path</td><td>`/featurecodes`</td></tr><tr><td>ID field</td><td>`fe_id`</td></tr><tr><td>Label field</td><td>`fe_code`</td></tr><tr><td>Primary source table</td><td>`fe_features`</td></tr><tr><td>Required on create</td><td>`fe_code`</td></tr><tr><td>Path aliases</td><td>`/feature`, `/features`, `/featurecodes`, `/feature_codes`, `/feature_code`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/featurecodes?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/featurecodes/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/featurecodes?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/featurecodes/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/featurecodes/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`code`</td><td>`fe_code`</td></tr><tr><td>`comment`</td><td>`fe_comment`</td></tr></tbody></table>

## Destination Fields

Destination fields accept one destination string or an array of destination strings such as `EXT-100`, `VOICEMAIL-100`, or another supported destination type and ID pair.

<table id="bkmrk-destination-typeacce"><thead><tr><th>Destination type</th><th>Accepted aliases</th></tr></thead><tbody><tr><td>`FEATURE`</td><td>`destination`, `feature`</td></tr></tbody></table>

## Examples

### List Feature Codes

Returns the feature codes visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/featurecodes?tenant=CANISTRACCI"
```

### Get Feature Code

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/featurecodes/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Feature Code

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "code": "*880",
  "comment": "Docs API feature code"
}' \
  "https://pbx.example.com/pbx/openapi.php/featurecodes?tenant=CANISTRACCI"
```

### Edit Feature Code

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "comment": "Docs API feature code updated"
}' \
  "https://pbx.example.com/pbx/openapi.php/featurecodes/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Feature Code

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/featurecodes/OBJECT_ID?tenant=CANISTRACCI"
```

### List Global Feature Codes

Uses the shared/global record set for object types that support global rows.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/featurecodes?global=1"
```

### Feature Code Destination

Updates the `FEATURE` destination. The same value can also be sent inside a `destinations` object.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "destination": [
    "EXT-100"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/featurecodes/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

## Standard feature mappings

Use CRUD on `/featuremappings` with `code` and `feature_id`. code must be a known standard function, such as PICKUP. feature\_id is an available tenant/global feature ID, 0 for the default, or -1 to disable. Deleting a mapping removes its override. Use `global=yes` with a global key for shared mappings.

See [Additional Configuration Operations](/books/api/page/additional-configuration-operations) for complete request fields, scope rules and examples.

# Short Number

The **Short Number** object is supported by the MiRTA PBX OpenAPI endpoint. This object is normally tenant-scoped. With a global API key, use `global=1` to manage the shared/global record set. Tenant writes still require `tenant=CANISTRACCI`.

## Object Summary

<table id="bkmrk-propertyvalueobjects"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`shortnumber`</td></tr><tr><td>Primary path</td><td>`/shortnumbers`</td></tr><tr><td>ID field</td><td>`sn_id`</td></tr><tr><td>Label field</td><td>`sn_number`</td></tr><tr><td>Primary source table</td><td>`sn_shortnumbers`</td></tr><tr><td>Required on create</td><td>`sn_number`</td></tr><tr><td>Path aliases</td><td>`/shortnumbers`, `/short_numbers`, `/short_number`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/shortnumbers?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/shortnumbers/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/shortnumbers?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/shortnumbers/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/shortnumbers/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`number`</td><td>`sn_number`</td></tr><tr><td>`destination`</td><td>`sn_destnumber`</td></tr><tr><td>`destnumber`</td><td>`sn_destnumber`</td></tr><tr><td>`comment`</td><td>`sn_comment`</td></tr></tbody></table>

## Examples

### List Short Numbers

Returns the short numbers visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/shortnumbers?tenant=CANISTRACCI"
```

### Get Short Number

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/shortnumbers/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Short Number

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "901",
  "destination": "EXT-100",
  "comment": "Docs API shortcut"
}' \
  "https://pbx.example.com/pbx/openapi.php/shortnumbers?tenant=CANISTRACCI"
```

### Edit Short Number

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "destination": "QUEUE-700"
}' \
  "https://pbx.example.com/pbx/openapi.php/shortnumbers/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Short Number

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/shortnumbers/OBJECT_ID?tenant=CANISTRACCI"
```

### List Global Short Numbers

Uses the shared/global record set for object types that support global rows.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/shortnumbers?global=1"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

# Phone Book

The **Phone Book** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectp"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`phonebook`</td></tr><tr><td>Primary path</td><td>`/phonebooks`</td></tr><tr><td>ID field</td><td>`pb_id`</td></tr><tr><td>Label field</td><td>`pb_name`</td></tr><tr><td>Primary source table</td><td>`pb_phonebooks`</td></tr><tr><td>Required on create</td><td>`pb_name`</td></tr><tr><td>Path aliases</td><td>`/phonebook`, `/phonebooks`, `/phone_book`, `/phone_books`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/phonebooks?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/phonebooks/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/phonebooks?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/phonebooks/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/phonebooks/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`pb_name`</td></tr><tr><td>`include_extensions`</td><td>`pb_includeext`</td></tr><tr><td>`includeext`</td><td>`pb_includeext`</td></tr><tr><td>`include_short_numbers`</td><td>`pb_includeshortnum`</td></tr><tr><td>`includeshortnum`</td><td>`pb_includeshortnum`</td></tr><tr><td>`layout`</td><td>`pl_phonebooklayouts`</td></tr><tr><td>`items`</td><td>`pl_phonebooklayouts`</td></tr></tbody></table>

## Important Notes

- The layout field replaces the phone book field layout. Values can be phone book item codes such as NAME, PHONE1, EMAIL, and ROUTING, or pi\_phonebookitems IDs.
- When layout is omitted on create, the API creates the default layout NAME, PHONE1, PHONE2, EMAIL, ROUTING.
- Deleting a phone book removes its layout rows, entries, entry details, and phone assignment rows.

## Examples

### List Phone Books

Returns the phone books visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebooks?tenant=CANISTRACCI"
```

### Get Phone Book

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebooks/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Phone Book

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Phone Book",
  "include_extensions": "no",
  "include_short_numbers": "no",
  "layout": [
    "NAME",
    "PHONE1",
    "PHONE2",
    "EMAIL",
    "ROUTING"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/phonebooks?tenant=CANISTRACCI"
```

### Edit Phone Book

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Phone Book Updated",
  "layout": [
    "NAME",
    "PHONE1",
    "EMAIL",
    "ROUTING"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/phonebooks/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Phone Book

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebooks/OBJECT_ID?tenant=CANISTRACCI"
```

### Replace Phone Book Layout

Replaces the pl\_phonebooklayouts rows for the selected phone book.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "layout": [
    "NAME",
    "PHONE1",
    "EMAIL",
    "ROUTING"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/phonebooks/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

## Download, bulk add, and clear one phone book

Use `/phonebooks/{id}/entries` to work with all stored contacts in one selected tenant phone book. Replace `{id}` with the phone book ID and supply the tenant code or name through `tenant`. A global API key must also select a tenant for these operations.

<table id="bkmrk-methodoperationapi-k"><thead><tr><th>Method</th><th>Operation</th><th>API key</th></tr></thead><tbody><tr><td>GET</td><td>Download every stored entry and its field values as JSON, without pagination.</td><td>Full or read-only</td></tr><tr><td>POST</td><td>Append 1–500 entries in one request.</td><td>Full</td></tr><tr><td>DELETE</td><td>Delete all entries and their details from the selected phone book.</td><td>Full</td></tr></tbody></table>

The download covers database contacts. Automatically included extensions and short numbers are not synthesized into the export. Deleting entries preserves the phone book definition, its layout, and its phone assignments. Other phone books and tenants are unchanged. To delete the phone book itself, use the separate `DELETE /phonebooks/{id}` operation.

### Download all contacts

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebooks/8/entries?tenant=CANISTRACCI" \
  -o phonebook.json
```

The response includes the phone book ID and name, a contact count, and an `entries` array. Each contact has its entry ID, a `values` object keyed by phone book field codes, and the stored detail records. An empty phone book returns `"count": 0` and `"entries": []`.

```
{
  "phonebook_id": 8,
  "name": "Customers",
  "count": 1,
  "entries": [{
    "id": 101,
    "values": {"NAME": "Alice Smith", "PHONE1": "00123456789"},
    "details": [
      {"id": 201, "item_id": 1, "code": "NAME", "value": "Alice Smith"},
      {"id": 202, "item_id": 2, "code": "PHONE1", "value": "00123456789"}
    ]
  }]
}
```

The IDs in these examples are illustrative. Existing field codes and item IDs can be inspected with `GET /phonebooks/8?tenant=CANISTRACCI` in the `related.available_items` data.

### Add several contacts

Send an object containing an `entries` array. Each entry contains a `values` object. Use configured field codes such as `NAME`, `PHONE1`, `PHONE2`, and `EMAIL`; field codes are case-insensitive. Values can be strings, numbers, or null. Keep phone numbers as strings to preserve leading zeros and plus signs. Null and empty values are omitted, and each contact must contain at least one non-empty value. Unknown or duplicate field codes are rejected.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"entries":[
    {"values":{"NAME":"Alice Smith","PHONE1":"00123456789"}},
    {"values":{"NAME":"Bob Jones","PHONE1":"+390212345678","EMAIL":"bob@example.com"}}
  ]}' \
  "https://pbx.example.com/pbx/openapi.php/phonebooks/8/entries?tenant=CANISTRACCI"
```

A successful request returns HTTP 201 with IDs in request order:

```
{"phonebook_id":8,"created":2,"ids":[101,102]}
```

Missing database fields use the applicable New Item Defaults, as with other creation APIs. Tenant and phone book ownership always come from the authenticated scope and URL. Send larger imports in batches of at most 500 contacts. POST appends contacts; repeating a successful request creates additional entries.

To reuse a download as input, build a new object containing `entries` with only each contact's `values`. Do not submit exported IDs, detail records, or the download's name/count fields.

### Clear the selected phone book

```
curl -X DELETE -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebooks/8/entries?tenant=CANISTRACCI"
```

```
{"phonebook_id":8,"deleted":true,"deleted_entries":2,"deleted_details":5}
```

No body is required. Clearing an already empty phone book succeeds with zero counts.

### Transactions and failures

Each bulk POST or DELETE uses one checked database transaction. The phone book, entry, and detail tables must use InnoDB. If a contact cannot be inserted, the complete batch is rolled back, including entries inserted earlier in the request. Database truncation warnings also cause a rollback. A clear request followed by an import is two separate transactions.

Errors use the usual `error.code` and `error.message` response. Database failures include an error number and affected column when available, without exposing SQL or contact values. Transaction failures also include `error.rolled_back` (true if rollback completed, false if it could not be confirmed, null if no transaction started) and `error.entry_index` (the one-based entry position when available). Validation before a transaction can return the standard error shape without those additional fields.

```
{"error":{"code":"phonebook_bulk_failed","message":"Database error 1406 (column pd_pi_value) while saving entry 2 details. The transaction was rolled back.","rolled_back":true,"entry_index":2}}
```

If activity logging fails after the database commit, the response remains successful and includes a `warning`; the contacts have already been saved or deleted.

### Alternative query-string routing

For installations that do not accept path information, use the same methods with:

```
https://pbx.example.com/pbx/openapi.php?object=phonebook&action=entries&id=8&tenant=CANISTRACCI
```

# Phone Book Entry

The **Phone Book Entry** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectp"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`phonebookentry`</td></tr><tr><td>Primary path</td><td>`/phonebookentries`</td></tr><tr><td>ID field</td><td>`pe_id`</td></tr><tr><td>Label field</td><td>`pe_id`</td></tr><tr><td>Primary source table</td><td>`pe_phonebookentries`</td></tr><tr><td>Required on create</td><td>`phonebook_id`, `at least one value`</td></tr><tr><td>Path aliases</td><td>`/phonebookentry`, `/phonebookentries`, `/phonebook_entry`, `/phonebook_entries`, `/phonebookcontact`, `/phonebookcontacts`, `/phonebook_contact`, `/phonebook_contacts`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/phonebookentries?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/phonebookentries/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/phonebookentries?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/phonebookentries/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/phonebookentries/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`phonebook_id`</td><td>`pe_pb_id`</td></tr><tr><td>`pbid`</td><td>`pe_pb_id`</td></tr><tr><td>`values`</td><td>`pd_phonebookdetails keyed by pi_code`</td></tr><tr><td>`fields`</td><td>`pd_phonebookdetails keyed by pi_code`</td></tr><tr><td>`details`</td><td>`pd_phonebookdetails rows`</td></tr><tr><td>`NAME`</td><td>`phone book item code`</td></tr><tr><td>`PHONE1`</td><td>`phone book item code`</td></tr><tr><td>`PHONE2`</td><td>`phone book item code`</td></tr><tr><td>`EMAIL`</td><td>`phone book item code`</td></tr><tr><td>`ROUTING`</td><td>`phone book item code`</td></tr></tbody></table>

## Important Notes

- Entry values are stored in pd\_phonebookdetails and are keyed by pi\_phonebookitems.pi\_code.
- Send values as a values or fields object, as top-level item codes, or as detail rows containing pi\_id or pi\_code and a value.
- Sending an empty string or null for a value clears that field from the entry.

## Examples

### List Phone Book Entries

Returns the phone book entries visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebookentries?tenant=CANISTRACCI"
```

### Get Phone Book Entry

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebookentries/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Phone Book Entry

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "phonebook_id": 12,
  "values": {
    "NAME": "Ada Rivera",
    "PHONE1": "+15551230001",
    "EMAIL": "ada.rivera@example.com",
    "ROUTING": "EXT-100"
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/phonebookentries?tenant=CANISTRACCI"
```

### Edit Phone Book Entry

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "values": {
    "PHONE1": "+15551230002",
    "EMAIL": "ada.updated@example.com"
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/phonebookentries/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Phone Book Entry

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebookentries/OBJECT_ID?tenant=CANISTRACCI"
```

### List Entries for One Phone Book

Filters the phone book entry list by parent phonebook\_id. The aliases pbid and pe\_pb\_id are also accepted.

```
curl -X GET \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/phonebookentries?tenant=CANISTRACCI&phonebook_id=12"
```

### Clear Phone Book Entry Value

Removes the EMAIL detail row for the selected entry while leaving other values unchanged.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "values": {
    "EMAIL": ""
  }
}' \
  "https://pbx.example.com/pbx/openapi.php/phonebookentries/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

## All entries of one phone book

Use `GET /phonebooks/{id}/entries` to download all stored contacts, `POST /phonebooks/{id}/entries` to append up to 500 contacts atomically, and `DELETE /phonebooks/{id}/entries` to clear only the selected phone book. These operations require a selected tenant; writes require a full API key.

For request bodies, responses, and rollback behavior, see the [Phone Book](/link/1977#phonebook-entry-collection) page.

# Provisioning Phone

The **Provisioning Phone** object is supported by the MiRTA PBX OpenAPI endpoint. This object is tenant-scoped. Tenant API keys must include `tenant=CANISTRACCI`; writes require a writable API key.

## Object Summary

<table id="bkmrk-propertyvalueobjectp"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`provisioningphone`</td></tr><tr><td>Primary path</td><td>`/provisioningphones`</td></tr><tr><td>ID field</td><td>`ph_id`</td></tr><tr><td>Label field</td><td>`ph_name`</td></tr><tr><td>Primary source table</td><td>`ph_phones`</td></tr><tr><td>Required on create</td><td>`ph_name`, `ph_mac`</td></tr><tr><td>Path aliases</td><td>`/phone`, `/phones`, `/provisioningphones`, `/provisioning_phones`, `/provisioning_phone`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List</td><td>`GET https://pbx.example.com/pbx/openapi.php/provisioningphones?tenant=CANISTRACCI`</td></tr><tr><td>Get by ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/provisioningphones/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Create</td><td>`POST https://pbx.example.com/pbx/openapi.php/provisioningphones?tenant=CANISTRACCI`</td></tr><tr><td>Update</td><td>`PATCH https://pbx.example.com/pbx/openapi.php/provisioningphones/OBJECT_ID?tenant=CANISTRACCI`</td></tr><tr><td>Delete</td><td>`DELETE https://pbx.example.com/pbx/openapi.php/provisioningphones/OBJECT_ID?tenant=CANISTRACCI`</td></tr></tbody></table>

## Accepted Field Aliases

<table id="bkmrk-request-fieldsource-"><thead><tr><th>Request field</th><th>Source field</th></tr></thead><tbody><tr><td>`name`</td><td>`ph_name`</td></tr><tr><td>`mac`</td><td>`ph_mac`</td></tr><tr><td>`model_id`</td><td>`ph_pm_id`</td></tr><tr><td>`password`</td><td>`ph_password`</td></tr><tr><td>`filename`</td><td>`ph_filename`</td></tr><tr><td>`http_user`</td><td>`ph_http_user`</td></tr><tr><td>`http_password`</td><td>`ph_http_password`</td></tr></tbody></table>

## Examples

### List Provisioning Phones

Returns the provisioning phones visible to the key and scope.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/provisioningphones?tenant=CANISTRACCI"
```

### Get Provisioning Phone

Reads one object by its internal ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/provisioningphones/OBJECT_ID?tenant=CANISTRACCI"
```

### Create Provisioning Phone

Creates a new object. Use the short aliases shown above or the source field names.

```
curl -X POST \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API Desk Phone",
  "mac": "001122334455",
  "model_id": 1,
  "filename": "docs-api-001122334455.cfg"
}' \
  "https://pbx.example.com/pbx/openapi.php/provisioningphones?tenant=CANISTRACCI"
```

### Edit Provisioning Phone

Updates only the supplied fields.

```
curl -X PATCH \
  -H "X-API-Key: TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "http_user": "phone-user",
  "http_password": "change-this-password"
}' \
  "https://pbx.example.com/pbx/openapi.php/provisioningphones/OBJECT_ID?tenant=CANISTRACCI"
```

### Delete Provisioning Phone

Deletes the object. Check references before deleting configuration used by routing or reporting.

```
curl -X DELETE \
  -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/provisioningphones/OBJECT_ID?tenant=CANISTRACCI"
```

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code is required for tenant-scoped writes or tenant-key reads.</td></tr><tr><td>`read_only_api_key`</td><td>The key can read data but cannot create, update, or delete objects.</td></tr><tr><td>`missing_required_field`</td><td>A required create field is missing.</td></tr></tbody></table>

## Phone assignments and provisioning values

Use CRUD on `/phonebuttonlayouts` (phone\_id, layout\_id, order), `/phonebookassignments` (phone\_id, phonebook\_id, order), and `/provisioningvalues` (owner\_id, type, order, label\_id, value). For PHONE/LINE the owner is a phone; for BUTTON it is a button layout. PHONE uses order=0; LINE and BUTTON use a valid position. BUTTON order=0 stores phonebook mappings for a phonebook-enabled layout. All parents must belong to the selected tenant.

See [Additional Configuration Operations](/books/api/page/additional-configuration-operations) for complete request fields, scope rules and examples.

# AI Analysis

The **AI Analysis** endpoint returns transcript, AI summary, and sentimental analysis data for recorded calls. It is a read-only OpenAPI endpoint and supports `GET` only.

Use this endpoint when an integration already has an Asterisk `uniqueid` from CDR, Simple CDR, call events, or recording metadata and needs the AI results associated with that call.

## Object Summary

<table id="bkmrk-propertyvalueobjecta"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`aianalysis`</td></tr><tr><td>Primary path</td><td>`/aianalysis`</td></tr><tr><td>Path aliases</td><td>`/aianalysis`, `/aianalyses`, `/ai_analysis`, `/ai_analyses`, `/callanalysis`, `/call_analysis`</td></tr><tr><td>Supported method</td><td>`GET`</td></tr><tr><td>Required filter</td><td>`uniqueid`</td></tr><tr><td>Default format</td><td>`json`</td></tr><tr><td>Source tables</td><td>`rm_recordingmetadatas`, `tr_transcripts`</td></tr></tbody></table>

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>Get AI analysis by unique ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CANISTRACCI&uniqueid=1717240000.42`</td></tr><tr><td>Get AI analysis by path unique ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/aianalysis/1717240000.42?tenant=CANISTRACCI`</td></tr><tr><td>Get multiple calls</td><td>`GET https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CANISTRACCI&uniqueid=1717240000.42,1717240000.43`</td></tr><tr><td>Use an alias path</td><td>`GET https://pbx.example.com/pbx/openapi.php/ai_analysis?tenant=CANISTRACCI&uniqueid=1717240000.42`</td></tr></tbody></table>

## Query Parameters

<table id="bkmrk-parameterdescription"><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`tenant`</td><td>Tenant code or tenant name. Tenant API keys are restricted to their tenant. Global API keys can query one tenant by code or name, use `%` wildcards, or omit the parameter to search all tenants.</td></tr><tr><td>`uniqueid`</td><td>Required comma-separated Asterisk unique ID values. A path value such as `/aianalysis/1717240000.42` also maps to this filter.</td></tr><tr><td>`key`</td><td>Optional API key query parameter. Prefer the `X-API-Key` header or bearer token for new integrations.</td></tr></tbody></table>

## Response Fields

<table id="bkmrk-fielddescriptiontena"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td>`tenant_id`</td><td>Internal tenant ID.</td></tr><tr><td>`tenant_code`</td><td>Tenant code.</td></tr><tr><td>`uniqueid`</td><td>Asterisk unique ID requested by the integration.</td></tr><tr><td>`transcript`</td><td>Full transcript text. When recording metadata does not contain a full transcript, MiRTA PBX builds this value from transcript segments.</td></tr><tr><td>`summary`</td><td>AI-generated call summary.</td></tr><tr><td>`sentiment_score`</td><td>First numeric sentimental analysis score found for the unique ID, or `null`.</td></tr><tr><td>`sentiment_scores`</td><td>All distinct numeric sentimental analysis scores found for the unique ID.</td></tr><tr><td>`sentiment_brief`</td><td>Short sentimental analysis text from recording metadata.</td></tr><tr><td>`sentiment_details`</td><td>Detailed sentimental analysis payload. This may be JSON text depending on the configured AI processor.</td></tr><tr><td>`recordings`</td><td>Per-recording metadata rows for the unique ID.</td></tr><tr><td>`transcript_segments`</td><td>Timestamped transcript segments for the unique ID.</td></tr></tbody></table>

## Recording Fields

<table id="bkmrk-fielddescriptionmeta"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td>`metadata_id`</td><td>Internal recording metadata row ID.</td></tr><tr><td>`recording_id`</td><td>Internal recording ID.</td></tr><tr><td>`date`</td><td>Recording metadata date.</td></tr><tr><td>`transcript`</td><td>Transcript stored on that recording metadata row.</td></tr><tr><td>`summary`</td><td>Summary stored on that recording metadata row.</td></tr><tr><td>`sentiment_score`</td><td>Numeric sentimental score for that recording metadata row, or `null`.</td></tr><tr><td>`sentiment_brief`</td><td>Short sentimental analysis text for that recording metadata row.</td></tr><tr><td>`sentiment_details`</td><td>Detailed sentimental analysis payload for that recording metadata row.</td></tr></tbody></table>

## Transcript Segment Fields

<table id="bkmrk-fielddescriptionreco"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td>`recording_id`</td><td>Internal recording ID associated with the transcript segment.</td></tr><tr><td>`speaker`</td><td>Speaker number assigned by the transcript processor.</td></tr><tr><td>`start`</td><td>Segment start time. Numeric values are returned as numbers.</td></tr><tr><td>`end`</td><td>Segment end time. Numeric values are returned as numbers.</td></tr><tr><td>`text`</td><td>Transcript text for the segment.</td></tr></tbody></table>

## Examples

### Get AI Analysis

Returns transcript, summary, and sentimental analysis data for one call unique ID.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CANISTRACCI&uniqueid=1717240000.42"
```

### Get AI Analysis by Path

Uses the path segment after `/aianalysis` as the unique ID filter.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/aianalysis/1717240000.42?tenant=CANISTRACCI"
```

### Get Multiple AI Analysis Results

Requests more than one unique ID in a single call.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CANISTRACCI&uniqueid=1717240000.42,1717240000.43"
```

### Global Key Tenant Wildcard

Uses a global API key to search matching tenants. Use this only when unique IDs may need to be resolved across tenant boundaries.

```
curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CAN%25&uniqueid=1717240000.42"
```

### Example Response

```
[
  {
    "tenant_id": 12,
    "tenant_code": "CANISTRACCI",
    "uniqueid": "1717240000.42",
    "transcript": "Speaker 1: Hello, how can I help you?",
    "summary": "The caller asked for support and the agent scheduled a follow-up.",
    "sentiment_score": 0.72,
    "sentiment_scores": [0.72],
    "sentiment_brief": "Positive",
    "sentiment_details": "{...}",
    "recordings": [
      {
        "metadata_id": 345,
        "recording_id": 678,
        "date": "2026-06-01 10:00:00",
        "transcript": "Speaker 1: Hello, how can I help you?",
        "summary": "The caller asked for support and the agent scheduled a follow-up.",
        "sentiment_score": 0.72,
        "sentiment_brief": "Positive",
        "sentiment_details": "{...}"
      }
    ],
    "transcript_segments": [
      {
        "recording_id": 678,
        "speaker": 1,
        "start": 0.0,
        "end": 3.4,
        "text": "Hello, how can I help you?"
      }
    ]
  }
]
```

## Important Notes

- The endpoint returns rows only for unique IDs that have recording metadata or transcript segments in the selected tenant scope. Unknown unique IDs are omitted from the response.
- If multiple recording metadata rows exist for the same unique ID, top-level transcript, summary, and sentiment text values are combined without duplicate text. The `recordings` array preserves the per-recording values.
- `sentiment_details` is returned as stored. It may contain JSON text produced by the configured sentimental analysis model.
- The endpoint checks available database columns before selecting transcript and metadata fields, so older installations may return fewer populated fields until their database upgrades are complete.

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`tenant_required`</td><td>A tenant code or tenant name is required when using a tenant API key.</td></tr><tr><td>`tenant_not_found`</td><td>The tenant parameter did not match any visible tenant.</td></tr><tr><td>`uniqueid_required`</td><td>The request did not include a usable `uniqueid` value.</td></tr><tr><td>`method_not_allowed`</td><td>The endpoint is read-only and only supports `GET`.</td></tr></tbody></table>

# AI Logs

The **AI Logs** endpoint exports records from `ai_ailogs`. It is a read-only OpenAPI endpoint that supports JSON responses and downloadable CSV files.

Use this endpoint to report on conversations handled by the Talk with AI custom destination, including the conversation text, duration, caller ID, and token usage. To retrieve call transcripts, summaries, and sentimental analysis instead, use the `/aianalysis` endpoint.

## Object Summary

<table id="bkmrk-propertyvalueobjecta"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Object</td><td>`ailog`</td></tr><tr><td>Primary path</td><td>`/ailogs`</td></tr><tr><td>Path aliases</td><td>`/ailog`, `/ailogs`, `/ai_log`, `/ai_logs`</td></tr><tr><td>Supported method</td><td>`GET`</td></tr><tr><td>Default format</td><td>`json`</td></tr><tr><td>Export format</td><td>`csv`</td></tr><tr><td>Source table</td><td>`ai_ailogs`</td></tr></tbody></table>

## Authentication and Tenant Scope

The endpoint accepts tenant full API keys, tenant read-only API keys, global full API keys, and global read-only API keys. Supply the key in the `X-API-Key` header, as a bearer token, or in the `key` query parameter.

- A tenant API key can return records only for its own tenant.
- A global API key can select one tenant by code or name, use a `%` wildcard, or omit `tenant` to return records from all tenants.
- If IP filtering is enabled for the selected key, the request must originate from an allowed IP address or network.

## Endpoint Patterns

<table id="bkmrk-actionexample-patter"><thead><tr><th>Action</th><th>Example pattern</th></tr></thead><tbody><tr><td>List AI logs as JSON</td><td>`GET https://pbx.example.com/pbx/openapi.php/ailogs?tenant=CANISTRACCI`</td></tr><tr><td>Export AI logs as CSV</td><td>`GET https://pbx.example.com/pbx/openapi.php/ailogs?tenant=CANISTRACCI&format=csv`</td></tr><tr><td>Use the CSV export path</td><td>`GET https://pbx.example.com/pbx/openapi.php/ailogs/export?tenant=CANISTRACCI`</td></tr><tr><td>Filter by date range</td><td>`GET https://pbx.example.com/pbx/openapi.php/ailogs?tenant=CANISTRACCI&start=2026-08-01%2000:00:00&end=2026-08-31%2023:59:59`</td></tr><tr><td>Get one row by path ID</td><td>`GET https://pbx.example.com/pbx/openapi.php/ailogs/123?tenant=CANISTRACCI`</td></tr><tr><td>Compatibility query form</td><td>`GET https://pbx.example.com/pbx/openapi.php?object=ailogs&action=list&tenant=CANISTRACCI`</td></tr></tbody></table>

## Query Parameters

<table id="bkmrk-parameterdescription"><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`tenant`</td><td>Tenant code or tenant name. Tenant API keys are restricted to their tenant. Global API keys can use a code, name, `%` wildcard, or omit this parameter to search all tenants.</td></tr><tr><td>`start`</td><td>Start date and time applied to `ai_start`. The default is today at `00:00:00`. The date filter is not applied when `id` or `uniqueid` is supplied.</td></tr><tr><td>`end`</td><td>End date and time applied to `ai_start`. The default is today at `23:59:59`. The date filter is not applied when `id` or `uniqueid` is supplied.</td></tr><tr><td>`id`</td><td>One or more comma-separated `ai_id` values. A path value such as `/ailogs/123` maps to this filter.</td></tr><tr><td>`uniqueid`</td><td>One or more comma-separated Asterisk unique ID values.</td></tr><tr><td>`callerid`</td><td>One or more comma-separated exact caller ID values.</td></tr><tr><td>`customid`</td><td>One or more comma-separated custom destination IDs from `cu_customs`.</td></tr><tr><td>`format`</td><td>`json` or `csv`. The default is `json`. The `/ailogs/export` path defaults to `csv`.</td></tr><tr><td>`key`</td><td>Optional API key query parameter. Prefer the `X-API-Key` header or bearer token for new integrations.</td></tr></tbody></table>

## Response and CSV Fields

JSON objects and CSV columns use the following fields in this order:

<table id="bkmrk-fielddescriptionai_i"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td>`ai_id`</td><td>Internal AI log row ID.</td></tr><tr><td>`ai_te_id`</td><td>Internal tenant ID.</td></tr><tr><td>`ai_cu_id`</td><td>Internal custom destination ID.</td></tr><tr><td>`cu_name`</td><td>Name of the associated custom destination, when available.</td></tr><tr><td>`ai_uniqueid`</td><td>Asterisk unique ID associated with the AI conversation.</td></tr><tr><td>`ai_callerid`</td><td>Caller ID recorded for the conversation.</td></tr><tr><td>`ai_start`</td><td>Conversation start date and time.</td></tr><tr><td>`ai_end`</td><td>Conversation end date and time.</td></tr><tr><td>`ai_duration`</td><td>Conversation duration.</td></tr><tr><td>`ai_talk`</td><td>Conversation exchanged with the AI service.</td></tr><tr><td>`ai_total_tokens`</td><td>Total tokens reported for the AI request.</td></tr><tr><td>`ai_input_tokens`</td><td>Input tokens reported for the AI request.</td></tr><tr><td>`ai_output_tokens`</td><td>Output tokens reported for the AI request.</td></tr></tbody></table>

## Examples

### List Current-Day AI Logs

When no ID or date filter is supplied, the endpoint returns records started during the current day.

```
curl -H "X-API-Key: TENANT_READ_ONLY_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/ailogs?tenant=CANISTRACCI"
```

### Export a Date Range as CSV

```
curl -H "X-API-Key: TENANT_READ_ONLY_API_KEY" \
  -o ai-logs.csv \
  "https://pbx.example.com/pbx/openapi.php/ailogs/export?tenant=CANISTRACCI&start=2026-08-01%2000:00:00&end=2026-08-31%2023:59:59"
```

### Get Logs by Unique ID

Supplying `uniqueid` disables the default current-day filter, so an older record can be retrieved without also setting a date range.

```
curl -H "Authorization: Bearer TENANT_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/ailogs?tenant=CANISTRACCI&uniqueid=1787740000.42"
```

### Example JSON Response

```
[
  {
    "ai_id": 123,
    "ai_te_id": 12,
    "ai_cu_id": 34,
    "cu_name": "AI Receptionist",
    "ai_uniqueid": "1787740000.42",
    "ai_callerid": "+390212345678",
    "ai_start": "2026-08-26 09:30:00",
    "ai_end": "2026-08-26 09:31:15",
    "ai_duration": 75,
    "ai_talk": ">> I need sales.\n<< I will connect you.",
    "ai_total_tokens": 420,
    "ai_input_tokens": 280,
    "ai_output_tokens": 140
  }
]
```

## Important Notes

- The endpoint is read-only. `POST`, `PUT`, `PATCH`, and `DELETE` are rejected.
- Without `id` or `uniqueid`, the default range is the current day. Set `start` and `end` to export a different period.
- When `id` or `uniqueid` is supplied, the date range is intentionally ignored.
- A global key without a `tenant` parameter can return records from all tenants visible to that key.
- The `ai_talk` field can contain sensitive conversation content. Store exports securely and restrict access to API keys.
- Use `/aianalysis`, not `/ailogs`, for recorded-call transcripts, summaries, and sentimental analysis.

## Common Errors

<table id="bkmrk-errormeaningmissing_"><thead><tr><th>Error</th><th>Meaning</th></tr></thead><tbody><tr><td>`missing_api_key`</td><td>No API key was supplied in the query string, `X-API-Key`, or bearer token.</td></tr><tr><td>`invalid_api_key`</td><td>The supplied key does not match the tenant or global API key.</td></tr><tr><td>`api_ip_not_allowed`</td><td>IP filtering is enabled and the client address is not in the key's allowed IP or network list.</td></tr><tr><td>`tenant_required`</td><td>A tenant code or tenant name is required when using a tenant API key.</td></tr><tr><td>`tenant_not_found`</td><td>The tenant parameter did not match any visible tenant.</td></tr><tr><td>`invalid_format`</td><td>The `format` value is not `json` or `csv`.</td></tr><tr><td>`method_not_allowed`</td><td>The endpoint is read-only and only supports `GET`.</td></tr></tbody></table>

# Additional Configuration Operations

# Additional Configuration Operations

OpenAPI 1.2.0 adds the Configuration/Settings resources and related object operations listed below. All paths are relative to `https://pbx.example.com/pbx/openapi.php`. Supply the API key in `X-API-Key` and select the tenant with `?tenant=TENANT_CODE`.

## Collection and object operations

<table id="bkmrk-method-and-pathopera"><thead><tr><th>Method and path</th><th>Operation</th></tr></thead><tbody><tr><td>GET /resource</td><td>List the selected scope.</td></tr><tr><td>POST /resource</td><td>Create; returns HTTP 201 and the saved object.</td></tr><tr><td>GET /resource/{id}</td><td>Read one object.</td></tr><tr><td>PUT or PATCH /resource/{id}</td><td>Update supplied fields, preserving omitted fields.</td></tr><tr><td>DELETE /resource/{id}</td><td>Delete one object; returns deleted=true.</td></tr></tbody></table>

These new lists accept `limit` (default 100, maximum 1000), `offset` (default 0), and equality filters using the documented short aliases, except secret, binary and template content fields. Use the returned `id` for item operations. A list returns an array; object responses include the native database fields, `id`, and `object`. Unknown or read-only fields are rejected. Only documented aliases or their corresponding native column names are accepted.

New-item defaults apply to omitted writable fields on creation: installation defaults first, then tenant defaults; explicit request values take precedence. IDs, tenant ownership and worker-maintained fields cannot be supplied. Related IDs are checked in the selected scope. Use a full key for writes; read-only keys can list and read metadata, with credentials and binary downloads withheld. Quick shortcuts require a global key because they belong to users.

Each mutation uses a checked transaction and requires InnoDB for all tables it modifies. A failure returns an error with `code`, `message` and `rolled_back`. Database errors report the number and, when available, the column, without exposing SQL or secret values. A post-commit activity-log failure returns a successful response with a warning. Use `global=yes` only on the explicitly listed resources, with a global key.

Query-string routing is also supported, for example `openapi.php?object=manageruser&action=create&tenant=TENANT_CODE` with POST JSON, or `object=manageruser&id=8` with GET/PATCH/DELETE. JSON request bodies contain the object fields, not routing parameters.

## Available resources

<table id="bkmrk-collectionrequired-f"><thead><tr><th>Collection</th><th>Required fields when no new-item default supplies them</th><th>Purpose</th></tr></thead><tbody><tr><td>`/managerusers`</td><td>name, password</td><td>manageruser</td></tr><tr><td>`/quickshortcuts`</td><td>us\_id, name, link</td><td>quickshortcut</td></tr><tr><td>`/pickupgroups`</td><td>number, name</td><td>pickupgroup</td></tr><tr><td>`/internalroutings`</td><td>regexp, ex\_id</td><td>internalrouting</td></tr><tr><td>`/parkingreturns`</td><td>number, dialback</td><td>parkingreturn</td></tr><tr><td>`/parkinglots`</td><td>name, start, end</td><td>parkinglot</td></tr><tr><td>`/callprivacyrules`</td><td>callerid, action</td><td>callprivacy</td></tr><tr><td>`/autoanswers`</td><td>field</td><td>autoanswer</td></tr><tr><td>`/dialbynamedirectories`</td><td>name</td><td>dialbynamedirectory</td></tr><tr><td>`/dialbynameentries`</td><td>dbn\_id, type, type\_id, number</td><td>dialbynameentry</td></tr><tr><td>`/digitalfaxes`</td><td>number</td><td>digitalfax</td></tr><tr><td>`/alarmbindings`</td><td>callerid</td><td>alarmbinding</td></tr><tr><td>`/mailtofaxes`</td><td>name, host, username</td><td>mailtofax</td></tr><tr><td>`/mailtocalls`</td><td>name, host, username, authtype</td><td>mailtocall</td></tr><tr><td>`/scheduledcalls`</td><td>tobecalled</td><td>scheduledcall</td></tr><tr><td>`/dashboards`</td><td>name</td><td>dashboard</td></tr><tr><td>`/dashboarditems`</td><td>td\_id, code</td><td>dashboarditem</td></tr><tr><td>`/linemonitors`</td><td>name</td><td>linemonitor</td></tr><tr><td>`/xmltemplates`</td><td>name, xmltemplate</td><td>xmltemplate</td></tr><tr><td>`/causecodes`</td><td>code</td><td>causecode</td></tr><tr><td>`/cnamcacheentries`</td><td>number, name</td><td>cnamcacheentry</td></tr><tr><td>`/extensiondialings`</td><td>from, to</td><td>extensiondialing</td></tr><tr><td>`/translationrooms`</td><td>name, basenumber</td><td>translationroom</td></tr><tr><td>`/translationlanguages`</td><td>tr\_id, number, language</td><td>translationlanguage</td></tr><tr><td>`/customdestinationinfos`</td><td>cu\_id</td><td>customdestinationinfo</td></tr><tr><td>`/customdestinationfiles`</td><td>cu\_id, name, binaryfile</td><td>customdestinationfile</td></tr><tr><td>`/provisioningvalues`</td><td>ph\_id, type, al\_id</td><td>provisioningvalue</td></tr><tr><td>`/phonebuttonlayouts`</td><td>ph\_id, bl\_id</td><td>phonebuttonlayout</td></tr><tr><td>`/phonebookassignments`</td><td>ph\_id, pb\_id</td><td>phonebookassignment</td></tr><tr><td>`/featuremappings`</td><td>code</td><td>featuremapping</td></tr></tbody></table>

### managerusers

Manager users are owned by the selected tenant. Read-only keys do not receive passwords.

Writable fields: `name, password, description`.

### quickshortcuts

Global API key required, including reads. user\_id is a real user ID, or 0 for default shortcuts. Links must be relative or HTTP(S).

Writable fields: `us_id, name, order, icon_stack1, icon_stack2, icon_stack3, link, user_id`.

### pickupgroups

number identifies the pickup/call group; the name is unique to that tenant and number.

Writable fields: `number, name`.

### internalroutings

extension\_id must belong to the selected tenant. regexp must be a valid regular expression; deldigits is non-negative.

Writable fields: `regexp, ex_id, adddigits, deldigits, extension_id`.

### parkingreturns

number and dialback are strings; leading zeros are preserved.

Writable fields: `number, dialback, comment`.

### parkinglots

The tenant-code prefix is automatically added to name. start and end are numeric and inclusive (maximum 10001 spaces per API-created range). hosted must name an existing server. moh is 0 or tenant/global music on hold.

Writable fields: `name, start, end, hosted, timeout, defaultreturnnumber, moh`.

### callprivacyrules

action: allow, kill, torture or deny. data\_base64 optionally stores the recorded privacy message. CallerID must be unique per tenant.

Writable fields: `callerid, action, media, datetime, data_base64`.

### autoanswers

Global rows are supported with a global key and global=yes. The shared scope is -1.

Writable fields: `field, value, comment`.

### dialbynamedirectories

Deleting a directory removes its entries and extension membership links. Routing references block deletion.

Writable fields: `name, description`.

### dialbynameentries

directory\_id and type\_id must be in the selected tenant; type is EXT or VOICEMAIL. number is the directory lookup number.

Writable fields: `dbn_id, type, type_id, number, directory_id`.

### digitalfaxes

Use global=yes with a global key for installation-wide records (scope -1).

Writable fields: `number, comment`.

### alarmbindings

Bindings apply to callerid in the selected tenant.

Writable fields: `callerid, emailnotification, relayserver`.

### mailtofaxes

protocol is /imap or /pop3. transport is /notls, /ssl, /tls, /ssl/novalidate-cert or /tls/novalidate-cert. Defaults without a configured new-item value: /imap, port 143, /notls, folder INBOX and SENDEREMAIL authentication. rp\_id is 0 or a response path in this tenant.

Writable fields: `name, email, protocol, host, port, transport, username, password, folder, cidnum, faxquality, authtype, authdata, disabled, language, cidname, pagesize, unauthenticated, automaticrotate, parsedestination, alertemail, rp_id`.

### mailtocalls

Mailbox connection fields follow Mail to Fax. authtype is SENDEREMAIL or SENDEREMAILSECRET; the latter requires authsecret (16–128 printable characters, no spaces). An empty secret preserves the existing one. The hash is never returned. Runtime failure counters are read-only. Delete its scheduled calls before deleting a mailbox.

Writable fields: `name, email, protocol, host, port, transport, username, password, folder, cidnum, authtype, authdata, disabled, cidname, unauthenticated, parsedestination, engine, language, voiceapiusername, voiceapipassword, voiceapihost, maxattempts, delaybetweenattempts, requestconfirm, maxdialings, authsecret`.

### scheduledcalls

Create with tobecalled and data\_base64 containing PCM WAV audio (mono, 8000 Hz, 16 bit). The API computes the audio hash, format and duration; text is descriptive and does not trigger text-to-speech generation. New calls default to READY, three attempts, three dials and a 60-second delay unless new-item defaults override these settings. notbefore uses YYYY-MM-DD HH:MM:SS. Only READY/FAILED calls without a held or pending dispatch can be edited or deleted. Worker counters and receipts cannot be set.

Writable fields: `callerid, calleridname, tobecalled, notbefore, maxattempts, requestconfirm, calldelay, text, mediafile, mediafileext, mediatimelen, maxdials, senderemail, callstatus, data_base64`.

### dashboards

Delete removes dashboard items and the corresponding dashboard setting. global=yes requires a global key and uses scope -1. The built-in Default dashboard cannot be deleted.

Writable fields: `name`.

### dashboarditems

dashboard\_id determines ownership; there is no writable tenant ID. code is an existing dashboard widget code, such as ONLINEEXTENSIONS. order controls display order. global=yes selects the global dashboard scope.

Writable fields: `td_id, code, order, dashboard_id`.

### linemonitors

start\_url, answer\_url and end\_url must be HTTP(S) URLs or empty. hosted is an existing server name or empty.

Writable fields: `name, start_url, answer_url, end_url, hosted`.

### xmltemplates

xmltemplate contains the template text. Read-only keys receive metadata without template content.

Writable fields: `name, description, xmltemplate`.

### causecodes

destinations is an ordered array of existing destination codes, such as EXT-100. Supply \[\] to clear the routing list; omit it to preserve routing. disposition: empty, CHANUNAVAIL, CONGESTION, BUSY, ANSWER, NOANSWER or CANCEL. global=yes selects scope 0 with a global key.

Writable fields: `disposition, code, comment, destinations`.

### cnamcacheentries

number is unique within the selected tenant. New manual entries default to manual=on and the current datetime.

Writable fields: `number, name, datetime, manual, note`.

### extensiondialings

from and to contain the extension dialing patterns; advanced follows the existing editor value (on or empty).

Writable fields: `from, to, advanced`.

### translationrooms

Also available on installations where Translation Rooms is hidden from the menu. Deleting a room removes its language rows.

Writable fields: `name, basenumber, minsilence, silencethreshold`.

### translationlanguages

room\_id must belong to the selected tenant. number is the room offset; language is the TTS language and speaking is the voice name.

Writable fields: `tr_id, number, language, speaking, welcome_text, room_id`.

### customdestinationinfos

customdestination\_id must belong to the selected tenant. param1, param2 and param3 hold the custom type’s extended data. Their meaning depends on the destination type.

Writable fields: `cu_id, param1, param2, param3, customdestination_id`.

### customdestinationfiles

customdestination\_id must belong to the selected tenant. data\_base64 stores arbitrary binary data, at most 16 MiB decoded. name is a stored label, not a server filesystem path. Full-key detail GET downloads data\_base64; lists return data\_bytes without content.

Writable fields: `cu_id, name, binaryfile, data_base64, customdestination_id`.

### provisioningvalues

type is PHONE, LINE or BUTTON. owner\_id is a phone ID for PHONE/LINE and a button layout ID for BUTTON. label\_id must have the same type. PHONE uses order=0; LINE uses a line in the phone model range. BUTTON uses a position within the layout range; order=0 is reserved for phonebook mappings on a phonebook-enabled layout. Value strings may contain the template placeholders used by the web editor. Read-only keys do not receive values.

Writable fields: `ph_id, type, order, al_id, value, owner_id, label_id`.

### phonebuttonlayouts

phone\_id and layout\_id must belong to the same selected tenant. order controls assignment order.

Writable fields: `ph_id, bl_id, order, phone_id, layout_id`.

### phonebookassignments

phone\_id and phonebook\_id must belong to the same selected tenant. order controls assignment order.

Writable fields: `ph_id, pb_id, order, phone_id, phonebook_id`.

### featuremappings

code must be a standard function from sf\_standardfunctions, for example PICKUP. feature\_id is a tenant/global feature ID, 0 for the system/global default, or -1 to disable. Deleting a mapping removes the override; the web page may recreate a default mapping. global=yes requires a global key and uses scope 0.

Writable fields: `code, fe_id, feature_id`.

## Examples

```
curl -X POST -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Reception","number":10}' \
  'https://pbx.example.com/pbx/openapi.php/pickupgroups?tenant=TENANT_CODE'

curl -X POST -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"phone_id":8,"phonebook_id":12,"order":1}' \
  'https://pbx.example.com/pbx/openapi.php/phonebookassignments?tenant=TENANT_CODE'

curl -X POST -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"owner_id":8,"type":"BUTTON","order":2,"label_id":5,"value":"100"}' \
  'https://pbx.example.com/pbx/openapi.php/provisioningvalues?tenant=TENANT_CODE'

curl -X PATCH -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Updated reception"}' \
  'https://pbx.example.com/pbx/openapi.php/pickupgroups/OBJECT_ID?tenant=TENANT_CODE'

curl -X DELETE -H "X-API-Key: TENANT_API_KEY" \
  'https://pbx.example.com/pbx/openapi.php/phonebookassignments/OBJECT_ID?tenant=TENANT_CODE'
```

The example parent, label and object IDs must be replaced with IDs from your installation. For BUTTON values the owner is the button layout, not the phone. To create a phonebook mapping, use a phonebook-enabled layout and order=0.

## Generated internal phone book

`GET /internalphonebook?tenant=TENANT_CODE` returns entries with `type`, `id`, `number` and `description`, generated from configuration objects, parking slots and reserved numbers. Use `limit`, `offset` and optional `search` for an exact number or conduit prefix. Editing or deleting an entry means editing or deleting its source object. There is no separate writable internal-directory table. To avoid unbounded expansion, a legacy parking range larger than 100000 spaces produces an explicit error.

## Extension technology conversion

`POST /extensions/{id}/technology` changes an extension between SIP, PJSIP, CUSTOM and VIRTUAL in one transaction. The extension ID, number, peer name, routing and queue memberships are preserved. SIP/PJSIP conversions retain the password and codec list unless replacements are supplied. Other technology fields are initialized from the target technology’s new-item defaults. Review target-specific settings after conversion; settings without an equivalent in the new technology are not migrated.

```
curl -X POST -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"technology":"PJSIP"}' \
  'https://pbx.example.com/pbx/openapi.php/extensions/8/technology?tenant=TENANT_CODE'
```

Optional fields: `secret` (or `password`), `allow` (codec string), `custom`, `virtual`, `providers` (CUSTOM provider IDs), and `items` (VIRTUAL member extension IDs). The custom object accepts `ce_dialoption, ce_auth_type, ce_auth_parameter, ce_usecid, ce_custom_param1`. The virtual object accepts supported columns among `ve_callerid, ve_mailbox, ve_timeout, ve_strategy`; unavailable installation columns are rejected. Send other extension edits in a separate request.

A technology-only PATCH to `/extensions/{id}` with `{"tech":"PJSIP"}` also converts. Query routing: POST `?object=extension&action=technology&id=8&tenant=TENANT_CODE`. Shared/custom PJSIP authentication or AOR links block conversion until normalized. An extension already used inside another virtual extension cannot become virtual. The response identifies the previous and new technology; a live PBX refresh failure returns a warning after the database change has committed. A database failure rolls the conversion back.

## Voicemail messages and greetings

<table id="bkmrk-resourcesupported-me"><thead><tr><th>Resource</th><th>Supported methods</th></tr></thead><tbody><tr><td>/voicemails/{id}/messages</td><td>GET list, POST create</td></tr><tr><td>/voicemails/{id}/messages/{messageId}</td><td>GET, PUT, PATCH, DELETE</td></tr><tr><td>/voicemails/{id}/greetings</td><td>GET list, POST create</td></tr><tr><td>/voicemails/{id}/greetings/{name}</td><td>GET, PUT, PATCH, DELETE</td></tr></tbody></table>

The voicemail ID is the mailbox configuration ID, and messageId is the recording’s database ID, not its position number. Greeting names: `busy`, `unavail`, `greet`, `temp`. Every operation checks both tenant and mailbox ownership. Use `limit` and `offset` for lists (100 by default, maximum 1000).

POST requires `data_base64`; greeting POST also requires `name`. Audio must be PCM WAV, mono, 8000 Hz, 16 bit, at most 16 MiB decoded, and the installation’s VOICEMAILFORMAT must be wav. Full-key detail GET returns data\_base64; list responses and read-only keys omit audio. An existing greeting is replaced with PUT/PATCH, not another POST.

Message fields: `folder` (INBOX by default; also Old, Work, Family, Friends, Cust1–Cust5), `callerid`, `flag` (empty, Urgent or PRIORITY), `category`, `origtime` (Unix timestamp), and `data_base64`. PATCH folder moves the message within that mailbox. Storage paths, mailbox identity, message positions and analysis fields are generated/read-only. Replacing audio clears stale transcripts and summaries.

```
curl -H "X-API-Key: TENANT_API_KEY" \
  'https://pbx.example.com/pbx/openapi.php/voicemails/8/messages?tenant=TENANT_CODE'

curl -X PATCH -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"folder":"Old"}' \
  'https://pbx.example.com/pbx/openapi.php/voicemails/8/messages/42?tenant=TENANT_CODE'

curl -X PUT -H "X-API-Key: TENANT_API_KEY" -H "Content-Type: application/json" \
  -d '{"data_base64":"BASE64_ENCODED_WAV"}' \
  'https://pbx.example.com/pbx/openapi.php/voicemails/8/greetings/busy?tenant=TENANT_CODE'
```

Query routing is supported using `object=voicemail&action=messages&id=8&item=42` or `action=greetings&id=8&item=busy`. Omit item for collection requests. DELETE requires one item and does not clear the entire mailbox.

# ProxyAPI (old)

# Old ProxyAPI Legacy proxy API reference and examples.

## Overview and Examples

`proxyapi.php` is the legacy MiRTA PBX HTTP API. It is still useful for integrations that already depend on query-string based requests, plain text responses, CDR exports, queue operations, voicemail actions, phonebook operations, fax handling, and the older `MANAGEDB` object/action interface.

The API is controlled with the `reqtype` parameter. Most calls also require `key`; tenant-scoped calls normally require `tenant`. Several read operations accept `format=json`, `format=xml`, or `format=csv`. Write operations that update PBX records commonly send JSON in a POST field named `jsondata`.

## Common Parameters

<table id="bkmrk-parameterdescription"><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`reqtype`</td><td>Main request family, such as INFO, DND, QUEUE, VOICEMAIL, FAX, CDR, or MANAGEDB.</td></tr><tr><td>`key`</td><td>Tenant or admin API key. Use read-only keys when the integration does not need to change data.</td></tr><tr><td>`tenant`</td><td>Tenant code. Optional only for operations that allow an administrator key to act globally.</td></tr><tr><td>`format`</td><td>Optional output format. Common values are plain, json, xml, and csv, depending on the request.</td></tr><tr><td>`callback`</td><td>Optional JSONP callback name for cross-domain script integrations using JSON.</td></tr><tr><td>`language`</td><td>Optional language used by requests that support translated data.</td></tr><tr><td>`cache`</td><td>Set to no to bypass SQL or AMI cache for supported requests.</td></tr></tbody></table>

## Request Types

<table id="bkmrk-reqtypepurposecountp"><thead><tr><th>reqtype</th><th>Purpose</th></tr></thead><tbody><tr><td>`COUNTPEERS`</td><td>Count peers by node and optionally by tenant.</td></tr><tr><td>`COUNTCHANNELS`</td><td>Count active channels globally, by node, or by tenant.</td></tr><tr><td>`CHANSIPPEERS`</td><td>Return registered chan\_sip peers across the cluster.</td></tr><tr><td>`BLFS`</td><td>Return BLF status for peers and flows.</td></tr><tr><td>`DND`</td><td>Get or set do-not-disturb for an extension.</td></tr><tr><td>`FLOWS`</td><td>Read flow state.</td></tr><tr><td>`CHANNEL`</td><td>Read details for one channel.</td></tr><tr><td>`CHANNELS`</td><td>List active channels.</td></tr><tr><td>`GETCURRENTCALLS`</td><td>Show current calls for a phone or tenant.</td></tr><tr><td>`PHONEBOOKS`</td><td>List available phonebooks.</td></tr><tr><td>`PHONEBOOK`</td><td>Query, add, delete, clean, or dump phonebook records.</td></tr><tr><td>`INFO`</td><td>Read status, CDRs, recordings, DIDs, queues, agents, variables, flows, and other reporting data.</td></tr><tr><td>`AGENT`</td><td>Pause, unpause, list, add, or remove queue agents.</td></tr><tr><td>`ATXTRANSFER`</td><td>Perform attended transfer for a channel.</td></tr><tr><td>`CAMPAIGN`</td><td>Start, stop, pause, resume, or maintain campaign numbers.</td></tr><tr><td>`DIAL`</td><td>Originate a call from a source and connect it to a destination.</td></tr><tr><td>`FAX`</td><td>Send, list, or download faxes.</td></tr><tr><td>`HANGUP`</td><td>Hang up a channel or extension.</td></tr><tr><td>`MEDIAFILE`</td><td>Download media-file audio.</td></tr><tr><td>`QUEUE`</td><td>List, add, remove, clean, or log queue members.</td></tr><tr><td>`QUEUERESET`</td><td>Reset queue statistics.</td></tr><tr><td>`REBOOT`</td><td>Reboot one or more peers.</td></tr><tr><td>`RESPONSEPATH`</td><td>Read response-path results.</td></tr><tr><td>`SETFLOW`</td><td>Set a flow state or variable value.</td></tr><tr><td>`SMS`</td><td>Send an SMS.</td></tr><tr><td>`TRANSFER`</td><td>Transfer a channel.</td></tr><tr><td>`UNREGISTER`</td><td>Unregister one or more peers.</td></tr><tr><td>`USERGROUP`</td><td>Manage tenants and users assigned to user groups.</td></tr><tr><td>`VIRTUALEXT`</td><td>Manage members of a virtual extension.</td></tr><tr><td>`VOICEMAIL`</td><td>List mailboxes, list messages, download messages, mark read/unread, or delete messages.</td></tr><tr><td>`SETTING`</td><td>Get or set tenant settings.</td></tr><tr><td>`COUNTCALLS`</td><td>Count running calls.</td></tr><tr><td>`LICENSEDAYS`</td><td>Return days before license expiration.</td></tr><tr><td>`BALANCE`</td><td>Add or subtract tenant balance.</td></tr><tr><td>`CDR`</td><td>Get or update fields on a CDR row.</td></tr><tr><td>`MANAGEDB`</td><td>Read or change supported PBX database objects through object/action parameters.</td></tr><tr><td>`CHECKAUTH`</td><td>Validate a username and password and return privilege information.</td></tr><tr><td>`AUTHTOKEN`</td><td>Generate or reset one-time or expiring authentication tokens.</td></tr><tr><td>`GETWEBRTCAUTH`</td><td>Authenticate an extension user and return WebRTC details.</td></tr></tbody></table>

## Using POST jsondata

For `MANAGEDB`, phonebook, destination, and similar write requests, send the object fields as JSON in the POST field `jsondata`. The examples below show the URL and the JSON payload separately instead of wrapping every case in a PHP cURL script.

```
curl -X POST \
  --data-urlencode 'jsondata={"field":"value"}' \
  "https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&tenant=TENANTCODE&reqtype=MANAGEDB&object=OBJECT&action=add"
```

## Examples

## INFO - SIMPLECDRS / Get the list of calls

Get the list of calls.

Use the date range and phone filters to narrow the returned call history. The phone filter searches the relevant caller, dialed, and answered number fields.

This uses the simplified call-history source and supports filters such as caller ID number and date range.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=SIMPLECDRS&tenant=TENANTCODE&calleridnum=103,104&start=2020-01-01&end=2020-12-31
```

## INFO - CDRS / Get the list of calls

Get the list of calls.

Use the date range and phone filters to narrow the returned call history. The phone filter searches the relevant caller, dialed, and answered number fields.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=CDRS&tenant=TENANTCODE&phone=103,104&start=2019-12-01&end=2022-12-31
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=CDRS&tenant=TENANTCODE&phone=103,104&start=2019-12-01&end=2022-12-31&format=xml&template=Test_CSV
```

Sample output or template:

```
{row_loop}{$uniqueid},{$ID},{$te_id},{$realsrc},{$lastdst},{$start},{$duration},{$answer},{$direction},{$direction},{$disposition}
{/row_loop}
```

## INFO - DIDS / Get the list of DIDs for one tenant

Get the list of DIDs for one tenant.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=DIDS&tenant=TENANTCODE
```

## INFO - DIDS / Get the list of DIDs for all tenants

Get the list of DIDs for all tenants.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=DIDS
```

## INFO - Flow / Get the state of a flow

Get the state of a flow.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=FLOW&id=61&tenant=TENANTCODE
```

## INFO - Extension / Get the state of a extension

Get the state of a extension.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=EXTSTATE&ext=500&tenant=TENANTCODE
```

## INFO - Extensions / Get the list of extensions

Get the list of extensions.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=EXTENSIONS&tenant=TENANTCODE
```

## INFO - Extensions / Get an extension by id

Get an extension by id.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=EXTENSIONS&tenant=TENANTCODE&id=36979
```

## INFO - Extensions / Get an extension by number

Get an extension by number.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=EXTENSIONS&tenant=TENANTCODE&number=100
```

## INFO - IVR Logs / Get the IVR logs

Get the IVR logs.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&tenant=TENANTCODE&reqtype=INFO&info=IVRLOGS&format=json&start=2023-01-01&end=2024-12-31
```

## INFO - Variable / Get the value of a variable

Get the value of a variable.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=variable&id=61&tenant=TENANTCODE
```

## DND / Get the DND for an extension

Get the DND for an extension.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&tenant=TENANTCODE&reqtype=DND&action=get&number=100
```

## DND /Set the DND for an extension

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&tenant=TENANTCODE&reqtype=DND&action=set&number=100&value=on
```

## DIAL / Call an extension and then dial a number

Call an extension and then dial a number.

The originate response includes an ID that can later be used to query call status or retrieve the recording. Extra variables can be passed with the var parameter.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=DIAL&source=402&dest=9922323232&tenant=TENANTCODE&account=402-TENANTCODE
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=recording&id=15a4cfe6429054
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=DIAL&source=402&dest=9922323232&tenant=TENANTCODE&account=402-TENANTCODE&var=callid=453131
```

## HANGUP / Hangup a call by extension

Hangup a call by extension.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=HANGUP&extension=103-TENANTCODE&tenant=TENANTCODE
```

## AGENT / Pause agent from queue

Pause agent from queue.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=AGENT&action=PAUSE&queue=281&extension=104-TENANTCODE&tenant=TENANTCODE&pausereason=Breakfast
```

## AGENT / Get info for agent in all the queues

Get info for agent in all the queues.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=AGENT&action=LISTQUEUES&extension=104-TENANTCODE&tenant=TENANTCODE&format=json
```

## MEDIAFILE / Retrieve a media file by its ID

Retrieve a media file by its ID.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MEDIAFILE&tenant=TENANTCODE&id=19&action=GETAUDIO&objectid=3619
```

## QUEUE / Get the list of agents

Get the list of agents.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=QUEUE&tenant=TENANTCODE&action=list&number=9200
```

## QUEUE / Add an agent to a queue

Add an agent to a queue.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=QUEUE&tenant=TENANTCODE&action=add&number=9200&extension=103
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=QUEUE&tenant=TENANTCODE&action=add&number=781&extension=107&paused=1&penalty=4
```

## SETTING

### Get a tenant setting

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?tenant=TENANTCODE&key=APIKEY&reqtype=SETTING&action=GET&code=VMAUTORECOVER
```

### Set a tenant setting

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?tenant=TENANTCODE&key=APIKEY&reqtype=SETTING&action=SET&code=VMAUTORECOVER&value=no
```

## VOICEMAIL

### Get all voicemails for a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=VOICEMAIL&tenant=TENANTCODE&action=list
```

### Get info about voicemails in a mailbox

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=VOICEMAIL&tenant=TENANTCODE&mailbox=102&action=messages
```

### Get the binary audio for a message

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=VOICEMAIL&tenant=TENANTCODE&mailbox=102&action=message&msgid=1475685709-00000004
```

### Mark a message as read

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=VOICEMAIL&tenant=TENANTCODE&mailbox=1000&action=markread&msgid=1543267778-00000007
```

### Mark a message as not read

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=VOICEMAIL&tenant=TENANTCODE&action=markunread&mailbox=1000&msgid=1543267778-00000007
```

## COUNTCALLS / Count the calls on a system

Count the calls on a system.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=COUNTCALLS
```

## RECORDINGS / Get or play a recording

Get or play a recording.

Use info=recording to download the file, or info=playrecording when the browser should play it inline.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=recording&id=srv02-1531779475.48&tenant=TENANTCODE
```

## TRANSCRIPT / Get the transcript for a recording

Get the transcript for a recording.

Use info=transcript with the recording unique ID to retrieve the generated transcript when transcription is enabled.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=transcript&id=srv02-1695552000.1043&tenant=TENANTCODE
```

## PHONEBOOKS

### Search for an entry

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=PHONEBOOK&subreqtype=query&tenant=TENANTCODE&phonebook=Default&field=name&value=Ben
```

### Add an entry

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=PHONEBOOK&subreqtype=add&phonebook=Default&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "NAME": "Ross",
  "PHONE1": "3564732920"
}
```

## FAX

### Send a fax

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=FAX&action=send&number=99397654321&source_number=123412345&tenant=TENANTCODE
```

Multipart upload example:

```
curl -F "filename=@/path/to/fax.pdf" "https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=FAX&action=send&tenant=TENANTCODE&source_number=15551230000&dest_number=15551239999"
```

### List faxes

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?tenant=TENANTCODE&key=APIKEY&reqtype=FAX&action=list
```

### Get a fax binary

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?tenant=TENANTCODE&key=APIKEY&reqtype=FAX&action=download&id=63095
```

## INFO

### Get the cdr for a tenant in CSV format

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=CDRS&format=csv&tenant=TENANTCODE&start=2017-01-01&end=2017-02-01
```

### Get the cdr for all tenants in CSV format

For one tenant, the tenant CSV template is used. With tenant=% across tenants, the admin CSV format is used.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=CDRS&format=csv&tenant=%&start=2017-01-01&end=2017-02-01
```

### Get the queue log for a tenant in CSV format

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=INFO&info=QUEUELOGS&format=csv&tenant=TENANTCODE&start=2017-10-01&end=2017-12-01
```

## Getting response paths results

Response Path results can be filtered by queue, answering extension, or unique ID and can be returned as plain text or XML.

### Getting the latest one for a given Response Path

Response Path results can be filtered by queue, answering extension, or unique ID and can be returned as plain text or XML.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=RESPONSEPATH&tenant=TENANTCODE&id=19&action=GETLAST
```

Sample output or template:

```
UniqueID|Type|Type ID|Value|Type Name|Value Name
srv02-1509806457.625|START|0|2017-11-04 15:41:01||
srv02-1509806457.625|CALLERID|0|Susan <1132555678>||
srv02-1509806457.625|VARIABLE|85|36985||
srv02-1509806457.625|VARIABLE|144|56896||
srv02-1509806457.625|QUEUE|281|||
srv02-1509806457.625|ANSWER|0|105-TENANTCODE||
srv02-1509806457.625|HANGUP|0|||
```

### Getting the latest one for a given Response Path for agent 104-TENANTCODE

Response Path results can be filtered by queue, answering extension, or unique ID and can be returned as plain text or XML.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=RESPONSEPATH&tenant=TENANTCODE&id=19&action=GETLAST&filter=ANSWER&filterdata=104-TENANTCODE
```

### Getting the latest one for a given Response Path for agent 104-TENANTCODE in xml format

Response Path results can be filtered by queue, answering extension, or unique ID and can be returned as plain text or XML.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=RESPONSEPATH&tenant=TENANTCODE&id=19&action=GETLAST&filter=ANSWER&filterdata=105-TENANTCODE&format=xml
```

Sample output or template:

```
<?xml version="1.0">
<Result>
<Agent>105-TENANTCODE</Agent>
<Status>NOT ACTIVE</Status>
<Queue>supportQ</Queue>
<ClientID>1234</MemberNumber>
<OrderNumber>11223344</MemberNumber>
<Caller>Manuel <7171345678></Caller>
<VoiceFile>3619</VoiceFile>
</Result>
```

## ManageDB / Custom Destination Types

Custom Destination Types.

### Getting the custom destination type list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=CUSTOMTYPES&tenant=TENANTCODE&action=list
```

## ManageDB / Custom Destinations

Custom Destinations.

### Getting the custom destination list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=CUSTOM&tenant=TENANTCODE&action=list
```

### Getting info for a custom destination

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=CUSTOM&tenant=TENANTCODE&action=get&objectid=67
```

### Creating a custom destination

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=custom&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "cu_name": "Boss phone",
  "cu_ct_id": 1,
  "cu_param1": "3564732920",
  "cu_param2": "INCOMINGDID",
  "cu_param3": "30"
}
```

### Updating a custom destination

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=custom&tenant=TENANTCODE&objectid=286
```

Payload sent as `jsondata`:

```
{
  "cu_name": "Boss private phone",
  "cu_id": 286,
  "cu_param1": "0636287454"
}
```

## CDR / Get the userfield

Get the userfield.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&tenant=TENANTCODE&reqtype=CDR&action=GET&field=userfield&uniqueid=srv02-1701011773.4670
```

## CDR / Update the userfield

Update the userfield.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&tenant=TENANTCODE&reqtype=CDR&action=UPDATE&field=userfield&uniqueid=srv02-1701011773.4670&value=
```

## ManageDB / Tenants

Tenants.

### Getting the tenant list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=TENANT&action=list
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=TENANT&action=list&filter=te_disabled='on'
```

### Getting info for a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=TENANT&action=get&objectid=1
```

### Creating a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=tenant
```

Payload sent as `jsondata`:

```
{
  "te_code": "RELAX",
  "te_name": "Relax & entertainment",
  "pk_start": 800,
  "pk_end": 810
}
```

### Updating a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=tenant&objectid=460
```

Payload sent as `jsondata`:

```
{
  "te_name": "Relax and entertainment",
  "pk_end": 820
}
```

## ManageDB / Phones

Phones.

### Getting the phones list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=PHONE&action=list&tenant=TENANTCODE
```

### Getting info for a phone

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=PHONE&action=get&objectid=182&tenant=TENANTCODE
```

### Creating a phone

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=phones&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "ph_name": "George Basement",
  "ph_mac": "AA:BB:CC:DD:EE:FF:00:11",
  "ph_pm_id": 5
}
```

### Updating a phone

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=phone&objectid=207&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "ph_name": "George Lower Basement"
}
```

## Manage DB / media files

media files.

ManageDB requests require an administrator API key. Most write operations send the record fields as a jsondata POST value.

### Getting the media file list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=MEDIAFILE&action=list&tenant=TENANTCODE
```

### Getting info for a media file

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=MEDIAFILE&action=get&objectid=1063&tenant=TENANTCODE
```

### Getting the binary part of a media file

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=MEDIAFILE&action=getbinary&objectid=1063&tenant=TENANTCODE
```

### Updating a media file

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=mediafile&objectid=10&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "me_name": "Beep"
}
```

### Updating the binary part of a media file

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=MEDIAFILE&action=updatebinary&objectid=247&tenant=TENANTCODE
```

## ManageDB / Hunt Lists

Hunt Lists.

### Getting the hunt lists list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=HUNTLIST&action=get&objectid=323&tenant=TENANTCODE
```

### Getting the hunt lists extension list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=HUNTLIST&action=getextensions&objectid=323&tenant=TENANTCODE
```

### Setting the hunt lists extension list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=setextensions&object=huntlist&objectid=26&tenant=TENANTCODE
```

## ManageDB / Extensions

Extensions.

### Getting the extension list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=list&object=extension&tenant=TENANTCODE
```

### Getting the details for an extension

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=get&object=extension&objectid=1701&tenant=TENANTCODE
```

### Deleting an extension

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=delete&object=extension&objectid=6016&tenant=TENANTCODE
```

### Updating the security for an extension

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=extension&objectid=1695&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "ex_callallowed": "all"
}
```

### Adding a SIP extension

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=extension&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "ex_number": "1100",
  "ex_name": "Test extension",
  "ex_tech": "SIP",
  "secret": "hackmeifyoucan",
  "ex_pickupgroup": "1,5,6",
  "ex_callgroup": "1,7,9"
}
```

### Adding a PJSIP extension

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=extension&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "ex_number": "1100",
  "ex_name": "Test PJSIP extension",
  "password": "hackmeifyoucan",
  "ex_tech": "PJSIP"
}
```

## ManageDB / Users

Users.

### Getting the user list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=user&action=list
```

### Getting the details for an user

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=user&action=get&objectid=3635
```

### Creating an user

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=user
```

Payload sent as `jsondata`:

```
{
  "us_username": "Leandro71",
  "us_password": "sha256(change-me)",
  "us_up_id": 1
}
```

## ManageDB / Conferences

Conferences.

### Creating a conference

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=conference&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
{
  "cr_number": "887",
  "cr_name": "Test conference",
  "pin": "5678"
}
```

## ManageDB / Providers

Providers.

### Getting the provider list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=provider&action=list
```

### Getting the details for a provider (SIP)

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=provider&action=get&objectid=1027
```

### Update a provider

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=provider&objectid=1027
```

Payload sent as `jsondata`:

```
{
  "pr_peername": "test_extradevel",
  "pr_name": "Test extradevel"
}
```

### Insert a provider

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=provider
```

Payload sent as `jsondata`:

```
{
  "pr_peername": "new_provider",
  "pr_name": "New Provider",
  "pr_tech": "SIP",
  "pr_userealtime": "on",
  "allow": "'alaw:20",
  "host": "172.16.1.100"
}
```

## ManageDB / Routing Profiles

Routing Profiles.

### Getting the routing profiles list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=routingprofile&action=list
```

### Getting the details for a routing profile

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=routingprofile&action=get&objectid=99
```

### Getting the list of routes for a routing profile

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=routingprofile&action=listroutes&objectid=99
```

### Adding a routing profile

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=routingprofile
```

Payload sent as `jsondata`:

```
{
  "rp_name": "Only National",
  "rp_type": "VOICE"
}
```

### Update a routing profile

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=routingprofile&objectid=275
```

## ManageDB / Routes

Routes.

### Getting the route list

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=route&action=list
```

### Getting the route list for a routing profile

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=route&routingprofileid=1&action=list
```

### Getting the details for a route

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=route&action=get&objectid=69
```

### Adding a route to a routing profile

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&object=route
```

Payload sent as `jsondata`:

```
{
  "dl_rp_id": "1",
  "dl_name": "Free Numbers",
  "dl_regex": "^800.*",
  "dl_pr_id": "89"
}
```

### Update a route

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=route&objectid=69
```

Payload sent as `jsondata`:

```
{
  "dl_emergencyroute": "",
  "dl_usepin": "on"
}
```

## ManageDB / DIDs

DIDs.

### Listing the DIDs for a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DID&action=LIST&tenant=TENANTCODE
```

### Getting more info for a DID

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DID&action=GET&objectid=27699&tenant=TENANTCODE
```

### Updating a DID

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=update&object=did&objectid=27699
```

Payload sent as `jsondata`:

```
{
  "di_comment": "Test DID",
  "di_recording": "yes"
}
```

## ManageDB / Destinations

Destinations.

### Getting the destinations for a DID

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=DID&typeidsrc=27699&tenant=TENANTCODE
```

### Getting the destinations for a Condition (true)

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=CONDITION&typeidsrc=20&tenant=TENANTCODE
```

### Getting the destinations for a Condition (false)

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=NOTCONDITION&typeidsrc=20&tenant=TENANTCODE
```

### Replace the destinations for a DID

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=CONDITION&typeidsrc=20&tenant=TENANTCODE
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=NOTCONDITION&typeidsrc=20&tenant=TENANTCODE
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=IVR_1&typeidsrc=3634&tenant=TENANTCODE
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=DID&typeidsrc=27699&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
[
  "PLAYBACK-60",
  "EXT-29379"
]
```

### Destination Tags

Destination replacement uses values in `TYPE-ID` form. The following tags are supported by the legacy destination examples and the current destination lookup code.

<table id="bkmrk-tagdestinationextdia"><thead><tr><th>Tag</th><th>Destination</th></tr></thead><tbody><tr><td>`EXT`</td><td>Dial an extension</td></tr><tr><td>`SMS`</td><td>Send a SMS to an extension</td></tr><tr><td>`PLAYBACK`</td><td>Play a media file</td></tr><tr><td>`RERECORD`</td><td>Rerecord a media file</td></tr><tr><td>`CLEARRECORDING`</td><td>Clear the media from a media file</td></tr><tr><td>`RERECORDSILENT`</td><td>Rerecord a media file without playing an intro</td></tr><tr><td>`CONDITION`</td><td>Follow to a condition</td></tr><tr><td>`VOICEMAIL`</td><td>Call a voicemail</td></tr><tr><td>`IVR`</td><td>Call an IVR</td></tr><tr><td>`DISA`</td><td>Call a DISA</td></tr><tr><td>`PAGING`</td><td>Call a Paging group</td></tr><tr><td>`HUNTLIST`</td><td>Call a Huntlist</td></tr><tr><td>`FLOW`</td><td>Call a Flow</td></tr><tr><td>`PARK`</td><td>Park the call</td></tr><tr><td>`SPECIAL`</td><td>Execute a special destination (check the sp\_specials table for the id)</td></tr><tr><td>`MEETME`</td><td>Join a conference</td></tr><tr><td>`QUEUE`</td><td>Dial a Queue</td></tr><tr><td>`RESETQUEUESTATS`</td><td>Reset the stats for a Queue</td></tr><tr><td>`STARTCAMPAIGN`</td><td>Start a campaign</td></tr><tr><td>`REDIALNOTANSWEREDCAMPAIGN`</td><td>Redial the calls not answered for a campaign</td></tr><tr><td>`STOPCAMPAIGN`</td><td>Stop a campaign</td></tr><tr><td>`PAUSECAMPAIGN`</td><td>Pause a campaign</td></tr><tr><td>`UNPAUSECAMPAIGN`</td><td>Unpause a campaign</td></tr><tr><td>`REMOVEFROMCAMPAIGN`</td><td>Remove called number from campaign</td></tr><tr><td>`REMOVECALLERFROMCAMPAIGN`</td><td>Remove caller number from campaign</td></tr><tr><td>`ADDLATESTDIALEDOUTTOCAMPAIGN`</td><td>Add latest dialed out number to campaign</td></tr><tr><td>`ADDLATESTDIALEDINTOCAMPAIGN`</td><td>Add latest dialed in number to campaign</td></tr><tr><td>`ADDTODNCLIST`</td><td>Add called number to Do Not Call list</td></tr><tr><td>`LOGINQUEUE`</td><td>Login caller to Queue</td></tr><tr><td>`TOGGLELOGINQUEUE`</td><td>Toggle Login/Logout caller to Queue</td></tr><tr><td>`LOGINADQUEUE`</td><td>Login caller to Queue</td></tr><tr><td>`TOGGLELOGINADQUEUE`</td><td>Toggle Login/Logout caller to Queue</td></tr><tr><td>`TOGGLEPAUSEQUEUE`</td><td>Toggle Pause/Unpause caller to Queue</td></tr><tr><td>`LOGOUTALLAGENTSFROMQUEUE`</td><td>Logout all agents from Queue</td></tr><tr><td>`LOGOUTQUEUE`</td><td>Logout caller from Queue</td></tr><tr><td>`PAUSEQUEUE`</td><td>Pause caller from Queue</td></tr><tr><td>`UNPAUSEQUEUE`</td><td>Unpause caller from Queue</td></tr><tr><td>`PAUSEALLAGENTSINQUEUE`</td><td>Pause all agents in Queue</td></tr><tr><td>`UNPAUSEALLAGENTSINQUEUE`</td><td>Unpause all agents in Queue</td></tr><tr><td>`CUSTOM`</td><td>Use a custom destination</td></tr><tr><td>`PHONEBOOK`</td><td>Route by Phone Book using regex</td></tr><tr><td>`EXACTPHONEBOOK`</td><td>Route by Phone Book not using regex</td></tr><tr><td>`SETUNCONDITIONALDID`</td><td>Set unconditional forwarding for a DID</td></tr><tr><td>`ENABLEUNCONDITIONALDID`</td><td>Enable the unconditional forwarding for a DID</td></tr><tr><td>`DISABLEUNCONDITIONALDID`</td><td>Disable the unconditional forwarding for a DID</td></tr><tr><td>`TOGGLEUNCONDITIONALDID`</td><td>Toggle the unconditional forwarding for a DID</td></tr><tr><td>`CLIDNAMEBYPHONEBOOK`</td><td>Set Caller ID Name by Phone Book</td></tr><tr><td>`CALLERIDMOD`</td><td>Alter Caller ID based on rule</td></tr><tr><td>`MUSICONHOLD`</td><td>Set Music On Hold to</td></tr><tr><td>`RINGMUSICONHOLD`</td><td>Ring extension using Music On Hold</td></tr><tr><td>`RESPONSEPATH`</td><td>Start Response Path</td></tr><tr><td>`SAMENUMBERVM`</td><td>Voicemail same number</td></tr></tbody></table>

## ManageDB / IVRs

IVRs.

### Listing the IVRs for a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=IVR&action=LIST&tenant=TENANTCODE
```

### Getting more info for a IVR

The IVR media-file references are stored as destinations; use the destination examples to change them.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=IVR&action=GET&tenant=TENANTCODE&objectid=322
```

### Getting the destinations for the IVR, including the media files

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=IVR&action=GETDESTINATIONS&tenant=TENANTCODE&objectid=3634
```

## ManageDB / Conditions

Conditions.

### Listing the Conditions for a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=CONDITION&action=LIST&tenant=TENANTCODE
```

### Listing the destinations for a Condition

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=CONDITION&action=GETDESTINATIONS&tenant=TENANTCODE&objectid=20&format=json
```

### Getting info and more info for a Condition

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=CONDITION&action=GET&tenant=TENANTCODE&objectid=20&format=json
```

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=CONDITION&action=GETEXTENDEDINFOS&tenant=TENANTCODE&objectid=20&format=json
```

### Replacing extended info for a Condition

Weektime and calendar conditions use extended-info rows; replace the extended-info list when changing their schedules.

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=CONDITION&action=replaceextendedinfos&objectid=20&tenant=TENANTCODE
```

Payload sent as `jsondata`:

```
[
  {
    "param1": "1",
    "param2": "8:00",
    "param3": "13:00"
  },
  {
    "param1": "1",
    "param2": "15:00",
    "param3": "19:00"
  },
  {
    "param1": "2",
    "param2": "8:00",
    "param3": "13:00"
  },
  {
    "param1": "2",
    "param2": "15:00",
    "param3": "19:00"
  }
]
```

## ManageDB / Voicemails

Voicemails.

### Listing the Voicemails for a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=VOICEMAIL&action=LIST&tenant=TENANTCODE
```

### Listing the Voicemails message for a voicemail

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=VOICEMAIL&action=LISTMESSAGES&tenant=TENANTCODE&mailboxuser=001&mailbox=INBOX
```

### Get a message recording for a voicemail id

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=VOICEMAIL&action=GETMESSAGERECORDING&id=4963&tenant=TENANTCODE
```

### Add a voicemail box

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&tenant=TENANTCODE&object=voicemail
```

Payload sent as `jsondata`:

```
{
  "mailbox": "9000",
  "password": "1234567",
  "fullname": "This is a test",
  "email": "test@mirtapbx.com"
}
```

### Delete a voicemail box

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=VOICEMAIL&action=DELETE&objectid=32259&tenant=TENANTCODE
```

## ManageDB / Phone phonebooks

Phone phonebooks.

### Listing the Phone phonebooks for a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&tenant=TENANTCODE&reqtype=MANAGEDB&object=PHONEPHONEBOOK&action=LIST
```

### Get the detail of a phone phone book

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&tenant=TENANTCODE&reqtype=MANAGEDB&object=PHONEPHONEBOOK&action=GET&objectid=1332
```

## ManageDB / Queues

Queues.

### Listing the Queues for a tenant

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=QUEUE&action=LIST&tenant=TENANTCODE
```

### Add a Queue

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&action=add&tenant=TENANTCODE&object=queue
```

Payload sent as `jsondata`:

```
{
  "qu_name": "Support Line",
  "strategy": "RINGALL",
  "timeout": "30"
}
```

### Delete a queue

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=MANAGEDB&object=QUEUE&action=DELETE&objectid=7027&tenant=TENANTCODE
```

## Token Authentication

Use `reqtype=AUTHTOKEN` to generate a one-time or expiring login token for a user. The returned token can be used as the password in the normal web login URL.

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=AUTHTOKEN&action=generate&validity=ONCE&user=adrian
```

```
https://pbx.example.com/mirtapbx/login.php?username=adrian&password=AUTH_TOKEN
```

Request example:

```
https://pbx.example.com/mirtapbx/proxyapi.php?key=APIKEY&reqtype=AUTHTOKEN&action=generate&validity=ONCE&user=adrian
```

## Security Notes

- Use tenant read-only keys for reporting integrations whenever possible.
- Use administrator keys only for global reporting or `MANAGEDB` actions that require them.
- Do not store production keys in browser-side scripts.
- Prefer the OpenAPI endpoint for new integrations unless an existing integration requires the legacy ProxyAPI format.