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
| Property | Value |
|---|
| Object | aianalysis |
| Primary path | /aianalysis |
| Path aliases | /aianalysis, /aianalyses, /ai_analysis, /ai_analyses, /callanalysis, /call_analysis |
| Supported method | GET |
| Required filter | uniqueid |
| Default format | json |
| Source tables | rm_recordingmetadatas, tr_transcripts |
Endpoint Patterns
| Action | Example pattern |
|---|
| Get AI analysis by unique ID | GET https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CANISTRACCI&uniqueid=1717240000.42 |
| Get AI analysis by path unique ID | GET https://pbx.example.com/pbx/openapi.php/aianalysis/1717240000.42?tenant=CANISTRACCI |
| Get multiple calls | GET https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CANISTRACCI&uniqueid=1717240000.42,1717240000.43 |
| Use an alias path | GET https://pbx.example.com/pbx/openapi.php/ai_analysis?tenant=CANISTRACCI&uniqueid=1717240000.42 |
Query Parameters
| Parameter | Description |
|---|
tenant | 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. |
uniqueid | Required comma-separated Asterisk unique ID values. A path value such as /aianalysis/1717240000.42 also maps to this filter. |
key | Optional API key query parameter. Prefer the X-API-Key header or bearer token for new integrations. |
Response Fields
| Field | Description |
|---|
tenant_id | Internal tenant ID. |
tenant_code | Tenant code. |
uniqueid | Asterisk unique ID requested by the integration. |
transcript | Full transcript text. When recording metadata does not contain a full transcript, MiRTA PBX builds this value from transcript segments. |
summary | AI-generated call summary. |
sentiment_score | First numeric sentimental analysis score found for the unique ID, or null. |
sentiment_scores | All distinct numeric sentimental analysis scores found for the unique ID. |
sentiment_brief | Short sentimental analysis text from recording metadata. |
sentiment_details | Detailed sentimental analysis payload. This may be JSON text depending on the configured AI processor. |
recordings | Per-recording metadata rows for the unique ID. |
transcript_segments | Timestamped transcript segments for the unique ID. |
Recording Fields
Transcript Segment Fields
| Field | Description |
|---|
recording_id | Internal recording ID associated with the transcript segment. |
speaker | Speaker number assigned by the transcript processor. |
start | Segment start time. Numeric values are returned as numbers. |
end | Segment end time. Numeric values are returned as numbers. |
text | Transcript text for the segment. |
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
| 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. |
tenant_not_found | The tenant parameter did not match any visible tenant. |
uniqueid_required | The request did not include a usable uniqueid value. |
method_not_allowed | The endpoint is read-only and only supports GET. |
No comments to display
No comments to display