Skip to content

List knowledgebase documents

GET
/api/v1/knowledgebase_document
curl --request GET \
--url 'https://app.prefactorai.com/api/v1/knowledgebase_document?knowledgebase_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny' \
--header 'Authorization: Bearer <token>'
knowledgebase_id
required
Knowledgebase_Id

A valid knowledgebase ID

string
Example
013xrzp12g3nqk8ns6jadrqmpgrjkeny

Knowledgebase whose documents are listed

path_prefix
One of:
string
Example
guides/
status
One of:
string
Allowed values: active archived
Example
active
idempotency_key
One of:

Optional idempotency key for ensuring request idempotency

string
sorting

Sort order; a field name, optionally prefixed with - for descending (e.g. -id). Supported fields: id, path.

string

Sort order; a field name, optionally prefixed with - for descending (e.g. -id). Supported fields: id, path.

pagination[offset]
integer

Zero-based offset of the first item to return.

pagination[page_size]
integer
>= 1 <= 100

Number of items to return per page (1-100).

Success

Media typeapplication/json
object
pagination
required
One of:
PaginationOutput

Pagination information

object
item_count
required

The total number of items

integer
item_end
required

The index of the last item in the page (one-based)

integer
item_start
required

The index of the first item in the page (one-based)

integer
next_page_offset
required
One of:

The offset of the next page (null if last page)

integer
page_count
required

The total number of pages

integer
page_index
required

The index of the current page (one-based)

integer
page_offset
required

The offset of the first item in the page (zero-based)

integer
page_size
required

The number of items per page

integer
previous_page_offset
required
One of:

The offset of the previous page (null if first page)

integer
sorting
required
One of:
Sorting

Sorting information

object
direction

The direction to sort by

string
Allowed values: asc desc
field

The field to sort by (values depend on the type of list)

string
Allowed values: id status started_at finished_at email name external_identifier raised_at cleared_at severity last_active_at last_activity_span_at last_analyzed_at last_used_at inserted_at mode agent_instance_id job_title pending_clickhouse pending_s3 profile_completed_at promo_code purpose row_count size_bytes token_scope total website expires_at path revision_number
nulls

Where to place null values. auto leaves placement to the database default.

string
Allowed values: first last auto
status
required

Response status when the query succeeds

string
Allowed values: success
summaries
required

Documents in the knowledgebase visible to the caller

Array<object>
KnowledgebaseDocument_Summary

Summary of a knowledgebase document for list responses

object
content_sha256
required

SHA-256 of the content, as lowercase hex

string
content_type
required

MIME type of the document

string
Allowed values: text/markdown text/plain application/json application/yaml text/csv
id
required
KnowledgebaseDocument_Id

A valid knowledgebase document ID

string
knowledgebase_id
required
Knowledgebase_Id

A valid knowledgebase ID

string
latest_revision_id
required
KnowledgebaseDocumentRevision_Id

A valid knowledgebase document revision ID

string
latest_revision_number
required

Revision number of the latest document revision

integer
>= 1
path
required

Document path, relative, with segments separated by /

string
size_bytes
required

Size of the content in bytes

integer
status
required

Whether this document is active or archived

string
Allowed values: active archived
type
required

Type of resource (always ‘knowledgebase_document’)

string
Allowed values: knowledgebase_document
Example
{
"pagination": {
"item_count": 200,
"item_end": 100,
"item_start": 91,
"next_page_offset": 110,
"page_count": 20,
"page_index": 10,
"page_offset": 90,
"page_size": 10,
"previous_page_offset": 80
},
"sorting": null,
"status": "success",
"summaries": [
{
"content_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"content_type": "text/markdown",
"id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny",
"knowledgebase_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny",
"latest_revision_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny",
"latest_revision_number": 1,
"path": "guides/setup.md",
"size_bytes": 128,
"status": "active",
"type": "knowledgebase_document"
}
]
}

Error

Media typeapplication/json
One of:
object
code
required
string
Allowed values: bad_request bad_authtoken not_authenticated not_permitted not_implemented unknown not_found unexpected_ref_type unexpected invalid_action invalid_state alert_unknown alert_already_cleared invalid_value required_value idempotency_key_already_used temporarily_unavailable conflict
message
required
string
status
required
string
Allowed values: error
Example
{
"code": "bad_request",
"status": "error"
}