Files
Edit a text or FAQ list
Save new words for a text or an FAQ list in the place of a ready file, as Replace does.
PUT
/
knowledge-base
/
files
/
{fileId}
/
text
Edit a text or FAQ list
curl --request PUT \
--url https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/text \
--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/files/{fileId}/text"
payload = {
"title": "<string>",
"text": "<string>",
"faqs": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({title: '<string>', text: '<string>', faqs: [{}]})
};
fetch('https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/text', 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/files/{fileId}/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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/files/{fileId}/text"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"text\": \"<string>\",\n \"faqs\": [\n {}\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/text")
.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/files/{fileId}/text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.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_bodySaves a text, or a list of questions and answers, as the new version of a ready file: the dashboard’s Edit. It works like Replace: assistants keep the old version until the new one is ready, then switch at once. The body is the one Add text or FAQs takes, and the new file is
<title>.md.
To change a text, read its current words first: download the file, or read its passages.
Path parameters
Body
Request
curl -X PUT "https://api.verbeo.ai/v1/knowledge-base/files/7d0e1f2a-3b4c-4d5e-8f6a-7b8c9d0e1f2a/text" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "title": "Holiday hours", "text": "We are closed from 24 to 26 December." }'
Response
201 Created with the new file object, processing, its replaces_id the old file’s id.
Errors
| Code | Status | When |
|---|---|---|
KB_FILE_NOT_READY | 409 | Holiday hours.md: Only a ready file can be replaced. |
KB_FILE_BEING_REPLACED | 409 | The file already has a replacement on its way. |
KB_DUPLICATE_FILE | 409 | The same words are already a file of this knowledge base. |
VALIDATION_FAILED | 422 | One of the text’s rules. |
NOT_FOUND | 404 | No such file: File not found. |
Was this page helpful?
⌘I
Edit a text or FAQ list
curl --request PUT \
--url https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/text \
--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/files/{fileId}/text"
payload = {
"title": "<string>",
"text": "<string>",
"faqs": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({title: '<string>', text: '<string>', faqs: [{}]})
};
fetch('https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/text', 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/files/{fileId}/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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/files/{fileId}/text"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"text\": \"<string>\",\n \"faqs\": [\n {}\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/text")
.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/files/{fileId}/text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.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