Files
File passages
What an assistant reads from a ready file: its passages in order, 20 a page.
GET
/
knowledge-base
/
files
/
{fileId}
/
passages
File passages
curl --request GET \
--url https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/passages \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/passages"
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}/passages', 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}/passages",
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}/passages"
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}/passages")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/passages")
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 a ready file’s passages, in order, 20 a page: exactly what an assistant’s search can hand over from it. Use it to check how a file was read. Each passage of a recent file starts with the file’s name and the headings it sits under.
Path parameters
Query parameters
Request
curl "https://api.verbeo.ai/v1/knowledge-base/files/c4ff0c9c-4b3b-4a94-a86e-3d3b64088ae0/passages?page=1" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
200 OK. total is the file’s passages: there are more pages while page × page_size is below it.
{
"success": true,
"data": {
"file_id": "c4ff0c9c-4b3b-4a94-a86e-3d3b64088ae0",
"page": 1,
"page_size": 20,
"total": 12,
"passages": [
{ "index": 0, "content": "prices.pdf › Cleaning\n\nA deep cleaning costs ₹1,499." },
{ "index": 1, "content": "prices.pdf › Whitening\n\nWhitening costs ₹4,999 for both jaws." }
]
}
}
Errors
| Code | Status | When |
|---|---|---|
CONFLICT | 409 | This file is not ready yet. |
VALIDATION_FAILED | 422 | page: must be at least 1. |
NOT_FOUND | 404 | No such file: File not found. |
Was this page helpful?
⌘I
File passages
curl --request GET \
--url https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/passages \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/passages"
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}/passages', 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}/passages",
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}/passages"
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}/passages")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/files/{fileId}/passages")
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