Knowledge
Read a file
const url = 'https://app.whatsetter.com/api/v1/knowledge-bases/example/files/example?offset=0&limit=100000';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://app.whatsetter.com/api/v1/knowledge-bases/example/files/example?offset=0&limit=100000' \ --header 'Authorization: Bearer <token>'One file with its whole text. text_source says where the text comes
from:
file: the text of the file, to the character (a.txt,.mdor.csvfile). It comes with arevision: pass it back asif_revisionwhen you rewrite the file.passages: put back together from the passages the agents hold (a PDF or Word file). The words are the file’s, its layout is not, and it is not the file to the character: a word that ends one passage and starts the next can come back twice, or once.passages_unordered: the same, when the order of the passages is not known (a file read at an agent’s creation, or a very long line cut in pieces).
While a change of a text file is being saved, and after one that was
cut short, the text returned is the last one that was saved. In the
rare case where that cannot be told, revision is null: send the
whole text then, without if_revision.
A long text comes in windows of limit characters: while
next_offset is not null, call again with offset set to it.
Requires scope knowledge:read.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The id of a source of kind file from GET /knowledge-bases/{id}
Query Parameters
Section titled “Query Parameters”Where to start reading, in characters.
How many characters to return.
Responses
Section titled “Responses”The file and its text
object
object
PDF files read from the dashboard; null otherwise.
How many passages the agents hold for this file: what the search picks from.
true for a text file (.txt, .md).
The length of the file’s text.
The text, or the window of it that offset and limit ask for.
The revision of the whole text (not of the window). null when the text is put back together from passages.
The length of the whole text.
Where the next window starts; null when the text is complete.
Example
{ "data": { "id": "68e61c2a0019f0a4d3b1", "name": "opening-hours.txt", "status": "ready", "size_bytes": 72, "pages": null, "passages": 1, "editable": true, "created_at": "2026-10-09T08:40:10.000+00:00", "updated_at": "2026-10-09T08:40:10.000+00:00", "text": "Monday to Friday: 7 am to 10 pm.\nSaturday: 9 am to 6 pm.\nClosed on Sunday.", "text_source": "file", "revision": "5f2a9c81d04be637", "characters": 72, "offset": 0, "next_offset": null }}Missing, unknown or revoked API key
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}The key lacks the required scope (insufficient_scope), the plan does not have this part of the API (not_in_plan), or Instagram is not enabled on the workspace (instagram_not_enabled, Instagram routes)
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}Resource not found in this workspace
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}A PDF or Word file too long to be read whole through the API
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}offset or limit out of bounds
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}The knowledge store did not answer
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}