Files
Get file
One file as it is now: read it until its status is ready or error.
GET
/
knowledge-base
/
files
/
{fileId}
Get file
curl --request GET \
--url https://api.verbeo.ai/v1/knowledge-base/files/{fileId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/files/{fileId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.verbeo.ai/v1/knowledge-base/files/{fileId}', 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.verbeo.ai/v1/knowledge-base/files/{fileId}",
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://api.verbeo.ai/v1/knowledge-base/files/{fileId}"
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://api.verbeo.ai/v1/knowledge-base/files/{fileId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/files/{fileId}")
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_bodyReturns one file object. After an upload, read it until
status is ready (searchable) or error (error_code and error_message say why). While it is processing, chunks_saved of chunk_count is how far it has got.
Path parameters
Request
curl "https://api.verbeo.ai/v1/knowledge-base/files/c4ff0c9c-4b3b-4a94-a86e-3d3b64088ae0" \
-H "Authorization: Bearer YOUR_API_KEY"
import os, time, requests
file_id = "c4ff0c9c-4b3b-4a94-a86e-3d3b64088ae0"
headers = {"Authorization": f"Bearer {os.environ['VERBEO_API_KEY']}"}
while True:
file = requests.get(f"https://api.verbeo.ai/v1/knowledge-base/files/{file_id}", headers=headers).json()["data"]
if file["status"] in ("ready", "error"):
break
time.sleep(5)
Response
200 OK
{
"success": true,
"data": {
"id": "c4ff0c9c-4b3b-4a94-a86e-3d3b64088ae0",
"store_id": "5df09066-0842-4c92-8ef0-6cf2ff6d7455",
"display_name": "prices.pdf",
"file_type": "application/pdf",
"file_size": 371989,
"status": "ready",
"error_code": null,
"error_message": null,
"chunk_count": 12,
"chunks_saved": 12,
"text_chars": 9575,
"warnings": [],
"…": "every field of the file object"
}
}
Errors
| Code | Status | When |
|---|---|---|
NOT_FOUND | 404 | No such file, or it belongs to another workspace: File not found. |
VALIDATION_FAILED | 422 | fileId is not a UUID. |
Was this page helpful?
⌘I
Get file
curl --request GET \
--url https://api.verbeo.ai/v1/knowledge-base/files/{fileId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/files/{fileId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.verbeo.ai/v1/knowledge-base/files/{fileId}', 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.verbeo.ai/v1/knowledge-base/files/{fileId}",
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://api.verbeo.ai/v1/knowledge-base/files/{fileId}"
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://api.verbeo.ai/v1/knowledge-base/files/{fileId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/files/{fileId}")
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