Skip to main content

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

PropertyValue
Objectaianalysis
Primary path/aianalysis
Path aliases/aianalysis, /aianalyses, /ai_analysis, /ai_analyses, /callanalysis, /call_analysis
Supported methodGET
Required filteruniqueid
Default formatjson
Source tablesrm_recordingmetadatas, tr_transcripts

Endpoint Patterns

ActionExample pattern
Get AI analysis by unique IDGET https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CANISTRACCI&uniqueid=1717240000.42
Get AI analysis by path unique IDGET https://pbx.example.com/pbx/openapi.php/aianalysis/1717240000.42?tenant=CANISTRACCI
Get multiple callsGET https://pbx.example.com/pbx/openapi.php/aianalysis?tenant=CANISTRACCI&uniqueid=1717240000.42,1717240000.43
Use an alias pathGET https://pbx.example.com/pbx/openapi.php/ai_analysis?tenant=CANISTRACCI&uniqueid=1717240000.42

Query Parameters

ParameterDescription
tenantTenant 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.
uniqueidRequired comma-separated Asterisk unique ID values. A path value such as /aianalysis/1717240000.42 also maps to this filter.
keyOptional API key query parameter. Prefer the X-API-Key header or bearer token for new integrations.

Response Fields

FieldDescription
tenant_idInternal tenant ID.
tenant_codeTenant code.
uniqueidAsterisk unique ID requested by the integration.
transcriptFull transcript text. When recording metadata does not contain a full transcript, MiRTA PBX builds this value from transcript segments.
summaryAI-generated call summary.
sentiment_scoreFirst numeric sentimental analysis score found for the unique ID, or null.
sentiment_scoresAll distinct numeric sentimental analysis scores found for the unique ID.
sentiment_briefShort sentimental analysis text from recording metadata.
sentiment_detailsDetailed sentimental analysis payload. This may be JSON text depending on the configured AI processor.
recordingsPer-recording metadata rows for the unique ID.
transcript_segmentsTimestamped transcript segments for the unique ID.

Recording Fields

FieldDescription
metadata_idInternal recording metadata row ID.
recording_idInternal recording ID.
dateRecording metadata date.
transcriptTranscript stored on that recording metadata row.
summarySummary stored on that recording metadata row.
sentiment_scoreNumeric sentimental score for that recording metadata row, or null.
sentiment_briefShort sentimental analysis text for that recording metadata row.
sentiment_detailsDetailed sentimental analysis payload for that recording metadata row.

Transcript Segment Fields

FieldDescription
recording_idInternal recording ID associated with the transcript segment.
speakerSpeaker number assigned by the transcript processor.
startSegment start time. Numeric values are returned as numbers.
endSegment end time. Numeric values are returned as numbers.
textTranscript 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

ErrorMeaning
missing_api_keyNo API key was supplied in the query string, X-API-Key, or bearer token.
invalid_api_keyThe supplied key does not match the tenant or global API key.
tenant_requiredA tenant code or tenant name is required when using a tenant API key.
tenant_not_foundThe tenant parameter did not match any visible tenant.
uniqueid_requiredThe request did not include a usable uniqueid value.
method_not_allowedThe endpoint is read-only and only supports GET.