Skip to main content
GET
/
agents
/
{agentId}
/
sources
/
summary
Get sources summary
curl --request GET \
  --url https://www.chatbase.co/api/v2/agents/{agentId}/sources/summary \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://www.chatbase.co/api/v2/agents/{agentId}/sources/summary"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://www.chatbase.co/api/v2/agents/{agentId}/sources/summary', 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://www.chatbase.co/api/v2/agents/{agentId}/sources/summary",
  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://www.chatbase.co/api/v2/agents/{agentId}/sources/summary"

	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://www.chatbase.co/api/v2/agents/{agentId}/sources/summary")
  .header("Authorization", "Bearer <token>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://www.chatbase.co/api/v2/agents/{agentId}/sources/summary")

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
{
  "links": {
    "count": 123,
    "size": 123
  },
  "files": {
    "count": 123,
    "size": 123
  },
  "qnas": {
    "count": 123,
    "size": 123
  },
  "notionPages": {
    "count": 123,
    "size": 123
  },
  "texts": {
    "count": 123,
    "size": 123
  },
  "zendeskTickets": {
    "count": 123,
    "size": 123
  },
  "salesforceCases": {
    "count": 123,
    "size": 123
  },
  "shouldRetrain": true
}
{
  "error": {
    "code": "AUTH_MISSING_API_KEY",
    "message": "Authentication required"
  }
}
{
  "error": {
    "code": "SUBSCRIPTION_API_RESTRICTED_PLAN",
    "message": "A Standard plan or higher is required to access the API"
  }
}
{
  "error": {
    "code": "RATE_LIMIT_TOO_MANY_REQUESTS",
    "message": "Too many requests, please try again later"
  }
}
{
  "error": {
    "code": "INTERNAL_SERVER_ERROR",
    "message": "Something went wrong, please try again"
  }
}

Authorizations

Authorization
string
header
required

API key from your account settings

Path Parameters

agentId
string
required

The agent ID

Minimum string length: 1
Example:

"5QHA6VB-DIAbBhxwqxfdi"

Response

Sources summary by type

Aggregated stats for link sources

files
object
required

Aggregated stats for file sources

qnas
object
required

Aggregated stats for Q&A sources

notionPages
object
required

Aggregated stats for Notion sources

texts
object
required

Aggregated stats for text sources

zendeskTickets
object
required

Aggregated stats for Zendesk ticket sources. count = total number of ticket IDs tracked

salesforceCases
object
required

Aggregated stats for Salesforce case sources. count = total number of case IDs tracked

shouldRetrain
boolean
required

True when the agent knowledge base requires a retrain to reflect any changes