Analytics API
Retrieve project analytics, conversation metrics, and detailed transcript logs.
Endpoints
GET
/api/v1/analyticsGet project analytics summary
GET
/api/v1/transcriptsList all conversation transcripts
GET
/api/v1/transcripts/:idGet a single transcript with messages
Project Analytics
Returns aggregate metrics including total conversations, messages, resolution rate, and daily counts.
Request
GET /api/v1/analytics Authorization: Bearer cdt_abc123...
Response
{
"conversations": 1250,
"messages": 8430,
"resolutions": 1100,
"escalations": 85,
"dailyCounts": [
{ "date": "2025-01-15", "conversations": 45, "messages": 312 },
{ "date": "2025-01-16", "conversations": 52, "messages": 367 }
]
}List Transcripts
Returns all conversation transcripts for the project, ordered by most recent.
Request
GET /api/v1/transcripts Authorization: Bearer cdt_abc123...
Response
[
{
"id": "txn_abc123",
"userId": "user_456",
"platform": "webchat",
"resolved": true,
"escalated": false,
"messageCount": 12,
"startedAt": "2025-01-15T14:30:00Z",
"endedAt": "2025-01-15T14:45:00Z"
}
]Get Transcript
Returns a single transcript with the full message history.
Request
GET /api/v1/transcripts/txn_abc123 Authorization: Bearer cdt_abc123...
Response
{
"id": "txn_abc123",
"userId": "user_456",
"platform": "webchat",
"resolved": true,
"escalated": false,
"startedAt": "2025-01-15T14:30:00Z",
"endedAt": "2025-01-15T14:45:00Z",
"messages": [
{
"id": "msg_001",
"role": "user",
"content": "I need help with my order",
"createdAt": "2025-01-15T14:30:00Z"
},
{
"id": "msg_002",
"role": "assistant",
"content": "I'd be happy to help! Could you share your order number?",
"createdAt": "2025-01-15T14:30:02Z"
}
]
}Response Fields
| Field | Type | Description |
|---|---|---|
| conversations | number | Total conversation count |
| messages | number | Total message count |
| resolutions | number | Resolved conversations |
| escalations | number | Escalated conversations |
| dailyCounts | array | Per-day breakdown of conversations and messages |