Skip to main content
ElevenLabs Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Get agent conversation topics

GET https://api.elevenlabs.io/v1/convai/agents//topics

Returns the latest topic discovery run results for a given agent.

Reference: https://elevenlabs.io/docs/api-reference/conversations/topics/get

  • https://api.elevenlabs.io (Production, default)
  • https://api.us.elevenlabs.io (Production US)
  • https://api.eu.residency.elevenlabs.io (Production EU)
  • https://api.in.residency.elevenlabs.io (Production India)
  • https://api.sg.residency.elevenlabs.io (Production Singapore)
  • agent_id (string, required) — ID of the agent
  • page_size (integer, optional, nullable) — Number of top-level topic groups to return.
  • sort_by (enum, optional) — Column to rank topics by. Use conversations for volume, sentiment with sort_direction=asc for the most negative topics, and frustration with sort_direction=desc for the most frustrated ones. Topics with no score are always ranked last.
    • Allowed values: conversations, sentiment, success_rate, frustration
  • sort_direction (enum, optional) — Direction to sort topics.
    • Allowed values: asc, desc
  • from_unix_secs (integer, optional, nullable) — Start of the window to view topics for. When set with to_unix_secs, the completed daily topic-discovery runs in the range are aggregated together, so the window scopes the metrics as well as the topic set. Floored to the start of its UTC day because runs cover whole UTC days; aggregated_run_count reports how many runs were summed. Omit both bounds to get the single latest run.
  • to_unix_secs (integer, optional, nullable) — End of the window to view topics for.
  • include_evaluation_criteria (boolean, optional, default: true) — Include the per-criteria evaluation breakdown on each topic's metrics. Pass false to drop it: it dominates the payload and the weighted success_rate is returned either way.
  • cursor (string, optional, nullable) — Used for fetching next page. Cursor is returned in the response.

Successful Response

  • topics (list of AgentTopicResponseModel, required)
  • window_start_unix_secs (integer, required)
  • window_end_unix_secs (integer, required)
  • aggregated_run_count (integer, optional, default: 0) — Number of daily topic-discovery runs the returned metrics were summed over.
  • has_more (boolean, optional, default: false)
  • next_cursor (string, optional, nullable)

Validation Error

  • detail (list of ValidationError, optional)
  • topic_id (string, required)
  • label (string, required)
  • description (string, required)
  • conversation_count (integer, required)
  • parent_topic_id (string, optional, nullable)
  • x_2d (double, optional, nullable)
  • y_2d (double, optional, nullable)
  • metrics (TopicMetricsAggregate, optional, nullable)
  • success_rate (double, optional, nullable) — Success rate across the topic's evaluation criteria, weighted by scored conversations. Returned regardless of include_evaluation_criteria.
  • loc (list of ValidationErrorLocItems, required)
  • msg (string, required)
  • type (string, required)
  • conversation_count (integer, optional, default: 0)
  • sentiment (TopicSentimentAggregate, optional, nullable)
  • evaluation_criteria (list of TopicEvaluationCriteriaAggregate, optional)
  • sentiment (NumericDistributionAggregate, optional)
  • frustration (NumericDistributionAggregate, optional)
  • positive_count (integer, optional, default: 0)
  • neutral_count (integer, optional, default: 0)
  • negative_count (integer, optional, default: 0)
  • criteria_id (string, required)
  • success_count (integer, optional, default: 0)
  • failure_count (integer, optional, default: 0)
  • unknown_count (integer, optional, default: 0)
  • count (integer, optional, default: 0)
  • sum (double, optional, default: 0)
  • min (double, optional, nullable)
  • max (double, optional, nullable)

Response

JSON
{
  "topics": [
    {
      "topic_id": "string",
      "label": "string",
      "description": "string",
      "conversation_count": 1,
      "parent_topic_id": "string",
      "x_2d": 1.1,
      "y_2d": 1.1,
      "metrics": {
        "conversation_count": 0,
        "sentiment": {
          "sentiment": {
            "count": 0,
            "sum": 0,
            "min": 1.1,
            "max": 1.1
          },
          "frustration": {
            "count": 0,
            "sum": 0,
            "min": 1.1,
            "max": 1.1
          },
          "positive_count": 0,
          "neutral_count": 0,
          "negative_count": 0
        },
        "evaluation_criteria": [
          {
            "criteria_id": "string",
            "success_count": 0,
            "failure_count": 0,
            "unknown_count": 0
          }
        ]
      },
      "success_rate": 1.1
    }
  ],
  "window_start_unix_secs": 1,
  "window_end_unix_secs": 1,
  "aggregated_run_count": 0,
  "has_more": false,
  "next_cursor": "string"
}

SDK Code

TypeScript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

async function main() {
    const client = new ElevenLabsClient();
    await client.conversationalAi.conversations.topics.get("agent_id", {});
}
main();
Python
from elevenlabs import ElevenLabs

client = ElevenLabs()

client.conversational_ai.conversations.topics.get(
    agent_id="agent_id",
)
Go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/convai/agents/agent_id/topics"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
Ruby
require 'uri'
require 'net/http'

url = URI("https://api.elevenlabs.io/v1/convai/agents/agent_id/topics")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
Java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.elevenlabs.io/v1/convai/agents/agent_id/topics")
  .asString();
PHP
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/agents/agent_id/topics');

echo $response->getBody();
C#
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/agents/agent_id/topics");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/agents/agent_id/topics")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu