> For the complete documentation index, see [llms.txt](https://k-ai.gitbook.io/knowledge-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k-ai.gitbook.io/knowledge-ai/get-started/choose-your-auth.md).

# Choose your auth

Three auth surfaces; pick by caller type.

| Caller type                                                                                                                                     | Auth                              | Documentation                                                 | Next step                                                                                                              |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Backend pipeline ingesting documents into a single instance                                                                                     | `instance-id` + `api-key` headers | [Instance API keys](/knowledge-ai/authentication/api-keys.md) | [Instance API — Orchestrator](/knowledge-ai/sources-and-ingestion/instance-api/orchestrator.md) (first ingestion call) |
| MCP client (Claude Desktop / Cursor / Le Chat) or custom user-level integration spanning multiple instances                                     | OAuth 2.1 (Bearer JWT)            | [OAuth 2.1](/knowledge-ai/authentication/oauth.md)            | [Quickstart — K-AI MCP](/knowledge-ai/get-started/mcp-quickstart.md) (first MCP install)                               |
| Browser frontend on `.kai-studio.ai` (K-AI Audit web app, K-AI Studio portal, K-AI Retrieval admin console, K-AI Consumption Monitoring System) | `kai_auth` HttpOnly cookie        | [Cookies](/knowledge-ai/authentication/cookies.md)            | [K-AI Audit web app](https://app.kai-studio.ai) (sign in directly)                                                     |

## Decision rules

* **Use API keys** when the caller is a backend process and the operation is scoped to one instance. No user identity, no group RBAC.
* **Use OAuth 2.1** when the caller acts on behalf of a human user, especially for MCP and cross-instance queries. Tokens are scoped to the user's access rights.
* **Use cookies** only for browser frontends served from `*.kai-studio.ai`. Never read/write the cookie from JavaScript — it's HttpOnly by design.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://k-ai.gitbook.io/knowledge-ai/get-started/choose-your-auth.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
