# 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>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, and AI Analysis 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>**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>**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</td><td>No required create field listed</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`</td><td>Tenant API key or global key with global=1</td><td>`me_name`</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`.

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

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

```
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>

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

# 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_name": "DOCS_VARIABLE",
      "ce_value": "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>

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

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

# 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>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 one object by its internal ID.

```
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"
```

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

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

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

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

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

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