Skip to main content

Analytics API

The Analytics API allows you to retrieve aggregated data and insights about threads and question-answer pairs in your project. By using the analytics endpoints, you can gain a better understanding of user interactions, preferences, and the performance of kapa.ai.

A thread represents a conversation between a user and kapa.ai, containing multiple question-answer pairs. Each question-answer pair is a single interaction where the user asks a question, and kapa.ai provides an answer.

Threads

The Threads endpoint provides aggregated data about all threads in your project, including the total number of questions, upvotes, and downvotes for each thread.

API Route

GET /query/v1/analytics/threads

Example Usage

CURL

curl -X GET \
'<KAPA_API_ENDPOINT>/query/v1/analytics/threads' \
-H 'X-API-TOKEN: <KAPA_API_TOKEN>'

Request Parameters

ParameterTypeDescription
pageint(Optional) The page number to retrieve, default is 1
page_sizeint(Optional) The number of threads to retrieve per page, default is 25
start_datestring(Optional) The start date for the date range filter, format: "YYYY-MM-DD"
end_datestring(Optional) The end date for the date range filter, format: "YYYY-MM-DD"
reaction_filterstring(Optional) Filter threads by reaction type ("upvote" or "downvote")
search_textstring(Optional) Filter threads by text search in questions and answers
confidence_filterstring(Optional) Filter threads by confidence level ("uncertain" or "certain")

Question/Answers

The Question/Answers endpoint provides detailed information about all question-answer pairs within a specific thread, including the total number of upvotes and downvotes for each pair.

API Route

GET /query/v1/analytics/thread/<THREAD_ID>/question-answers

Example Usage

CURL

curl -X GET \
'<KAPA_API_ENDPOINT>/query/v1/analytics/thread/<THREAD_ID>/question-answers' \
-H 'X-API-TOKEN: <KAPA_API_TOKEN>'

Request Parameters

ParameterTypeDescription
THREAD_IDstringThe unique ID of the thread for which you want to retrieve question-answer pairs

These example requests demonstrate how to use the Analytics API to retrieve aggregated data and insights about threads and question-answer pairs in your project. By analyzing this data, you can gain a better understanding of user interactions, preferences, and the performance of kapa.ai.