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.

kscli authenticates with a user-scoped API key. No admin impersonation, no JWT dance — the key is presented as a bearer token on every request and carries the permissions of the user that created it.
TL;DR
How to create an API key
API keys are created from the Knowledge Stack dashboard.Sign in
Open app.knowledgestack.ai. New users can sign up with email/password or Google SSO.
Label it
Give the key a descriptive label (e.g.
kscli on my laptop, CI pipeline, ingest cron) so you can audit and revoke it later.Revoke a key from the same page when you rotate credentials or when a laptop is lost. Revocation is immediate — the next
kscli command from that machine will exit with code 2 and prompt you to log in again.Auth flow
src/kscli/commands/auth.py, src/kscli/auth.py, src/kscli/client.py.
Commands
login
GET /users/me before writing it to disk. If validation fails, nothing is persisted.
logout
whoami
Credential storage
| Path | Purpose | Permissions |
|---|---|---|
/tmp/kscli/.credentials | API key, JSON {"api_key": "..."} | 0600 |
~/.config/kscli/config.json | Base URL, TLS, default format | user default |
KSCLI_CREDENTIALS_PATH— directory that holds.credentials(default/tmp/kscli). Point this at a persistent location (e.g.~/.config/kscli) if you don’t want the key wiped on reboot.KSCLI_CONFIG— full path to the config file.
Pointing at a different environment
login --url takes any base URL; it is persisted to the config file so subsequent commands don’t need it again.
- Local dev
- Staging
- Production
--base-url on the root group:
TLS / SSL
login auto-enables TLS verification when the URL is https://. For self-signed certs or corporate proxies:
kscli prints troubleshooting steps:
Exit codes
| Situation | Exit | Message |
|---|---|---|
| Success | 0 | — |
| Auth failure (401) | 2 | Session expired. Run: kscli login --api-key <key> |
| Not found (404) | 3 | <resource> not found |
| Validation error (422) | 4 | Echoes the FastAPI validation body |
| Any other failure | 1 | Generic error message |
handle_client_errors() in src/kscli/client.py.
Security notes
Next steps
Quickstart
Zero to first semantic search
Configuration
Env vars, config file, precedence
