Set current version
curl --request PUT \
--url https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"version": 1
}'import requests
url = "https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current"
payload = { "version": 1 }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({version: 1})
};
fetch('https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current', 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://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'version' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current"
payload := strings.NewReader("{\n \"version\": 1\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"version\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": 1\n}"
response = http.request(request)
puts response.read_body{
"knowledgeId": "k7x2m",
"name": "pricing.pdf",
"type": "pdf",
"status": "processing",
"statusReason": "<string>",
"failureCode": "<string>",
"sizeInBytes": 123,
"pageCount": 123,
"sectionCount": 123,
"charCount": 123,
"folderId": "<string>",
"currentVersion": 123,
"latestVersion": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"message": "Invalid payload",
"errors": {
"formErrors": [
"<string>"
],
"fieldErrors": {}
}
}{
"error": "<string>"
}{
"message": "Version not found"
}{
"message": "That version is not ready to be made current"
}Versions
Set current version
Makes another version current, to roll back or forward. Agents read it straight away.
PUT
/
v1
/
knowledge-bases
/
{knowledgeId}
/
versions
/
current
Set current version
curl --request PUT \
--url https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"version": 1
}'import requests
url = "https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current"
payload = { "version": 1 }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({version: 1})
};
fetch('https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current', 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://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'version' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current"
payload := strings.NewReader("{\n \"version\": 1\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"version\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeroruntime.ai/v1/knowledge-bases/{knowledgeId}/versions/current")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": 1\n}"
response = http.request(request)
puts response.read_body{
"knowledgeId": "k7x2m",
"name": "pricing.pdf",
"type": "pdf",
"status": "processing",
"statusReason": "<string>",
"failureCode": "<string>",
"sizeInBytes": 123,
"pageCount": 123,
"sectionCount": 123,
"charCount": 123,
"folderId": "<string>",
"currentVersion": 123,
"latestVersion": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"message": "Invalid payload",
"errors": {
"formErrors": [
"<string>"
],
"fieldErrors": {}
}
}{
"error": "<string>"
}{
"message": "Version not found"
}{
"message": "That version is not ready to be made current"
}Authorizations
Your API token, sent raw (no Bearer prefix).
Path Parameters
Body
application/json
The version to make current. It must be ready.
Required range:
x >= 1Example:
1
Response
The knowledge base, now on the chosen version.
Status and size fields describe the current version.
5 characters
Example:
"k7x2m"
Example:
"pricing.pdf"
Available options:
pdf, txt, csv, json, docx, md, url processing: being parsed and indexed. Not available to agents yet.ready: indexed and available to agents.failed: processing stopped.statusReasonsays why.
Available options:
processing, ready, failed Why processing failed.
For example upload_failed or job_not_scheduled.
0 for website knowledge bases.
null when it's at the top level.
The version agents read from.
The newest version. It may still be processing