Create knowledge base
curl --request POST \
--url https://akapulu.com/api/knowledge-bases/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Product Docs",
"description": "Main KB"
}
'import requests
url = "https://akapulu.com/api/knowledge-bases/create"
payload = {
"name": "Product Docs",
"description": "Main KB"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Product Docs', description: 'Main KB'})
};
fetch('https://akapulu.com/api/knowledge-bases/create', 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://akapulu.com/api/knowledge-bases/create",
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([
'name' => 'Product Docs',
'description' => 'Main KB'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://akapulu.com/api/knowledge-bases/create"
payload := strings.NewReader("{\n \"name\": \"Product Docs\",\n \"description\": \"Main KB\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://akapulu.com/api/knowledge-bases/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Product Docs\",\n \"description\": \"Main KB\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://akapulu.com/api/knowledge-bases/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Product Docs\",\n \"description\": \"Main KB\"\n}"
response = http.request(request)
puts response.read_body{
"status": "created",
"id": "33333333-4444-5555-6666-777777777777"
}{
"error": "name is required"
}{
"error": "Invalid API key"
}Knowledge bases
Create Knowledge Base
Create a knowledge base (document container for RAG).
POST
/
knowledge-bases
/
create
Create knowledge base
curl --request POST \
--url https://akapulu.com/api/knowledge-bases/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Product Docs",
"description": "Main KB"
}
'import requests
url = "https://akapulu.com/api/knowledge-bases/create"
payload = {
"name": "Product Docs",
"description": "Main KB"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Product Docs', description: 'Main KB'})
};
fetch('https://akapulu.com/api/knowledge-bases/create', 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://akapulu.com/api/knowledge-bases/create",
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([
'name' => 'Product Docs',
'description' => 'Main KB'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://akapulu.com/api/knowledge-bases/create"
payload := strings.NewReader("{\n \"name\": \"Product Docs\",\n \"description\": \"Main KB\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://akapulu.com/api/knowledge-bases/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Product Docs\",\n \"description\": \"Main KB\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://akapulu.com/api/knowledge-bases/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Product Docs\",\n \"description\": \"Main KB\"\n}"
response = http.request(request)
puts response.read_body{
"status": "created",
"id": "33333333-4444-5555-6666-777777777777"
}{
"error": "name is required"
}{
"error": "Invalid API key"
}Create a knowledge base (a container for documents used by RAG tools).
Required:
name (unique per user). Optional: description (400 characters or fewer).
Then upload documents and attach the knowledge base to a scenario with a type: "rag" function. See Knowledge bases.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
⌘I

