GET
/datasets/{dataset_id}/metadataList Metadata Fields
Returns all metadata fields for the knowledge base, both custom and built-in, with the count of documents using each field.
dataset_idstringrequired
Knowledge base ID, from [List Knowledge Bases](/en/api-reference/knowledge-bases/list-knowledge-bases). For a scoped key, [copy the ID from the Dify URL](/en/api-reference/guides/knowledge#knowledge-base-id).
200Metadata fields for the knowledge base.
built_in_field_enabledbooleanoptional
Whether built-in metadata fields are enabled for this knowledge base.
doc_metadataarray<object>optional
List of metadata field definitions.
403- `forbidden` : Dataset api access is not enabled.
- `forbidden` : The API key is scoped to specific knowledge bases, and this knowledge base is not one of them.
One documented failure
forbiddenDataset api access is not enabled.
forbidden (api access)
404`not_found` : Dataset not found.
One documented failure
not_foundDataset not found.
not_found
Error handling
A 403 is returned: - forbidden : Dataset api access is not enabled.
forbidden: The API key is scoped to specific knowledge bases, and this knowledge base is not one of them. A 404 is returned:not_found: Dataset not found.