[PR #20023] Add APIs for Knowledge Base Tag Management and Dataset Binding #29294

Closed
opened 2026-02-21 20:45:16 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/20023

State: closed
Merged: Yes


Key Changes:

This pull request introduces a comprehensive set of API endpoints for managing "Knowledge Base Type Tags" and their association with datasets (knowledge bases). This functionality allows users to organize, categorize, and retrieve their knowledge bases more effectively.

New API Endpoints:

  1. Tag Management:

    • POST /datasets/tags: Create New Knowledge Base Type Tag
      • Allows for the creation of a new tag.
      • Request body requires name (the new tag name).
    • GET /datasets/tags: Get Knowledge Base Type Tags
      • Retrieves a list of all defined knowledge base type tags.
    • PATCH /datasets/tags: Modify Knowledge Base Type Tag Name
      • Updates the name of an existing tag.
      • Request body requires tag_id (ID of the tag to modify) and name (the new tag name).
    • DELETE /datasets/tags: Delete Knowledge Base Type Tag
      • Removes an existing tag.
      • Request body requires tag_id (ID of the tag to delete).
  2. Tag-Dataset Binding:

    • POST /datasets/tags/binding: Bind Dataset to Knowledge Base Type Tag
      • Associates one or more tags with a specific dataset.
      • Request body requires tag_ids (list of tag IDs) and target_id (dataset ID).
    • POST /datasets/tags/unbinding: Unbind Dataset and Knowledge Base Type Tag
      • Removes the association between a specific dataset and a specific tag.
      • Request body requires tag_id (tag ID) and target_id (dataset ID).
    • POST /datasets/<uuid:dataset_id>/tags: Query Tags Bound to a Dataset
      • Retrieves a list of all tags currently bound to the specified dataset.
      • Path parameter includes dataset_id (dataset ID).

fix: #19674

Screenshots

image
image
image

docs:
image

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/20023 **State:** closed **Merged:** Yes --- **Key Changes:** This pull request introduces a comprehensive set of API endpoints for managing "Knowledge Base Type Tags" and their association with datasets (knowledge bases). This functionality allows users to organize, categorize, and retrieve their knowledge bases more effectively. **New API Endpoints:** 1. **Tag Management:** * `POST /datasets/tags`: **Create New Knowledge Base Type Tag** * Allows for the creation of a new tag. * Request body requires `name` (the new tag name). * `GET /datasets/tags`: **Get Knowledge Base Type Tags** * Retrieves a list of all defined knowledge base type tags. * `PATCH /datasets/tags`: **Modify Knowledge Base Type Tag Name** * Updates the name of an existing tag. * Request body requires `tag_id` (ID of the tag to modify) and `name` (the new tag name). * `DELETE /datasets/tags`: **Delete Knowledge Base Type Tag** * Removes an existing tag. * Request body requires `tag_id` (ID of the tag to delete). 2. **Tag-Dataset Binding:** * `POST /datasets/tags/binding`: **Bind Dataset to Knowledge Base Type Tag** * Associates one or more tags with a specific dataset. * Request body requires `tag_ids` (list of tag IDs) and `target_id` (dataset ID). * `POST /datasets/tags/unbinding`: **Unbind Dataset and Knowledge Base Type Tag** * Removes the association between a specific dataset and a specific tag. * Request body requires `tag_id` (tag ID) and `target_id` (dataset ID). * `POST /datasets/<uuid:dataset_id>/tags`: **Query Tags Bound to a Dataset** * Retrieves a list of all tags currently bound to the specified dataset. * Path parameter includes `dataset_id` (dataset ID). fix: #19674 # Screenshots ![image](https://github.com/user-attachments/assets/0d333702-41e1-4859-8d99-7a060350469f) ![image](https://github.com/user-attachments/assets/ab8ef1d5-1387-4789-aa7c-358e6a4c64e2) ![image](https://github.com/user-attachments/assets/aa9c391a-2395-4b68-b905-1505a077057b) docs: ![image](https://github.com/user-attachments/assets/b60d6241-3e12-49f9-9c98-d42ec7fa960e) # Checklist > [!IMPORTANT] > Please review the checklist below before submitting your pull request. - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:45:16 -05:00
yindo closed this issue 2026-02-21 20:45:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#29294