Knowledge Bases

Add a document (file, URL, or text)

Three ways to add content: a multipart file upload (pdf, docx, xlsx, txt, md, csv, html, json; 25MB max), a JSON { "url" } to fetch and parse, or a JSON { "text" } to paste content directly. The document registers as pending and is chunked + embedded asynchronously; poll its status until indexed. Requires the kb:manage scope.

post/v1/knowledgebases/{id}/documents

Request

  • Base URL: https://api.pyai.com
  • URL: https://api.pyai.com/v1/knowledgebases/{id}/documents
  • Auth: one of:
    • HTTP bearer
    • API key in header x-api-key

Path parameters

idstring required

Request body

urlstring uri
textstring
titlestring

Response

Document registered (pending ingestion)

idstring
kbIdstring
orgIdstring
source'upload' | 'url' | 'api'

upload = file, url = fetched page, api = pasted text.

uristring nullable
titlestring nullable
filenamestring nullable
mimestring nullable
sizeBytesinteger
chunksinteger

Indexed chunk count (0 until indexed).

status'pending' | 'indexed' | 'failed'
errorstring nullable

Human-readable failure/stall reason.

indexedAtinteger nullable

Unix ms.

createdAtinteger

Unix ms.

Changes

No recorded changes to this operation across all 2 revisions of this API.