Python SDK Reference
Complete method reference with request examples and responses.
Installation & Initialization
Install the SDK and create a client. Pass your API key directly or via the KB_API_KEY environment variable.
KBClient(api_key, api_url, ...)Synchronous client. Raises ValueError if no API key is provided.
kb.health()Returns server health status.
kb.me()Returns the authenticated user profile.
Knowledge Bases
Create and manage knowledge bases that store your scraped and processed content.
kb.create_kb(name, description?, settings?)→ KnowledgeBaseCreates a new knowledge base.
kb.list_kbs()→ List[KnowledgeBase]Lists all knowledge bases owned by the authenticated user.
kb.get_kb(kb_id)→ KnowledgeBasekb.get_kb_stats(kb_id)→ KBStatskb.delete_kb(kb_id)Permanently deletes a knowledge base and all its contents.
Scrape
Extract content from a single URL and store it in a knowledge base. Returns a JobRef — poll get_job() to track progress.
kb.scrape(kb_id, url, formats?, format_options?, include_docs?)→ JobRefCrawl
Recursively crawl a website from a root URL and store every discovered page.
kb.crawl(kb_id, url, formats?, ..., exclude_paths?)→ JobRefSearch
Run a web search query, scrape the top results, and store them in a knowledge base.
kb.search_job(kb_id, query, limit?, lang?, formats?)→ JobRefMap
Discover all URLs on a site without extracting page content.
kb.map_job(kb_id, url, limit?)→ JobRefUpload
Parse and index a local file — PDF, DOCX, XLSX, CSV, images, and more. OCR fallback is applied for scanned PDFs.
kb.upload(kb_id, file_path, formats?, ocr_language?)→ JobRefMonitor
Create a recurring check that re-scrapes a page (or re-crawls a site), diffs it against the last check, and POSTs a webhook when something is new, changed, or removed. Unlike other jobs, a monitor never "completes" — it stays "running" indefinitely by design. Output is always markdown, there's no formats/scrapeOptions field.
kb.monitor(kb_id, monitor_type, schedule, notify_url, urls?, url?, limit?, include_paths?, exclude_paths?)→ JobRef"page" mode watches one or more exact URLs (pass urls). "website" mode crawls a whole site and watches every discovered page (pass url, plus optional limit/include_paths/exclude_paths). schedule accepts natural language ("daily", "every 30 minutes") or a cron expression — a minimum interval is enforced server-side.
Job Management
Poll, list, cancel, and inspect jobs. Status transitions: queued → running → completed / failed.
kb.get_job(job_id)→ JobFetches full details and current status for a job.
kb.list_jobs(kb_id?, status?, type?, limit?, offset?)→ List[Job]Lists jobs with optional filters.
kb.cancel_job(job_id)Cancels a running or queued job. For a monitor job (which stays "running" indefinitely by design), this is the correct way to stop the recurring check — required before delete_job() will succeed.
kb.delete_job(job_id)Permanently deletes a job and its stored pages. Refuses jobs in "running"/"queued" status — monitor jobs must be cancelled with cancel_job() first.
kb.get_job_logs(job_id)→ List[JobLog]Returns processing logs for a job.
kb.get_job_audit(job_id)→ AuditReportReturns a diff-audit comparing source PDF against extracted markdown.
kb.get_job_source_pdf(job_id)→ bytesDownloads the original source PDF for an upload job.
kb.get_job_source_md(job_id)→ strReturns the extracted markdown for an upload job.
Pages & Search
Browse pages stored in a knowledge base, retrieve their content, and run full-text search.
kb.list_pages(kb_id, options?)→ List[PageSummary]kb.get_page(kb_id, page_id, format?)→ PageContentFetches the stored content of a page. format defaults to 'json'.
kb.search_kb(kb_id, q, options?)→ SearchResponseFull-text Elasticsearch search over all pages in a knowledge base.
kb.embed_search_kb(kb_id, q, options?)→ EmbedSearchResponseSemantic (hybrid) search over chunk embeddings — dense KNN + BM25 fused with RRF. Returns chunk-level hits ideal for RAG. Not paginated (no page param).
Files & Exports
Browse stored files, download individual files, and export jobs or entire knowledge bases.
kb.list_kb_jobs(kb_id, options?)→ List[Job]Lists all jobs belonging to a specific knowledge base.
kb.list_job_files(kb_id, job_id)→ FileListResponseLists all files stored by a job.
kb.download_file(kb_id, job_id, file_path)→ bytesDownloads a single stored file by its storage path.
kb.export_job_zip(kb_id, job_id)→ bytesDownloads all files from a single job as a ZIP archive.
kb.export_kb_zip(kb_id)→ bytesDownloads all pages across every job in a knowledge base as a single ZIP archive.
kb.export_kb(kb_id, format?)→ Generator[bytes]Streams a full KB export as JSONL or CSV. format is 'jsonl' (default) or 'csv'.
AsyncKBClient
All methods are available on AsyncKBClient with identical signatures. Use with async/await in async contexts.
AsyncKBClientDrop-in async replacement for KBClient. Import and initialize the same way.