Create KB Source
curl --request POST \
--url https://api.attention.tech/v2/knowledge-base/sources \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Q4 Product Launch Playbook",
"content": "# Product Launch Playbook\n\n## Overview\nThis document covers the key steps for launching our Q4 product line.\n\n## Timeline\n- Week 1: Internal enablement\n- Week 2: Beta launch\n- Week 3: GA release",
"format": "text/markdown"
}
'import requests
url = "https://api.attention.tech/v2/knowledge-base/sources"
payload = {
"title": "Q4 Product Launch Playbook",
"content": "# Product Launch Playbook
## Overview
This document covers the key steps for launching our Q4 product line.
## Timeline
- Week 1: Internal enablement
- Week 2: Beta launch
- Week 3: GA release",
"format": "text/markdown"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Q4 Product Launch Playbook',
content: '# Product Launch Playbook\n\n## Overview\nThis document covers the key steps for launching our Q4 product line.\n\n## Timeline\n- Week 1: Internal enablement\n- Week 2: Beta launch\n- Week 3: GA release',
format: 'text/markdown'
})
};
fetch('https://api.attention.tech/v2/knowledge-base/sources', 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.attention.tech/v2/knowledge-base/sources",
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([
'title' => 'Q4 Product Launch Playbook',
'content' => '# Product Launch Playbook
## Overview
This document covers the key steps for launching our Q4 product line.
## Timeline
- Week 1: Internal enablement
- Week 2: Beta launch
- Week 3: GA release',
'format' => 'text/markdown'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.attention.tech/v2/knowledge-base/sources"
payload := strings.NewReader("{\n \"title\": \"Q4 Product Launch Playbook\",\n \"content\": \"# Product Launch Playbook\\n\\n## Overview\\nThis document covers the key steps for launching our Q4 product line.\\n\\n## Timeline\\n- Week 1: Internal enablement\\n- Week 2: Beta launch\\n- Week 3: GA release\",\n \"format\": \"text/markdown\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.attention.tech/v2/knowledge-base/sources")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Q4 Product Launch Playbook\",\n \"content\": \"# Product Launch Playbook\\n\\n## Overview\\nThis document covers the key steps for launching our Q4 product line.\\n\\n## Timeline\\n- Week 1: Internal enablement\\n- Week 2: Beta launch\\n- Week 3: GA release\",\n \"format\": \"text/markdown\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attention.tech/v2/knowledge-base/sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Q4 Product Launch Playbook\",\n \"content\": \"# Product Launch Playbook\\n\\n## Overview\\nThis document covers the key steps for launching our Q4 product line.\\n\\n## Timeline\\n- Week 1: Internal enablement\\n- Week 2: Beta launch\\n- Week 3: GA release\",\n \"format\": \"text/markdown\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "kb_sources",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attributes": {
"title": "Q4 Product Launch Playbook",
"source_type": "manual",
"content": "# Product Launch Playbook\n\n## Overview\nThis document covers the key steps...",
"format": "text/markdown",
"status": "indexed",
"file_size": 4096,
"chunk_count": 12,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}Knowledge Base
Create KB Source
Creates a new knowledge base source with inline content. Automatically triggers indexing for vector search. For file uploads, use the upload endpoint instead.
POST
/
knowledge-base
/
sources
Create KB Source
curl --request POST \
--url https://api.attention.tech/v2/knowledge-base/sources \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Q4 Product Launch Playbook",
"content": "# Product Launch Playbook\n\n## Overview\nThis document covers the key steps for launching our Q4 product line.\n\n## Timeline\n- Week 1: Internal enablement\n- Week 2: Beta launch\n- Week 3: GA release",
"format": "text/markdown"
}
'import requests
url = "https://api.attention.tech/v2/knowledge-base/sources"
payload = {
"title": "Q4 Product Launch Playbook",
"content": "# Product Launch Playbook
## Overview
This document covers the key steps for launching our Q4 product line.
## Timeline
- Week 1: Internal enablement
- Week 2: Beta launch
- Week 3: GA release",
"format": "text/markdown"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Q4 Product Launch Playbook',
content: '# Product Launch Playbook\n\n## Overview\nThis document covers the key steps for launching our Q4 product line.\n\n## Timeline\n- Week 1: Internal enablement\n- Week 2: Beta launch\n- Week 3: GA release',
format: 'text/markdown'
})
};
fetch('https://api.attention.tech/v2/knowledge-base/sources', 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.attention.tech/v2/knowledge-base/sources",
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([
'title' => 'Q4 Product Launch Playbook',
'content' => '# Product Launch Playbook
## Overview
This document covers the key steps for launching our Q4 product line.
## Timeline
- Week 1: Internal enablement
- Week 2: Beta launch
- Week 3: GA release',
'format' => 'text/markdown'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.attention.tech/v2/knowledge-base/sources"
payload := strings.NewReader("{\n \"title\": \"Q4 Product Launch Playbook\",\n \"content\": \"# Product Launch Playbook\\n\\n## Overview\\nThis document covers the key steps for launching our Q4 product line.\\n\\n## Timeline\\n- Week 1: Internal enablement\\n- Week 2: Beta launch\\n- Week 3: GA release\",\n \"format\": \"text/markdown\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.attention.tech/v2/knowledge-base/sources")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Q4 Product Launch Playbook\",\n \"content\": \"# Product Launch Playbook\\n\\n## Overview\\nThis document covers the key steps for launching our Q4 product line.\\n\\n## Timeline\\n- Week 1: Internal enablement\\n- Week 2: Beta launch\\n- Week 3: GA release\",\n \"format\": \"text/markdown\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attention.tech/v2/knowledge-base/sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Q4 Product Launch Playbook\",\n \"content\": \"# Product Launch Playbook\\n\\n## Overview\\nThis document covers the key steps for launching our Q4 product line.\\n\\n## Timeline\\n- Week 1: Internal enablement\\n- Week 2: Beta launch\\n- Week 3: GA release\",\n \"format\": \"text/markdown\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "kb_sources",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attributes": {
"title": "Q4 Product Launch Playbook",
"source_type": "manual",
"content": "# Product Launch Playbook\n\n## Overview\nThis document covers the key steps...",
"format": "text/markdown",
"status": "indexed",
"file_size": 4096,
"chunk_count": 12,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}Authorizations
Body
application/jsonapplication/vnd.api+json
Title of the KB source
Maximum string length:
500Content of the source (required for manual entries)
Maximum string length:
524288Content format (defaults to text/markdown). For PDF files, use the upload endpoint instead.
Available options:
text/markdown, text/html, text/plain Response
KB source created successfully
Show child attributes
Show child attributes
Example:
{
"type": "kb_sources",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attributes": {
"title": "Q4 Product Launch Playbook",
"source_type": "manual",
"format": "text/markdown",
"status": "indexed",
"file_size": 4096,
"chunk_count": 12,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
}
Was this page helpful?
⌘I