Files
Add text or FAQs
Add a text, or a list of questions and answers, to a knowledge base without uploading a file.
POST
/
knowledge-base
/
{id}
/
texts
Add text or FAQs
curl --request POST \
--url https://api.verbeo.ai/v1/knowledge-base/{id}/texts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"text": "<string>",
"faqs": [
{}
]
}
'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/{id}/texts"
payload = {
"title": "<string>",
"text": "<string>",
"faqs": [{}]
}
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({title: '<string>', text: '<string>', faqs: [{}]})
};
fetch('https://api.verbeo.ai/v1/knowledge-base/{id}/texts', 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.verbeo.ai/v1/knowledge-base/{id}/texts",
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' => '<string>',
'text' => '<string>',
'faqs' => [
[
]
]
]),
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://api.verbeo.ai/v1/knowledge-base/{id}/texts"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"text\": \"<string>\",\n \"faqs\": [\n {}\n ]\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://api.verbeo.ai/v1/knowledge-base/{id}/texts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"text\": \"<string>\",\n \"faqs\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/{id}/texts")
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 \"title\": \"<string>\",\n \"text\": \"<string>\",\n \"faqs\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyAdds a text, or a list of questions and answers, to a knowledge base. Verbeo saves it as a Markdown file named after its title (
The request may be up to 25 MB, and the file it makes is checked against your plan like an upload.
<title>.md), the same file the dashboard’s Add text saves, so it is a file of the knowledge base in every way: it counts toward your plan’s files, and you can read, edit, download or delete it like any other.
An FAQ list is saved as a two-column table, | Question | Answer |. From four questions on, each question becomes a passage of its own with its answer, so a caller’s question finds exactly that answer.
Path parameters
Body
Sendtext or faqs, not both.
At least one question with its answer:
[{ "question": "…", "answer": "…" }]. Each needs both, and each is kept on one line.Request
curl -X POST "https://api.verbeo.ai/v1/knowledge-base/5df09066-0842-4c92-8ef0-6cf2ff6d7455/texts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "title": "Holiday hours", "text": "We are closed on 25 and 26 December, and open 10 to 2 on 31 December." }'
curl -X POST "https://api.verbeo.ai/v1/knowledge-base/5df09066-0842-4c92-8ef0-6cf2ff6d7455/texts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Parking FAQ",
"faqs": [
{ "question": "Is parking free?", "answer": "Yes, for patients, in the basement." },
{ "question": "Is there a lift?", "answer": "Yes, from the basement to every floor." }
]
}'
Response
201 Created with the file object, processing.
{
"success": true,
"data": {
"id": "7d0e1f2a-3b4c-4d5e-8f6a-7b8c9d0e1f2a",
"store_id": "5df09066-0842-4c92-8ef0-6cf2ff6d7455",
"display_name": "Parking FAQ.md",
"file_type": "text/markdown",
"file_size": 132,
"status": "processing",
"…": "every field of the file object"
}
}
Errors
| Code | Status | When |
|---|---|---|
VALIDATION_FAILED | 422 | title: required; title: must be at most 252 characters; text: send the text, or faqs for an FAQ list; text: send the text or faqs, not both; faqs: must hold at least one question and its answer; faqs.0.answer: required. |
KB_DUPLICATE_FILE | 409 | The same text is already a file of this knowledge base. |
KB_* | 409 | Another of your plan’s limits. The message starts with the file’s name, <title>.md. |
PAYLOAD_TOO_LARGE | 413 | A request over 25 MB. |
NOT_FOUND | 404 | No such knowledge base: Knowledge base not found. |
Was this page helpful?
⌘I
Add text or FAQs
curl --request POST \
--url https://api.verbeo.ai/v1/knowledge-base/{id}/texts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"text": "<string>",
"faqs": [
{}
]
}
'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/{id}/texts"
payload = {
"title": "<string>",
"text": "<string>",
"faqs": [{}]
}
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({title: '<string>', text: '<string>', faqs: [{}]})
};
fetch('https://api.verbeo.ai/v1/knowledge-base/{id}/texts', 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.verbeo.ai/v1/knowledge-base/{id}/texts",
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' => '<string>',
'text' => '<string>',
'faqs' => [
[
]
]
]),
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://api.verbeo.ai/v1/knowledge-base/{id}/texts"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"text\": \"<string>\",\n \"faqs\": [\n {}\n ]\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://api.verbeo.ai/v1/knowledge-base/{id}/texts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"text\": \"<string>\",\n \"faqs\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/{id}/texts")
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 \"title\": \"<string>\",\n \"text\": \"<string>\",\n \"faqs\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body