Modify Knowledge Base
The API allows modification of the Knowledge Base by sending a POST request to the /chat/Chatbot/EditKnowledge endpoint.
Endpoint
Request URL: https://app.neoagent.co/chat/Chatbot/EditKnowledge
Method: POST
Request Body
The request body must include the following parameters:
{
// string, required - Unique identifier (ID) of the chatbot
"serialNumber": "3254a9d0424c4806b9ea3d0763ccf1bf",
// string, optional - URL of the site map
"SiteMapUrl": "",
// boolean, optional - Whether to enable site map synchronization
"EnableSyncSiteMap": false,
// integer, required when EnableSyncSiteMap is true - Synchronization frequency (Monthly: 30, Weekly: 7, Daily: 1)
"SyncSiteMapDays": 0,
// array of strings, optional - List of file IDs
"fileList": [
"34322",
"34321"
],
// string, optional - Text content to add
"text": "111111111",
// string, optional - Google Sheet URL
"googleSheetUrl": "",
// boolean, optional - Whether to retrain using Google Sheet data
"isRetrainGoogleSheet": true,
// array of objects, optional - List of websites to scan
"websiteList": [
{
"url": "https://www.google.com",
"retrain": false
}
],
// array of objects, optional - List of question and answer pairs
"qaList": [
{
"key": "Question",
"value": "Answer"
}
]
}
Parameters
serialNumber- string, required - Unique identifier (ID) of the chatbotSiteMapUrl- string, optional - URL of the site mapEnableSyncSiteMap- boolean, optional - Whether to enable site map synchronizationSyncSiteMapDays- integer, required when EnableSyncSiteMap is set to true - Synchronization frequency (Monthly: 30, Weekly: 7, Daily: 1)fileList- array of strings, optional - List of file IDstext- string, optional - Text content to addgoogleSheetUrl- string, optional - URL of the Google SheetisRetrainGoogleSheet- boolean, optional - Whether to retrain using Google Sheet datawebsiteList- array of objects, optional - List of websites to scanwebsiteList[].url- string - URL of the websitewebsiteList[].retrain- boolean - Whether to retrain using this websiteqaList- array of objects, optional - List of question and answer pairsqaList[].key- string - QuestionqaList[].value- string - Answer
Required Headers
The API request must include the following headers:
Authorization: <Your-Secret-Key>- string, required - The secret key to authenticate the API requestContent-Type: application/json- string, required - The content type of the request payload (must be application/json)
Request Examples
- JavaScript (Fetch API)
- Python (Requests)
- cURL
- HTTP Raw
const res = await fetch('https://app.neoagent.co/chat/Chatbot/GetSource', {
method: 'POST',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx"
})
});
const data = await res.json();
console.log(data);
import requests
import json
url = 'https://app.neoagent.co/chat/Chatbot/EditKnowledge'
headers = {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
}
data = {
"serialNumber": "3254a9d0424c4806b9ea3d0763ccf1bf",
"fileList": [
"34322",
"34321"
]
}
response = requests.post(url, headers=headers, json=data)
data = response.json()
print(data)
curl 'https://app.neoagent.co/chat/Chatbot/EditKnowledge' \
-X POST \
-H 'Authorization: <Your-Secret-Key>' \
-H 'Content-Type: application/json' \
-d '{"serialNumber":"3254a9d0424c4806b9ea3d0763ccf1bf","fileList":["34322","34321"]}'
POST /chat/Chatbot/EditKnowledge HTTP/1.1
Host: app.neoagent.co
Authorization: <Your-Secret-Key>
Content-Type: application/json
{
"serialNumber": "3254a9d0424c4806b9ea3d0763ccf1bf",
"fileList": [
"34322",
"34321"
]
}
Response
The API response will be a JSON object with the following structure:
{
// boolean - Operation success status
"Data": true,
// string - API version
"Version": "1.0.0",
// boolean - Operation success status
"Success": true,
// integer - HTTP status code
"Code": 200,
// string - Error message if any
"Message": ""
}
Error Handling
If the request fails, you should:
- Check the HTTP status code for network-level errors
- Examine the
CodeandMessagefields in the response for business-level errors - The
Messagefield will contain detailed information about the error