> 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-metadata-schemas.md).

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

## Get Knowledge Base Metadata Schemas

> Get the user and dataloader metadata schemas for a knowledge base.\
> \
> \*\*How to use\*\*\
> \
> Inspect the user and dataloader metadata schema before interpreting file metadata. These metadata descriptions are not the content-search endpoint.\
> \
> \*\*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-getKnowledgeBaseMetadataSchemasV2"}],"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":{"StackAIAPIDataResponse_KnowledgeBaseMetadataSchemasResponseV2_":{"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":{"$ref":"#/components/schemas/KnowledgeBaseMetadataSchemasResponseV2","description":"Data returned by the API service"}},"type":"object","required":["data"],"title":"StackAIAPIDataResponse[KnowledgeBaseMetadataSchemasResponseV2]"},"KnowledgeBaseMetadataSchemasResponseV2":{"properties":{"user":{"anyOf":[{"$ref":"#/components/schemas/MetadataSchemaResponseV2"},{"type":"null"}]},"dataloader":{"anyOf":[{"$ref":"#/components/schemas/MetadataSchemaResponseV2"},{"type":"null"}]}},"type":"object","required":["user","dataloader"],"title":"KnowledgeBaseMetadataSchemas","description":"The user and dataloader metadata schemas for a knowledge base on the public v2 surface."},"MetadataSchemaResponseV2":{"properties":{"properties":{"patternProperties":{"^[^\\t\\n\\r\\f\\v]+$":{"oneOf":[{"$ref":"#/components/schemas/MetadataStringPropertyResponseV2"},{"$ref":"#/components/schemas/MetadataPropertyBaseResponseV2"},{"$ref":"#/components/schemas/MetadataStringListPropertyResponseV2"}],"discriminator":{"propertyName":"type","mapping":{"boolean":"#/components/schemas/MetadataPropertyBaseResponseV2","date":"#/components/schemas/MetadataPropertyBaseResponseV2","number":"#/components/schemas/MetadataPropertyBaseResponseV2","string":"#/components/schemas/MetadataStringPropertyResponseV2","string_list":"#/components/schemas/MetadataStringListPropertyResponseV2"}}}},"propertyNames":{"maxLength":64,"minLength":1},"type":"object","title":"Properties"}},"type":"object","required":["properties"],"title":"MetadataSchema","description":"A metadata schema (user or dataloader) on the public v2 surface."},"MetadataStringPropertyResponseV2":{"properties":{"type":{"type":"string","const":"string","title":"Type","default":"string"},"description":{"type":"string","title":"Description"},"order":{"type":"integer","title":"Order"},"subtype":{"$ref":"#/components/schemas/StringSubtypeEnum"}},"type":"object","required":["description","order","subtype"],"title":"MetadataStringPropertyResponse","description":"A string-valued metadata property on the public v2 surface."},"StringSubtypeEnum":{"type":"string","enum":["plain","email","url","phone","file_path"],"title":"StringSubtypeEnum"},"MetadataPropertyBaseResponseV2":{"properties":{"type":{"type":"string","enum":["number","boolean","date"],"title":"Type"},"description":{"type":"string","title":"Description"},"order":{"type":"integer","title":"Order"}},"type":"object","required":["type","description","order"],"title":"MetadataPropertyResponse","description":"Shared fields for every metadata property on the public v2 surface.\n\nUsed directly for property types that add no extra fields (number, boolean,\ndate); string and string-list subclass it below for their extra fields."},"MetadataStringListPropertyResponseV2":{"properties":{"type":{"type":"string","const":"string_list","title":"Type","default":"string_list"},"description":{"type":"string","title":"Description"},"order":{"type":"integer","title":"Order"},"options":{"items":{"$ref":"#/components/schemas/MetadataStringListOptionResponseV2"},"type":"array","title":"Options"}},"type":"object","required":["description","order","options"],"title":"MetadataStringListPropertyResponse","description":"A string-list-valued metadata property on the public v2 surface."},"MetadataStringListOptionResponseV2":{"properties":{"id":{"type":"string","title":"Id"},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description"},"color":{"$ref":"#/components/schemas/StringListOptionColor"},"order":{"type":"integer","title":"Order"}},"type":"object","required":["id","label","description","color","order"],"title":"MetadataStringListOptionResponse","description":"A selectable option for a string-list metadata property."},"StringListOptionColor":{"type":"string","enum":["red","green","blue","yellow","purple","gray"],"title":"StringListOptionColor","description":"Store the different colors that can be used for the string list options."},"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}/metadata-schemas":{"get":{"tags":["endpoint-getKnowledgeBaseMetadataSchemasV2"],"summary":"Get Knowledge Base Metadata Schemas","description":"Get the user and dataloader metadata schemas for a knowledge base.\n\n**How to use**\n\nInspect the user and dataloader metadata schema before interpreting file metadata. These metadata descriptions are not the content-search endpoint.\n\n**Authentication and permissions**\n\nRequired permissions: `kbs.read`. Resource and owner access checks also apply.","operationId":"getKnowledgeBaseMetadataSchemasV2","parameters":[{"name":"knowledge_base_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Knowledge Base Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StackAIAPIDataResponse_KnowledgeBaseMetadataSchemasResponseV2_"}}}},"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-metadata-schemas.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.
