Update knowledge base status
curl --request POST \
--url https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status \
--header 'Content-Type: application/json' \
--header 'token: <token>' \
--data '
{
"knowledge_base_id": 123
}
'import requests
url = "https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status"
payload = { "knowledge_base_id": 123 }
headers = {
"token": "<token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {token: '<token>', 'Content-Type': 'application/json'},
body: JSON.stringify({knowledge_base_id: 123})
};
fetch('https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status', 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://www.tryunleashx.com/api/v1/global/update-knowledgebase-status",
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([
'knowledge_base_id' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"token: <token>"
],
]);
$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://www.tryunleashx.com/api/v1/global/update-knowledgebase-status"
payload := strings.NewReader("{\n \"knowledge_base_id\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("token", "<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://www.tryunleashx.com/api/v1/global/update-knowledgebase-status")
.header("token", "<token>")
.header("Content-Type", "application/json")
.body("{\n \"knowledge_base_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["token"] = '<token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"knowledge_base_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"id": 123,
"name": "<string>",
"status": 123
}
}Campaigns
Update Knowledge Base Status
Update the status of a knowledge base item linked to a campaign. Resets the trained state, requiring re-training.
POST
/
update-knowledgebase-status
Update knowledge base status
curl --request POST \
--url https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status \
--header 'Content-Type: application/json' \
--header 'token: <token>' \
--data '
{
"knowledge_base_id": 123
}
'import requests
url = "https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status"
payload = { "knowledge_base_id": 123 }
headers = {
"token": "<token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {token: '<token>', 'Content-Type': 'application/json'},
body: JSON.stringify({knowledge_base_id: 123})
};
fetch('https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status', 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://www.tryunleashx.com/api/v1/global/update-knowledgebase-status",
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([
'knowledge_base_id' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"token: <token>"
],
]);
$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://www.tryunleashx.com/api/v1/global/update-knowledgebase-status"
payload := strings.NewReader("{\n \"knowledge_base_id\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("token", "<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://www.tryunleashx.com/api/v1/global/update-knowledgebase-status")
.header("token", "<token>")
.header("Content-Type", "application/json")
.body("{\n \"knowledge_base_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["token"] = '<token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"knowledge_base_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"id": 123,
"name": "<string>",
"status": 123
}
}Use this endpoint to update the status of a knowledge base item linked to a campaign.
Endpoint
POST/update-knowledgebase-status
Content-Type: application/json
Authentication: Required (workspace auth)
Request Body
{
"knowledge_base_id": 7,
"status": "active"
}
| Field | Type | Required | Description |
|---|---|---|---|
knowledge_base_id | number | Yes | ID of the knowledge base record |
status | string | Yes | active or inactive |
Response
{
"message": "Knowledge base status updated successfully",
"data": {
"id": 7,
"name": "faq.pdf",
"status": 1
}
}
Behavior
- Updates the knowledge base
STATUSand resetsTRAINEDto0(untrained), requiring re-training. - Validates that the knowledge base record exists and is not deleted.
- Validates that the associated agent exists and is not deleted.
Error Cases
| Error | Cause |
|---|---|
Knowledge base not found | Invalid knowledge_base_id or record is deleted |
Associated agent not found | The linked agent has been removed |
Example cURL
curl -X POST https://www.tryunleashx.com/api/v1/global/update-knowledgebase-status \
-H "Content-Type: application/json" \
-H "token: <api_key>" \
-d '{
"knowledge_base_id": 7,
"status": "active"
}'
Headers
API token for authentication
Body
application/json
Was this page helpful?

