> 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-knowledge_base_id-resources.md).

# GET /v2/knowledge-bases/{knowledge\_base\_id}/resources

## List Resources

> List all files in the knowledge base (flat).\
> \
> \*\*How to use\*\*\
> \
> List resources and inspect processing status. Use cursor pagination and retain resource\_id for detail reads. Do not treat a listed pending/parsed resource as indexed. 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-listKnowledgeBaseResourcesV2"}],"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_KnowledgeBaseFileResponseV2_":{"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/KnowledgeBaseFileResponseV2"},"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[KnowledgeBaseFileResponseV2]"},"KnowledgeBaseFileResponseV2":{"properties":{"knowledge_base_id":{"type":"string","format":"uuid","title":"Knowledge Base Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"modified_at":{"type":"string","format":"date-time","title":"Modified At"},"indexed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Indexed At"},"resource_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Resource Id"},"resource_path":{"type":"string","minLength":1,"title":"Resource Path"},"acl_target_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Acl Target Path"},"dataloader_metadata":{"patternProperties":{"^[^\\t\\n\\r\\f\\v]+$":{"anyOf":[{},{"type":"null"}]}},"propertyNames":{"maxLength":64,"minLength":1},"type":"object","title":"Dataloader Metadata"},"user_metadata":{"patternProperties":{"^[^\\t\\n\\r\\f\\v]+$":{"anyOf":[{},{"type":"null"}]}},"propertyNames":{"maxLength":64,"minLength":1},"type":"object","title":"User Metadata"},"content_hash":{"type":"string","minLength":1,"title":"Content Hash"},"content_mime":{"type":"string","minLength":1,"title":"Content Mime"},"size":{"type":"integer","minimum":0,"title":"Size"},"status":{"$ref":"#/components/schemas/StackFileStatusEnum"},"effective_permissions":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Effective Permissions"}},"type":"object","required":["knowledge_base_id","created_at","modified_at","resource_id","resource_path","content_hash","content_mime","size","status"],"title":"KnowledgeBaseFileResponse","description":"A file stored in a knowledge base."},"StackFileStatusEnum":{"type":"string","enum":["resource","parsed","indexed","pending","pending_delete","deleted","error"],"title":"StackFileStatusEnum","description":"Processing status of a file in a knowledge base."},"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/{knowledge_base_id}/resources":{"get":{"tags":["endpoint-listKnowledgeBaseResourcesV2"],"summary":"List Resources","description":"List all files in the knowledge base (flat).\n\n**How to use**\n\nList resources and inspect processing status. Use cursor pagination and retain resource_id for detail reads. Do not treat a listed pending/parsed resource as indexed. 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":"listKnowledgeBaseResourcesV2","parameters":[{"name":"knowledge_base_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Knowledge Base Id"}},{"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":100,"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_KnowledgeBaseFileResponseV2_"}}}},"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-knowledge_base_id-resources.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.
