Conversations
Fetch Conversation Usage
Fetch conversation usage statistics
get
/v1/conversation/{conversationId}/usage/fetch
Description
Retrieve usage statistics for a specific conversation, including total tokens (BASE type only) and total messages. Optionally filter by date range.
Authorization
ChatBotKit API Secret * Required
HTTP Authorization Scheme: bearer
Path Parameters
conversationIdstring* Required
The ID of the conversation
fromstring
Start date for the period (ISO 8601 format)
tostring
End date for the period (ISO 8601 format)
import { ChatBotKit } from '@chatbotkit/sdk'
const cbk = new ChatBotKit({
secret: process.env.CHATBOTKIT_API_KEY!
})
const response = await cbk.conversation.usage.fetch(
conversationId)
{"tokens":"integer","messages":"integer"}Conversation usage statistics retrieved successfully