> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/stackai-api/rest-api-v2/knowledge-bases/get-v2-knowledge-bases.md).

# GET /v2/knowledge-bases

## List Knowledge Bases

> List knowledge bases available to the caller, newest first.\
> \
> \*\*How to use\*\*\
> \
> Discover KBs available to the authenticated caller; select the returned knowledge\_base\_id. Read items under data and follow next\_cursor. Read successful resource payloads under data when a body is returned.\
> \
> \*\*Authentication and permissions\*\*\
> \
> Required permissions: \`kbs.read\`. Resource and owner access checks also apply.

```json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"tags":[{"name":"endpoint-listKnowledgeBasesV2"}],"servers":[{"url":"https://api.stack-ai.com","description":"Hosted API. Use your deployment-specific origin for private installations."}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer","description":"Personal API key (sk_...) or supported user access JWT. See Authentication and authorization for endpoint restrictions and scopes. Use exactly one Authorization header."}},"schemas":{"PaginationDirection":{"type":"string","enum":["next","prev"],"title":"PaginationDirection","description":"Direction for cursor-based pagination."},"CursorPaginatedResponse_KnowledgeBaseResponseV2_":{"properties":{"response_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Code","description":"Machine-readable response code, when provided."},"meta":{"additionalProperties":true,"type":"object","title":"Meta","description":"Additional metadata","default":{}},"data":{"items":{"$ref":"#/components/schemas/KnowledgeBaseResponseV2"},"type":"array","title":"Data"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"prev_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prev Cursor"},"current_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Cursor"}},"type":"object","title":"CursorPaginatedResponse[KnowledgeBaseResponseV2]"},"KnowledgeBaseResponseV2":{"properties":{"knowledge_base_id":{"type":"string","format":"uuid","title":"Knowledge Base Id"},"connection_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Connection Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"connection_source_ids":{"items":{"type":"string"},"type":"array","uniqueItems":true,"title":"Connection Source Ids"},"website_sources":{"items":{"$ref":"#/components/schemas/SelectedWebsiteSource"},"type":"array","title":"Website Sources"},"source_file_authorization_enabled":{"type":"boolean","title":"Source File Authorization Enabled"},"connection_provider_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connection Provider Type"},"is_empty":{"type":"boolean","title":"Is Empty","default":true},"total_size":{"type":"integer","title":"Total Size","default":0},"total_files":{"type":"integer","title":"Total Files","default":0},"total_indexed_files":{"type":"integer","title":"Total Indexed Files","default":0},"total_error_files":{"type":"integer","title":"Total Error Files","default":0},"last_synced_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Synced At"},"name":{"type":"string","maxLength":2048,"minLength":1,"title":"Name","default":"Unnamed Knowledge Base"},"description":{"type":"string","maxLength":2048,"title":"Description","default":""},"indexing_params":{"$ref":"#/components/schemas/KnowledgeBaseResponseIndexingParams"},"org_level_role":{"anyOf":[{"$ref":"#/components/schemas/KnowledgeBaseRole"},{"type":"null"}]},"role":{"anyOf":[{"$ref":"#/components/schemas/KnowledgeBaseRole"},{"type":"null"}]}},"type":"object","required":["knowledge_base_id","connection_id","created_at","updated_at","connection_source_ids","website_sources","source_file_authorization_enabled","indexing_params"],"title":"KnowledgeBaseResponse","description":"A knowledge base on the public v2 surface."},"SelectedWebsiteSource":{"properties":{"source_type":{"$ref":"#/components/schemas/SelectedWebsiteSourceType","default":"sitemap"},"original_search_term":{"type":"string","title":"Original Search Term"},"selected_resources":{"items":{"type":"string"},"type":"array","title":"Selected Resources"}},"type":"object","required":["original_search_term","selected_resources"],"title":"SelectedWebsiteSource","description":"A set of pages selected for indexing from a website source."},"SelectedWebsiteSourceType":{"type":"string","enum":["sitemap","manual"],"title":"SelectedWebsiteSourceType","description":"The type of website source."},"KnowledgeBaseResponseIndexingParams":{"properties":{"ocr":{"type":"boolean","title":"Ocr","default":false},"embedding_params":{"$ref":"#/components/schemas/KnowledgeBaseResponseEmbeddingParams"},"chunker_params":{"$ref":"#/components/schemas/KnowledgeBaseChunkerParams"}},"type":"object","required":["embedding_params"],"title":"KnowledgeBaseResponseIndexingParams","description":"Indexing configuration of a knowledge base."},"KnowledgeBaseResponseEmbeddingParams":{"properties":{"embedding_model":{"type":"string","title":"Embedding Model"},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"}},"type":"object","required":["embedding_model"],"title":"KnowledgeBaseResponseEmbeddingParams","description":"Embedding configuration of a knowledge base."},"KnowledgeBaseChunkerParams":{"properties":{"chunk_size":{"type":"integer","minimum":1,"title":"Chunk Size","default":1500},"chunk_overlap":{"type":"integer","minimum":0,"title":"Chunk Overlap","default":500},"chunker_type":{"$ref":"#/components/schemas/ChunkerType","default":"sentence"}},"type":"object","title":"KnowledgeBaseChunkerParams","description":"Chunking strategy for splitting documents during indexing."},"ChunkerType":{"type":"string","enum":["naive","sentence"],"title":"ChunkerType"},"KnowledgeBaseRole":{"type":"string","enum":["viewer","editor","admin"],"title":"KnowledgeBaseRole","description":"A user's role within a knowledge base.\n\nOrdered by privilege for Python comparisons. All four ordering operators are\ndefined explicitly because StrEnum subclasses str: its inherited lexicographic\ncomparisons would otherwise apply, so e.g. ``max()`` would pick ``\"viewer\"``\nover ``\"admin\"``. The operators only order Python objects; Postgres enum\nordering is governed by the declaration order above."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/knowledge-bases":{"get":{"tags":["endpoint-listKnowledgeBasesV2"],"summary":"List Knowledge Bases","description":"List knowledge bases available to the caller, newest first.\n\n**How to use**\n\nDiscover KBs available to the authenticated caller; select the returned knowledge_base_id. Read items under data and follow next_cursor. Read successful resource payloads under data when a body is returned.\n\n**Authentication and permissions**\n\nRequired permissions: `kbs.read`. Resource and owner access checks also apply.","operationId":"listKnowledgeBasesV2","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional identifier for the page that should be returned. If it is not provided, the first page will be returned.","title":"Cursor"},"description":"Optional identifier for the page that should be returned. If it is not provided, the first page will be returned."},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Number of items to be returned in the page.","default":50,"title":"Page Size"},"description":"Number of items to be returned in the page."},{"name":"direction","in":"query","required":false,"schema":{"$ref":"#/components/schemas/PaginationDirection","description":"Direction for pagination: 'next' to advance through pages (older items), 'prev' to go back (newer items)","default":"next"},"description":"Direction for pagination: 'next' to advance through pages (older items), 'prev' to go back (newer items)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorPaginatedResponse_KnowledgeBaseResponseV2_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/stackai-api/rest-api-v2/knowledge-bases/get-v2-knowledge-bases.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
