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
| Property | Value |
|---|---|
| Object | cdr |
| Primary path | /cdrs |
| Path aliases | /cdr, /cdrs, /call, /calls |
| Supported method | GET |
| Default format | json |
| Compatibility formats | template, xml |
Endpoint Patterns
| Action | Example pattern |
|---|---|
| List records | GET https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI |
| Filter by date range | 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 |
| Filter by ID from the path | GET https://pbx.example.com/pbx/openapi.php/cdrs/RECORD_ID?tenant=CANISTRACCI |
| Template/XML compatibility output | GET https://pbx.example.com/pbx/openapi.php/cdrs?tenant=CANISTRACCI&format=template&template=Docs%20Export |
Query Parameters
| Parameter | Description |
|---|---|
tenant | Tenant code or tenant name. Global API keys can use % wildcards; tenant API keys are restricted to their tenant. |
start | Start date and time. Defaults to today at 00:00:00. |
end | End date and time. Defaults to today at 23:59:59. |
id | Comma-separated CDR ID values. A path value such as /cdrs/123 also maps to this filter. |
uniqueid | Comma-separated Asterisk unique ID values. |
linkedid | Comma-separated linked ID values used to group call legs. |
src | Comma-separated source values. |
firstdst | Comma-separated first destination values. |
disposition | Comma-separated disposition values such as ANSWERED, NO ANSWER, BUSY, or FAILED. |
direction | Direction filter based on the CDR userfield mapping. Accepted values are IN, OUT, IN,OUT, and OUT,IN. |
phone | Comma-separated phone values searched across src, dst, firstdst, lastdst, realsrc, and wherelanded. |
format | Response format. Defaults to json. Use template or xml for template-based compatibility output. |
template | Template name from the tenant XML templates. Used only with format=template or format=xml. |
contenttype | Optional Content-Type header for rendered template output. |
Response Fields
| Field | Description |
|---|---|
accountcode | Tenant code stored on the CDR. |
ID | Internal CDR row ID. |
start | Call start timestamp. |
answer | Answer timestamp when the call was answered. |
end | Call end timestamp. |
clid | Full caller ID string. |
realsrc | Normalized or real source value. |
firstdst | First dialed destination tracked by MiRTA PBX. |
duration | Total call duration in seconds. |
billsec | Answered talk time in seconds. |
disposition | Asterisk call disposition. |
cc_cost | Calculated tenant-side call cost when available. |
dcontext | Asterisk destination context. |
dstchannel | Destination channel. |
userfield | MiRTA PBX call marker, commonly including inbound or outbound direction information. |
uniqueid | Asterisk unique ID for the CDR leg. |
prevuniqueid | Previous unique ID for linked call-leg processing. |
lastdst | Last destination reached by the call. |
wherelanded | Final PBX object or destination where the call landed. |
src | Asterisk source value. |
dst | Asterisk destination value. |
lastapp | Last Asterisk application executed. |
srcCallID | Source SIP Call-ID when available. |
linkedid | Asterisk linked ID used to group related CDR legs. |
peeraccount | Asterisk peer account value. |
originateid | Origination tracking ID when available. |
cc_country | Rated country when rating data is available. |
cc_network | Rated network when rating data is available. |
pincode | PIN code associated with the call when present. |
cc_buy | Calculated buy-side cost when available. |
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
| Error | Meaning |
|---|---|
missing_api_key | No API key was supplied in the query string, X-API-Key, or bearer token. |
invalid_api_key | The supplied key does not match the tenant or global API key. |
tenant_required | A tenant code or tenant name is required when using a tenant API key. |
single_tenant_required | Template output requires the request to resolve to exactly one tenant. |
template_not_found | The selected XML/template output template does not exist for the tenant. |
method_not_allowed | The endpoint is read-only and only supports GET. |