Create Topic
curl --request POST \
--url https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"topicName": "<string>",
"description": "<string>",
"brandId": 123
}
'import requests
url = "https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics"
payload = {
"topicName": "<string>",
"description": "<string>",
"brandId": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({topicName: '<string>', description: '<string>', brandId: 123})
};
fetch('https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics', 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://api.slatehq.ai/ai-analytics-service/api/public/v1/topics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'topicName' => '<string>',
'description' => '<string>',
'brandId' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics"
payload := strings.NewReader("{\n \"topicName\": \"<string>\",\n \"description\": \"<string>\",\n \"brandId\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"topicName\": \"<string>\",\n \"description\": \"<string>\",\n \"brandId\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"topicName\": \"<string>\",\n \"description\": \"<string>\",\n \"brandId\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"workspaceId": 123,
"brandId": 123,
"topicName": "<string>",
"description": "<string>"
}Topics
Create Topic
Create a new topic to organize prompts for AI search tracking.
POST
/
ai-analytics-service
/
api
/
public
/
v1
/
topics
Create Topic
curl --request POST \
--url https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"topicName": "<string>",
"description": "<string>",
"brandId": 123
}
'import requests
url = "https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics"
payload = {
"topicName": "<string>",
"description": "<string>",
"brandId": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({topicName: '<string>', description: '<string>', brandId: 123})
};
fetch('https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics', 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://api.slatehq.ai/ai-analytics-service/api/public/v1/topics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'topicName' => '<string>',
'description' => '<string>',
'brandId' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics"
payload := strings.NewReader("{\n \"topicName\": \"<string>\",\n \"description\": \"<string>\",\n \"brandId\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"topicName\": \"<string>\",\n \"description\": \"<string>\",\n \"brandId\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"topicName\": \"<string>\",\n \"description\": \"<string>\",\n \"brandId\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"workspaceId": 123,
"brandId": 123,
"topicName": "<string>",
"description": "<string>"
}Creates a new topic in your workspace. Topics group related prompts together for organized tracking and analytics.
Parameters
string
required
Bearer token. Format:
Bearer slat_<your-token>.string
required
Name of the topic. Maximum 255 characters. Must be unique among the workspace’s active topics (case-insensitive).
string
Description of the topic.
number
required
Brand ID to associate with the topic.
Response
Returns201 Created with the new topic.
number
required
Unique identifier for the topic.
number
required
Workspace the topic belongs to.
number
required
Brand the topic belongs to.
string
required
Topic name.
string
Topic description.
null if not set.Example
curl -s -X POST "https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics" \
-H "Authorization: Bearer slat_YOUR_TOKEN" \
-H "Content-Type: application/json" \
--data-raw '{
"brandId": 5,
"topicName": "Project Management Tools",
"description": "Track AI mentions of project management software"
}'
import requests
response = requests.post(
"https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics",
headers={
"Authorization": "Bearer slat_YOUR_TOKEN",
"Content-Type": "application/json",
},
json={
"brandId": 5,
"topicName": "Project Management Tools",
"description": "Track AI mentions of project management software",
},
)
topic = response.json()
print(topic["id"], topic["topicName"])
const response = await fetch(
"https://api.slatehq.ai/ai-analytics-service/api/public/v1/topics",
{
method: "POST",
headers: {
"Authorization": "Bearer slat_YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
brandId: 5,
topicName: "Project Management Tools",
description: "Track AI mentions of project management software",
}),
}
);
const topic = await response.json();
console.log(topic.id, topic.topicName);
Response
{
"id": 42,
"workspaceId": 1,
"brandId": 5,
"topicName": "Project Management Tools",
"description": "Track AI mentions of project management software"
}
Status codes
| Status | Description |
|---|---|
201 | Topic created. |
400 | Invalid request. brandId or topicName is missing, topicName exceeds 255 characters, or the body isn’t valid JSON or contains unknown fields. |
401 | Missing or invalid Bearer token. See Authentication. |
403 | A workspaceId in the body or query doesn’t match the token’s workspace. |
409 | An active topic with the same name already exists (topic name already exists). |
500 | Internal server error. |
What’s next
- List Topics — View all topics in your workspace.
- Create Prompt — Add prompts to a topic.
Was this page helpful?