Get session analysis
Retrieves a full session analysis tree for a given event, including costs, child events, and product linkages.
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);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
session_analysis = client.session_analysis.retrieve(
event_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
record_type="record_type",
)
print(session_analysis.session_id)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
sessionAnalysis, err := client.SessionAnalysis.Get(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.SessionAnalysisGetParams{
RecordType: "record_type",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", sessionAnalysis.SessionID)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.sessionanalysis.SessionAnalysisRetrieveParams;
import com.telnyx.sdk.models.sessionanalysis.SessionAnalysisRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
SessionAnalysisRetrieveParams params = SessionAnalysisRetrieveParams.builder()
.recordType("record_type")
.eventId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build();
SessionAnalysisRetrieveResponse sessionAnalysis = client.sessionAnalysis().retrieve(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
session_analysis = telnyx.session_analysis.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", record_type: "record_type")
puts(session_analysis)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$sessionAnalysis = $client->sessionAnalysis->retrieve(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
recordType: 'record_type',
dateTime: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
expand: 'record',
includeChildren: true,
maxDepth: 1,
);
var_dump($sessionAnalysis);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx session-analysis retrieve \
--api-key 'My API Key' \
--record-type record_type \
--event-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26ecurl --request GET \
--url https://api.telnyx.com/v2/session_analysis/{record_type}/{event_id} \
--header 'Authorization: Bearer <token>'{
"session_id": "call-123",
"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"
]
}
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The record type identifier.
The event identifier (UUID).
Query Parameters
Whether to include child events in the response.
Maximum traversal depth for the event tree.
Required range:
1 <= x <= 5Controls what data to expand on each event node.
Available options:
record, none ISO 8601 timestamp or date to narrow index selection for faster lookups. Accepts full datetime (e.g., 2026-03-17T10:00:00Z) or date-only format (e.g., 2026-03-17).
Was this page helpful?
⌘I
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);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
session_analysis = client.session_analysis.retrieve(
event_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
record_type="record_type",
)
print(session_analysis.session_id)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
sessionAnalysis, err := client.SessionAnalysis.Get(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.SessionAnalysisGetParams{
RecordType: "record_type",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", sessionAnalysis.SessionID)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.sessionanalysis.SessionAnalysisRetrieveParams;
import com.telnyx.sdk.models.sessionanalysis.SessionAnalysisRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
SessionAnalysisRetrieveParams params = SessionAnalysisRetrieveParams.builder()
.recordType("record_type")
.eventId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build();
SessionAnalysisRetrieveResponse sessionAnalysis = client.sessionAnalysis().retrieve(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
session_analysis = telnyx.session_analysis.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", record_type: "record_type")
puts(session_analysis)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$sessionAnalysis = $client->sessionAnalysis->retrieve(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
recordType: 'record_type',
dateTime: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
expand: 'record',
includeChildren: true,
maxDepth: 1,
);
var_dump($sessionAnalysis);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx session-analysis retrieve \
--api-key 'My API Key' \
--record-type record_type \
--event-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26ecurl --request GET \
--url https://api.telnyx.com/v2/session_analysis/{record_type}/{event_id} \
--header 'Authorization: Bearer <token>'{
"session_id": "call-123",
"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"
]
}
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
]
}