Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.knowledgestack.ai/llms.txt

Use this file to discover all available pages before exploring further.

PyPI GitHub

Install

pip install ksapi
Requires Python ≥ 3.9.

Authenticate

1

Sign up

Create an account at app.knowledgestack.ai.
2

Issue an API key

From the dashboard, create an API key scoped to your user. It looks like sk-user-....
3

Export it

export KS_API_KEY="sk-user-..."
export KS_BASE_URL="https://api.knowledgestack.ai"   # optional; prod is default

First call

import os
import ksapi
from ksapi.api.folders_api import FoldersApi

config = ksapi.Configuration(
    host=os.environ.get("KS_BASE_URL", "https://api.knowledgestack.ai"),
    access_token=os.environ["KS_API_KEY"],
)

with ksapi.ApiClient(config) as client:
    folders = FoldersApi(client)
    for folder in folders.list_folders():
        print(folder.id, folder.name)

Read a document

from ksapi.api.path_parts_api import PathPartsApi
from ksapi.api.documents_api import DocumentsApi

with ksapi.ApiClient(config) as client:
    hits = PathPartsApi(client).find_path_parts(query="credit policy")
    doc_id = hits[0].path_part_id
    doc = DocumentsApi(client).read_document(path_part_id=doc_id)
    print(doc.text)

Building an agent?

For agent / RAG workflows, use the MCP server instead. It plugs into every major agent framework without writing glue code.

Reference

The full auto-generated API reference lives in the ks-sdk-python repo. It’s also mirrored under sdks/_generated-python/ in this docs repo, refreshed nightly.