Upload a knowledge base file
Upload a file with multipart/form-data. Processing may continue after upload.
curl -X POST "https://api.talkturo.com/api/assistants/123e4567-e89b-12d3-a456-426614174000/knowledge-base" \
--form file=example_string
import requests
import json
url = "https://api.talkturo.com/api/assistants/123e4567-e89b-12d3-a456-426614174000/knowledge-base"
headers = {}
data = {
"file": "example_string"
}
response = requests.post(url, headers=headers, data=data)
print(response.json())
const formData = new FormData();
formData.append("file", "example_string");
const response = await fetch("https://api.talkturo.com/api/assistants/123e4567-e89b-12d3-a456-426614174000/knowledge-base", {
method: "POST",
body: formData
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"mime/multipart"
)
func main() {
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
writer.WriteField("file", "example_string")
writer.Close()
req, err := http.NewRequest("POST", "https://api.talkturo.com/api/assistants/123e4567-e89b-12d3-a456-426614174000/knowledge-base", body)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", writer.FormDataContentType())
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.talkturo.com/api/assistants/123e4567-e89b-12d3-a456-426614174000/knowledge-base')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request.set_form([
["file", "example_string"]
], 'multipart/form-data')
response = http.request(request)
puts response.body
{
"success": true,
"file": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"filename": "John Doe",
"size": 3.14,
"type": "example_string",
"status": "example_string",
"created_at": "2024-12-25T10:00:00Z"
}
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
POST
/assistants/{assistantId}/knowledge-basePOST
Base URLstring
Target server for requests. Edit to use your own host.
API Key (cookie: sb-access-token)
sb-access-tokenstring
RequiredAuthenticated Talkturo web session cookie (Supabase httpOnly session). Browser clients typically send this automatically after sign-in. Related refresh cookies may also be present depending on the client.
Authenticated Talkturo web session cookie (Supabase httpOnly session).
Browser clients typically send this automatically after sign-in.
Related refresh cookies may also be present depending on the client.
path
assistantIdstring
RequiredAssistant UUID
Format: uuid
Content-Typestring
RequiredThe media type of the request body
Options: multipart/form-data
filestring
RequiredFormat: binary
Request Preview
Response
Response will appear here after sending the request
Authentication
path
parameterstring
RequiredAPI Key for authentication. Authenticated Talkturo web session cookie (Supabase httpOnly session). Browser clients typically send this automatically after sign-in. Related refresh cookies may also be present depending on the client.
Path Parameters
assistantIdstring
RequiredAssistant UUID
Body
multipart/form-data
Responses
successboolean
fileobject
Was this page helpful?