Add sources to a knowledge base
curl --request POST \
--url https://api.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources \
--header 'Content-Type: multipart/form-data' \
--header 'X-Api-Key: <api-key>' \
--form 'file_sources=<string>' \
--form 'text_sources=<string>' \
--form file_sources.0.items='@example-file'import requests
url = "https://api.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources"
files = { "file_sources.0.items": ("example-file", open("example-file", "rb")) }
payload = {
"file_sources": "<string>",
"text_sources": "<string>"
}
headers = {"X-Api-Key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file_sources', '<string>');
form.append('text_sources', '<string>');
form.append('file_sources.0.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {'X-Api-Key': '<api-key>'}};
options.body = form;
fetch('https://api.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/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.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-Api-Key: <api-key>"
],
]);
$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.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
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.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources")
.header("X-Api-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"organization_id": "123e4567-e89b-12d3-a456-426614174001",
"sources": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"file_name": "<string>",
"file_url": "<string>",
"type": "file"
}
]
},
"message": "Sources added to knowledge base successfully",
"error": {
"details": [
{
"field": "email",
"message": "Invalid email format"
}
],
"message": "An error occurred while processing your request",
"status": 400,
"type": "generic_error"
},
"status": 200
}knowledge bases
Add sources to a knowledge base
Add PDF files or text content as sources to an existing knowledge base.
POST
/
v1
/
knowledge-bases
/
{knowledge_base_id}
/
sources
Add sources to a knowledge base
curl --request POST \
--url https://api.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources \
--header 'Content-Type: multipart/form-data' \
--header 'X-Api-Key: <api-key>' \
--form 'file_sources=<string>' \
--form 'text_sources=<string>' \
--form file_sources.0.items='@example-file'import requests
url = "https://api.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources"
files = { "file_sources.0.items": ("example-file", open("example-file", "rb")) }
payload = {
"file_sources": "<string>",
"text_sources": "<string>"
}
headers = {"X-Api-Key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file_sources', '<string>');
form.append('text_sources', '<string>');
form.append('file_sources.0.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {'X-Api-Key': '<api-key>'}};
options.body = form;
fetch('https://api.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/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.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-Api-Key: <api-key>"
],
]);
$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.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
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.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources")
.header("X-Api-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.callrounded.com/v1/knowledge-bases/{knowledge_base_id}/sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text_sources\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_sources.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"organization_id": "123e4567-e89b-12d3-a456-426614174001",
"sources": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"file_name": "<string>",
"file_url": "<string>",
"type": "file"
}
]
},
"message": "Sources added to knowledge base successfully",
"error": {
"details": [
{
"field": "email",
"message": "Invalid email format"
}
],
"message": "An error occurred while processing your request",
"status": 400,
"type": "generic_error"
},
"status": 200
}Authorizations
The API Key created in Rounded Studio.
- You can create it by going to the "API Keys" settings of your profile.
- Need help? You can email us at team@callrounded.com or join our Discord community.
Path Parameters
Body
multipart/form-data
List of PDF files to upload as sources. Only PDF files are supported.
JSON string containing an array of text sources, each with 'title' and 'content' fields.
Response
Successfully added sources to knowledge base
The updated knowledge base data.
Show child attributes
Show child attributes
Response message indicating the result of the operation.
Show child attributes
Show child attributes
Example:
{
"details": [
{
"field": "email",
"message": "Invalid email format"
}
],
"message": "An error occurred while processing your request",
"status": 400,
"type": "generic_error"
}HTTP status code of the response.
⌘I