Skip to main content
GET
/
session_analysis
/
{record_type}
/
{event_id}
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const sessionAnalysis = await client.sessionAnalysis.retrieve(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  { record_type: 'record_type' },
);

console.log(sessionAnalysis.session_id);
{
  "session_id": "call-123",
  "status": "completed",
  "created_at": "2025-01-12T10:00:00Z",
  "completed_at": "2025-01-12T10:05:00Z",
  "cost": {
    "total": "0.056800",
    "currency": "USD"
  },
  "root": {
    "id": "call-123",
    "product": "callcontrol-cdrs",
    "event_name": "callcontrol-cdrs",
    "relationship": null,
    "cost": {
      "event_cost": "0.001800",
      "cumulative_cost": "0.056800",
      "currency": "USD"
    },
    "links": {
      "self": "/v2/session_analysis/callcontrol-cdrs/call-123",
      "records": "/v2/detail_records?record_type=callcontrol-cdrs&id=call-123"
    },
    "record": {},
    "children": []
  },
  "meta": {
    "event_count": 3,
    "products": [
      "ai-voice-assistant",
      "callcontrol-cdrs",
      "inference"
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

record_type
string
required

The record type identifier.

event_id
string<uuid>
required

The event identifier (UUID).

Query Parameters

include_children
boolean
default:true

Whether to include child events in the response.

max_depth
integer
default:2

Maximum traversal depth for the event tree.

Required range: 1 <= x <= 5
expand
enum<string>
default:record

Controls what data to expand on each event node.

Available options:
record,
none
date_time
string<date-time>

ISO 8601 timestamp to narrow index selection for faster lookups.

Response

Session analysis result

session_id
string
required

Identifier for the analyzed session.

status
string
required

Analysis status (e.g. "completed").

created_at
string<date-time>
required

When the session started.

cost
object
required
root
object
required
meta
object
required
completed_at
string<date-time> | null

When the session completed.