Metadata

Create Metadata Field

Create a custom metadata field for annotating documents in the knowledge base with structured information.

post/datasets/{dataset_id}/metadata

Request

  • Base URL
    https://api.dify.ai/v1
  • URL
    https://api.dify.ai/v1/datasets/{dataset_id}/metadata
  • Auth
    HTTP bearer

Path parameters

dataset_idstring uuid required

Knowledge base ID, from List Knowledge Bases. For a scoped key, copy the ID from the Dify URL.

Request body

namestring required

Name for the metadata field. Must be unique among the knowledge base's fields and at most 255 characters.

type'string' | 'number' | 'time' required

string for text values, number for numeric values, time for date/time values.

Response

Metadata field created successfully.

idstring

Metadata field identifier.

namestring

Metadata field name.

typestring

Metadata field type.

Changes

No recorded changes to this operation across all 17 revisions of this API.