Custom metadata uploaded via the API Create a Document from Text & Update a Document with Text is not visible on the web. #11848

Closed
opened 2026-02-21 19:04:21 -05:00 by yindo · 1 comment
Owner

Originally created by @hsiong on GitHub (Mar 20, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

v1.1.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Use the API methods Create a Document from Text and Update a Document with Text to update doc_metadata.

curl --request POST 'http://127.0.0.1:5001/v1/datasets/{dataset_id}/document/create-by-text' \
--header 'Authorization: Bearer {API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{"name": "text1",
"text": "text",
"indexing_technique": "high_quality",
"process_rule": {"mode": "automatic"},
"doc_type": "others",
"doc_metadata": {"department/team": "OA",
                 "title": "detail_title",
                 "author": "detail_author",
                 "creation_date": "detail_create_date",
                 "last_modified_date": "detail_update_date",
                 "area": "area"}}'

✔️ Expected Behavior

Custom metadata will appear in the dataset as shown below

Image

Actual Behavior

However, the actual behavior is that I can't see it.

Image

Originally created by @hsiong on GitHub (Mar 20, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version v1.1.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce Use the API methods Create a Document from Text and Update a Document with Text to update doc_metadata. ``` curl --request POST 'http://127.0.0.1:5001/v1/datasets/{dataset_id}/document/create-by-text' \ --header 'Authorization: Bearer {API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{"name": "text1", "text": "text", "indexing_technique": "high_quality", "process_rule": {"mode": "automatic"}, "doc_type": "others", "doc_metadata": {"department/team": "OA", "title": "detail_title", "author": "detail_author", "creation_date": "detail_create_date", "last_modified_date": "detail_update_date", "area": "area"}}' ``` ### ✔️ Expected Behavior Custom metadata will appear in the dataset as shown below ![Image](https://github.com/user-attachments/assets/bca601bc-fa92-4c5f-a566-e092953a4287) ### ❌ Actual Behavior However, the actual behavior is that I can't see it. ![Image](https://github.com/user-attachments/assets/b969296a-736d-4ed9-9614-0a24e3ae8cb0)
yindo added the 🐞 bug label 2026-02-21 19:04:21 -05:00
yindo closed this issue 2026-02-21 19:04:21 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 20, 2025):

Hey @hsiong! I'm here to help you with bugs, questions, and becoming a contributor. Let's work on solving this issue together.

I found a similar open issue related to custom metadata not being visible when creating documents through the API. The suggested solution includes:

  1. Ensure that both doc_type and doc_metadata are provided correctly. If one is provided, both must be present; otherwise, it will raise an InvalidMetadataError.
  2. Make sure that doc_metadata is a dictionary and that the keys and values conform to the expected types defined in the schema for the specified doc_type. If the doc_type is "others", ensure that the metadata does not violate any implicit rules.
  3. There is a known issue in Dify version 1.1.0 where API calls to the metadata endpoint return a 404 error due to an incorrect API endpoint URL. Ensure that the API endpoint is correctly configured in your .env file [1].

These steps might help resolve the issue with metadata visibility in the web interface.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 20, 2025): <!-- Greeting --> Hey @hsiong! I'm here to help you with bugs, questions, and becoming a contributor. Let's work on solving this issue together. <!-- Answer --> I found a similar open issue related to custom metadata not being visible when creating documents through the API. The suggested solution includes: 1. Ensure that both `doc_type` and `doc_metadata` are provided correctly. If one is provided, both must be present; otherwise, it will raise an `InvalidMetadataError`. 2. Make sure that `doc_metadata` is a dictionary and that the keys and values conform to the expected types defined in the schema for the specified `doc_type`. If the `doc_type` is "others", ensure that the metadata does not violate any implicit rules. 3. There is a known issue in Dify version 1.1.0 where API calls to the metadata endpoint return a 404 error due to an incorrect API endpoint URL. Ensure that the API endpoint is correctly configured in your `.env` file <sup>[[1]](https://github.com/langgenius/dify/issues/16242)</sup>. These steps might help resolve the issue with metadata visibility in the web interface. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/3fbf9b64-67ec-447a-8297-d6f1be601a30?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/3fbf9b64-67ec-447a-8297-d6f1be601a30?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/3fbf9b64-67ec-447a-8297-d6f1be601a30?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/3fbf9b64-67ec-447a-8297-d6f1be601a30?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3fbf9b64-67ec-447a-8297-d6f1be601a30?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/3fbf9b64-67ec-447a-8297-d6f1be601a30?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/3fbf9b64-67ec-447a-8297-d6f1be601a30?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#11848