Get Analytics
curl --request GET \
--url https://api.toughtongueai.com/api/public/v2/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.toughtongueai.com/api/public/v2/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.toughtongueai.com/api/public/v2/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.toughtongueai.com/api/public/v2/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.toughtongueai.com/api/public/v2/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.toughtongueai.com/api/public/v2/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.toughtongueai.com/api/public/v2/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"scenario_stats": [
{
"scenario_id": "scenario_abc123",
"scenario_name": "Sales Training",
"session_count": 45,
"avg_score": 78.5,
"total_duration_minutes": 120
}
],
"org_dashboard": {
"time_series": [
{
"date": "2024-01-15",
"session_count": 5,
"unique_users": 3
}
],
"usage_summary": {
"total_sessions": 45,
"total_users": 12,
"avg_session_duration": 180
},
"wallet_balance": 150.00
},
"member_usage": [
{
"email": "member@company.com",
"session_count": 10,
"avg_score": 82.0
}
]
}
Analytics
Get Analytics
Get unified analytics data
GET
/
v2
/
analytics
Get Analytics
curl --request GET \
--url https://api.toughtongueai.com/api/public/v2/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.toughtongueai.com/api/public/v2/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.toughtongueai.com/api/public/v2/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.toughtongueai.com/api/public/v2/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.toughtongueai.com/api/public/v2/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.toughtongueai.com/api/public/v2/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.toughtongueai.com/api/public/v2/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"scenario_stats": [
{
"scenario_id": "scenario_abc123",
"scenario_name": "Sales Training",
"session_count": 45,
"avg_score": 78.5,
"total_duration_minutes": 120
}
],
"org_dashboard": {
"time_series": [
{
"date": "2024-01-15",
"session_count": 5,
"unique_users": 3
}
],
"usage_summary": {
"total_sessions": 45,
"total_users": 12,
"avg_session_duration": 180
},
"wallet_balance": 150.00
},
"member_usage": [
{
"email": "member@company.com",
"session_count": 10,
"avg_score": 82.0
}
]
}
Get comprehensive analytics data in a single API call.
Supports both personal and organization-wide views.
Personal view returns:
boolean
default:"false"
Toggle between personal and org-wide view. Org view requires EDIT or OWNER role.
string
Filter analytics from this date (default: 90 days ago)
string
Filter analytics until this date (default: today)
- Scenario statistics (usage, scores)
- Organization dashboard (time series, usage summary)
- Wallet balance
- Member usage breakdown
{
"scenario_stats": [
{
"scenario_id": "scenario_abc123",
"scenario_name": "Sales Training",
"session_count": 45,
"avg_score": 78.5,
"total_duration_minutes": 120
}
],
"org_dashboard": {
"time_series": [
{
"date": "2024-01-15",
"session_count": 5,
"unique_users": 3
}
],
"usage_summary": {
"total_sessions": 45,
"total_users": 12,
"avg_session_duration": 180
},
"wallet_balance": 150.00
},
"member_usage": [
{
"email": "member@company.com",
"session_count": 10,
"avg_score": 82.0
}
]
}
⌘I