Criar base de conhecimento
curl --request POST \
--url https://suasofia.online/api/user/knowledgebases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>"
}
'import requests
url = "https://suasofia.online/api/user/knowledgebases"
payload = {
"name": "<string>",
"description": "<string>"
}
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: '<string>', description: '<string>'})
};
fetch('https://suasofia.online/api/user/knowledgebases', 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://suasofia.online/api/user/knowledgebases",
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' => '<string>',
'description' => '<string>'
]),
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://suasofia.online/api/user/knowledgebases"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\"\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://suasofia.online/api/user/knowledgebases")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://suasofia.online/api/user/knowledgebases")
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\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Base de conhecimento criada com sucesso.",
"data": {
"id": 1,
"name": "Documentação do Produto",
"description": "Documentação técnica para nossos produtos",
"status": "empty",
"status_label": "Vazia",
"created_at": "2025-01-08T10:30:00.000000Z",
"updated_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "O campo nome é obrigatório.",
"errors": {
"name": [
"O campo nome é obrigatório."
]
}
}
{
"error": "Falha ao criar base de conhecimento. Tente novamente."
}
Bases de Conhecimento
Criar base de conhecimento
Criar uma nova base de conhecimento
POST
/
user
/
knowledgebases
Criar base de conhecimento
curl --request POST \
--url https://suasofia.online/api/user/knowledgebases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>"
}
'import requests
url = "https://suasofia.online/api/user/knowledgebases"
payload = {
"name": "<string>",
"description": "<string>"
}
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: '<string>', description: '<string>'})
};
fetch('https://suasofia.online/api/user/knowledgebases', 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://suasofia.online/api/user/knowledgebases",
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' => '<string>',
'description' => '<string>'
]),
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://suasofia.online/api/user/knowledgebases"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\"\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://suasofia.online/api/user/knowledgebases")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://suasofia.online/api/user/knowledgebases")
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\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Base de conhecimento criada com sucesso.",
"data": {
"id": 1,
"name": "Documentação do Produto",
"description": "Documentação técnica para nossos produtos",
"status": "empty",
"status_label": "Vazia",
"created_at": "2025-01-08T10:30:00.000000Z",
"updated_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "O campo nome é obrigatório.",
"errors": {
"name": [
"O campo nome é obrigatório."
]
}
}
{
"error": "Falha ao criar base de conhecimento. Tente novamente."
}
Este endpoint cria uma nova base de conhecimento. Após a criação, você pode adicionar documentos a ela usando o endpoint create document.
Corpo da Requisição
string
required
O nome da base de conhecimento (máx. 255 caracteres)
string
Descrição opcional da base de conhecimento (máx. 255 caracteres)
Resposta
string
Mensagem de sucesso
object
O objeto da base de conhecimento criada
Show data properties
Show data properties
integer
O identificador único da base de conhecimento
string
O nome da base de conhecimento
string
Descrição da base de conhecimento
string
Status atual (será
empty para novas bases de conhecimento)string
Rótulo de status legível para humanos
string
Timestamp ISO 8601 da criação
string
Timestamp ISO 8601 da última atualização
{
"message": "Base de conhecimento criada com sucesso.",
"data": {
"id": 1,
"name": "Documentação do Produto",
"description": "Documentação técnica para nossos produtos",
"status": "empty",
"status_label": "Vazia",
"created_at": "2025-01-08T10:30:00.000000Z",
"updated_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "O campo nome é obrigatório.",
"errors": {
"name": [
"O campo nome é obrigatório."
]
}
}
{
"error": "Falha ao criar base de conhecimento. Tente novamente."
}
Próximos Passos
Após criar uma base de conhecimento, você vai querer:- Adicionar documentos - Use o endpoint create document para adicionar conteúdo
- Aguardar o processamento - Documentos são processados de forma assíncrona
- Anexar ao assistente - Use o endpoint update assistant para anexar a base de conhecimento
⌘I

