Analytics API

Retrieve project analytics, conversation metrics, and detailed transcript logs.

Endpoints

GET
/api/v1/analytics

Get project analytics summary

GET
/api/v1/transcripts

List all conversation transcripts

GET
/api/v1/transcripts/:id

Get 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

FieldTypeDescription
conversationsnumberTotal conversation count
messagesnumberTotal message count
resolutionsnumberResolved conversations
escalationsnumberEscalated conversations
dailyCountsarrayPer-day breakdown of conversations and messages