List files in a knowledge base
curl --request GET \
--url https://asteragents.com/api/kb/files \
--header 'Authorization: Bearer <token>'import requests
url = "https://asteragents.com/api/kb/files"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://asteragents.com/api/kb/files', 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://asteragents.com/api/kb/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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"
"net/http"
"io"
)
func main() {
url := "https://asteragents.com/api/kb/files"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://asteragents.com/api/kb/files")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://asteragents.com/api/kb/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"files": [
{
"id": 456,
"knowledgeBaseId": 123,
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"fileName": "quarterly-report.pdf",
"fileKey": "org_xxx/uploads/550e8400-e29b-41d4-a716-446655440000/quarterly-report.pdf",
"contentKey": "org_xxx/contents/550e8400-e29b-41d4-a716-446655440000.md",
"contentType": "application/pdf",
"processingStatus": "completed",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:35:00.000Z",
"fileSize": 1048576,
"processingError": null,
"imageKeys": [
"org_xxx/images/file-uuid/page-1.png",
"org_xxx/images/file-uuid/page-2.png"
],
"userMetadata": {},
"extractedData": {}
}
]
}{
"error": "Valid knowledge base ID is required"
}{
"error": "Knowledge base not found"
}{
"error": "Internal Server Error"
}Knowledge Bases API
List files in a knowledge base
Retrieve all files associated with a knowledge base, including their processing status.
Use this to monitor file processing progress or display file lists in your UI.
GET
/
kb
/
files
List files in a knowledge base
curl --request GET \
--url https://asteragents.com/api/kb/files \
--header 'Authorization: Bearer <token>'import requests
url = "https://asteragents.com/api/kb/files"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://asteragents.com/api/kb/files', 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://asteragents.com/api/kb/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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"
"net/http"
"io"
)
func main() {
url := "https://asteragents.com/api/kb/files"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://asteragents.com/api/kb/files")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://asteragents.com/api/kb/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"files": [
{
"id": 456,
"knowledgeBaseId": 123,
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"fileName": "quarterly-report.pdf",
"fileKey": "org_xxx/uploads/550e8400-e29b-41d4-a716-446655440000/quarterly-report.pdf",
"contentKey": "org_xxx/contents/550e8400-e29b-41d4-a716-446655440000.md",
"contentType": "application/pdf",
"processingStatus": "completed",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:35:00.000Z",
"fileSize": 1048576,
"processingError": null,
"imageKeys": [
"org_xxx/images/file-uuid/page-1.png",
"org_xxx/images/file-uuid/page-2.png"
],
"userMetadata": {},
"extractedData": {}
}
]
}{
"error": "Valid knowledge base ID is required"
}{
"error": "Knowledge base not found"
}{
"error": "Internal Server Error"
}Authorizations
JWT token from Clerk authentication.
Must be from a user with org:admin role.
Query Parameters
The ID of the knowledge base
Example:
123
⌘I