Create a knowledge base entry
Beta
Creates a new knowledge base entry for a replica based on text, file, URL, or Youtube Videos. For YouTube playlists, the system will automatically create separate entries for each video in the playlist.
Body
-
Title for this knowledge base entry. Helps identify the content in listings.
-
A public URL to an HTML page to ingest into the knowledge base. The URL must be publicly accessible without authentication. Google domains(e.g. www.google.com, docs.google.com) are not allowed. Only the rendered text on the web page is used for training, embedded media (image, video, audio) is not used. For training using video files, please provide YouTube links in one of the following formats: https://www.youtube.com/watch?v=VIDEO_ID https://www.youtube.com/shorts/SHORT_VIDEO_ID https://www.youtube.com/playlist?list=PLAYLIST_ID
Format should match the following pattern:
https?:\/\/[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]+\b([-a-zA-Z0-9()@:%_+.~#?&\/=]*)
. -
Whether to allow automatic content updates from the URL, handled by the system.
Default value is
false
. -
The text content you want your replica to learn
Minimum length is
1
. -
The name of the file that you intend to upload. Supported file types:
- Documents: .doc, .docx, .rtf, .pdf, .pdfa
- Spreadsheets and Tabular Data: .csv, .tsv, .xls, .xlsx, .xlsm, .xlsb, .ods, .dta, .sas7bdat, .xpt
- Presentations: .ppt, .pptx
- Text Files: .txt, .md, .htm, .html, .css, .js, .xml
- Data Text Files: .json, .yml, .yaml
- E-books: .epub
- Images: .png, .jpg, .jpeg, .webp, .heic, .heif, .tiff, .bmp
- Audio Files: .mp3, .wav, .aac, .ogg, .flac
- Video Files: .mp4, .mpeg, .mov, .avi, .mpg, .webm, .mkv (Maximum duration: 90 minutes)
curl \
--request POST 'https://api.sensay.io/v1/replicas/03db5651-cb61-4bdf-9ef0-89561f7c9c53/knowledge-base' \
--header "X-ORGANIZATION-SECRET: $API_KEY" \
--header "Content-Type: application/json" \
--header "X-API-Version: 2025-03-25" \
--data '{"title":"Company information","url":"https://example.com","autoRefresh":false,"text":"Our company was founded in 2020. We specialize in AI-powered customer service solutions.","filename":"example.txt"}'
# Headers
X-API-Version: 2025-03-25
# Payload
{
"title": "Company information",
"url": "https://example.com",
"autoRefresh": false,
"text": "Our company was founded in 2020. We specialize in AI-powered customer service solutions.",
"filename": "example.txt"
}
{
"success": true,
"results": [
{
"type": "file",
"enqueued": true,
"knowledgeBaseID": 12345,
"signedURL": "https://xotqxvmmnunwfsaemqfy.supabase.co/storage/v1/object/upload/sign/replica_files/..."
}
]
}
{
"error": "A text representation of the error",
"success": false,
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b"
}
{
"error": "A text representation of the error",
"success": false,
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b"
}
{
"error": "A text representation of the error",
"success": false,
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
{
"error": "A text representation of the error",
"success": false,
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b"
}
{
"error": "A text representation of the error",
"success": false,
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b"
}
{
"error": "A text representation of the error",
"success": false,
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"inner_exception": {
"name": "Server overheated",
"cause": "Request too complicated",
"stack": "Error: Server overheated due to an unexpected situation\n at Object.eval (eval at <anonymous>...",
"message": "The server overheated due to an unexpected situation"
}
}