Dify Knowledge Tags API

Operations for managing knowledge base tags and tag bindings. 7 operation(s) from the Dify Service API.

Operations 7

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /datasets/tags Create a knowledge base tag · Create Knowledge Tag #
Ask an LLM
“How do I create a new tag for grouping knowledge bases?”
“Do knowledge tag names need to be unique across the workspace?”
Tell an agent
Create a knowledge tag named {name}.
Add a new workspace tag {name} for organizing knowledge bases.
GET /datasets/tags List all knowledge base tags · List Knowledge Tags #
Ask an LLM
“Which tags exist for organizing knowledge bases in my workspace?”
“What tag IDs can I use to filter knowledge bases?”
Tell an agent
List every knowledge base tag in the workspace.
Show me all available knowledge tags and their IDs.
PATCH /datasets/tags Rename a knowledge base tag · Update Knowledge Tag #
Ask an LLM
“Can I rename a knowledge tag without re-tagging every knowledge base?”
“What is the way to fix a typo in a tag's name?”
Tell an agent
Rename knowledge tag {tag_id} to {name}.
Change the name of tag {tag_id} to {name}.
DELETE /datasets/tags Delete a knowledge base tag · Delete Knowledge Tag #
Ask an LLM
“Are tagged knowledge bases deleted when I delete the tag itself?”
“Can I permanently remove a tag I no longer use?”
Tell an agent destructive · confirm first
Delete knowledge tag {tag_id}.
Permanently remove the tag {tag_id} from the workspace.
POST /datasets/tags/binding Attach tags to a knowledge base · Create Tag Binding #
Ask an LLM
“How do I tag a knowledge base with one or more tags?”
“What happens if I bind a tag ID that does not exist?”
Tell an agent
Tag knowledge base {target_id} with tags {tag_ids}.
Bind tags {tag_ids} to knowledge base {target_id}.
POST /datasets/tags/unbinding Remove tags from a knowledge base · Delete Tag Binding #
Ask an LLM
“Can I untag a knowledge base without deleting the tag from the workspace?”
“How do I detach several tags from one knowledge base at once?”
Tell an agent
Remove tags {tag_ids} from knowledge base {target_id}.
Unbind tag {tag_id} from knowledge base {target_id}.
GET /datasets/{dataset_id}/tags Get the tags on one knowledge base · Get Knowledge Base Tags #
Ask an LLM
“Which tags are currently bound to a specific knowledge base?”
“Can I check what a single knowledge base is tagged with?”
Tell an agent
Show the tags on knowledge base {dataset_id}.
List what knowledge base {dataset_id} is tagged with.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/dify:dify-tags-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

dify-tags-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Dify Service Tags API
  description: REST API for Dify applications and knowledge bases. Application endpoints authenticate with an app API key; knowledge endpoints authenticate with a dataset API key.
  version: 1.0.0
servers:
- url: https://{api_base_url}
  description: Base URL of the Dify Service API. For self-hosted deployments, replace it with your own API base URL.
  variables:
    api_base_url:
      default: api.dify.ai/v1
      description: Host and path of the API base URL, without the `https://` prefix.
security:
- ApiKeyAuth: []
tags:
- name: Tags
  description: Operations for managing knowledge base tags and tag bindings.
paths:
  /datasets/tags:
    post:
      tags:
      - Tags
      summary: Create Knowledge Tag
      description: Create a tag for organizing knowledge bases.
      operationId: createKnowledgeTag
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 50
                  description: Tag name. Must be unique within the workspace.
      responses:
        '200':
          description: Tag created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Tag identifier.
                  name:
                    type: string
                    description: Tag display name.
                  type:
                    type: string
                    description: Tag type. Always `knowledge` for knowledge base tags.
                  binding_count:
                    type:
                    - string
                    - 'null'
                    description: Number of knowledge bases bound to this tag.
              examples:
                success:
                  summary: Response Example
                  value:
                    id: f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d
                    name: Product Docs
                    type: knowledge
                    binding_count: '0'
        '400':
          description: '`invalid_param` : A knowledge tag with the same name already exists.'
          content:
            application/json:
              examples:
                invalid_param:
                  summary: invalid_param
                  value:
                    status: 400
                    code: invalid_param
                    message: Tag name already exists
      x-mint:
        href: /en/api-reference/tags/create-knowledge-tag
        metadata:
          title: Create Knowledge Tag
          sidebarTitle: Create Knowledge Tag
    get:
      tags:
      - Tags
      summary: List Knowledge Tags
      description: Returns all knowledge base tags in the workspace.
      operationId: getKnowledgeTags
      responses:
        '200':
          description: List of tags.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Tag identifier.
                    name:
                      type: string
                      description: Tag display name.
                    type:
                      type: string
                      description: Tag type. Always `knowledge` for knowledge base tags.
                    binding_count:
                      type:
                      - string
                      - 'null'
                      description: Number of knowledge bases bound to this tag.
              examples:
                success:
                  summary: Response Example
                  value:
                  - id: f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d
                    name: Product Docs
                    type: knowledge
                    binding_count: '0'
      x-mint:
        href: /en/api-reference/tags/list-knowledge-tags
        metadata:
          title: List Knowledge Tags
          sidebarTitle: List Knowledge Tags
    patch:
      tags:
      - Tags
      summary: Update Knowledge Tag
      description: Rename a knowledge base tag.
      operationId: updateKnowledgeTag
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - tag_id
              - name
              properties:
                tag_id:
                  type: string
                  description: ID of the tag to rename. See [List Knowledge Type Tags](/en/api-reference/tags/list-knowledge-tags).
                name:
                  type: string
                  minLength: 1
                  maxLength: 50
                  description: New name for the tag. Must be unique within the workspace.
      responses:
        '200':
          description: Tag updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Tag identifier.
                  name:
                    type: string
                    description: Tag display name.
                  type:
                    type: string
                    description: Tag type. Always `knowledge` for knowledge base tags.
                  binding_count:
                    type:
                    - string
                    - 'null'
                    description: Number of knowledge bases bound to this tag.
              examples:
                success:
                  summary: Response Example
                  value:
                    id: f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d
                    name: Product Docs
                    type: knowledge
                    binding_count: '0'
        '400':
          description: '`invalid_param` : A knowledge tag with the same name already exists.'
          content:
            application/json:
              examples:
                invalid_param:
                  summary: invalid_param
                  value:
                    status: 400
                    code: invalid_param
                    message: Tag name already exists
        '404':
          description: '`not_found` : The specified tag does not exist.'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Tag not found
      x-mint:
        href: /en/api-reference/tags/update-knowledge-tag
        metadata:
          title: Update Knowledge Tag
          sidebarTitle: Update Knowledge Tag
    delete:
      tags:
      - Tags
      summary: Delete Knowledge Tag
      description: Permanently delete a knowledge base tag. Does not delete the knowledge bases that were tagged.
      operationId: deleteKnowledgeTag
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - tag_id
              properties:
                tag_id:
                  type: string
                  description: ID of the tag to delete. See [List Knowledge Type Tags](/en/api-reference/tags/list-knowledge-tags).
      responses:
        '204':
          description: Success.
        '404':
          description: '`not_found` : The specified tag does not exist.'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Tag not found
      x-mint:
        href: /en/api-reference/tags/delete-knowledge-tag
        metadata:
          title: Delete Knowledge Tag
          sidebarTitle: Delete Knowledge Tag
  /datasets/tags/binding:
    post:
      tags:
      - Tags
      summary: Create Tag Binding
      description: Bind one or more tags to a knowledge base. A knowledge base can have multiple tags.
      operationId: bindTagsToDataset
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - tag_ids
              - target_id
              properties:
                tag_ids:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  description: IDs of the tags to bind. See [List Knowledge Type Tags](/en/api-reference/tags/list-knowledge-tags). Unknown tag IDs are silently ignored.
                target_id:
                  type: string
                  description: Knowledge base to bind the tags to. See [List Knowledge Bases](/en/api-reference/knowledge-bases/list-knowledge-bases).
      responses:
        '204':
          description: Success.
        '404':
          description: '`not_found` : The target knowledge base does not exist.'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Dataset not found
      x-mint:
        href: /en/api-reference/tags/create-tag-binding
        metadata:
          title: Create Tag Binding
          sidebarTitle: Create Tag Binding
  /datasets/tags/unbinding:
    post:
      tags:
      - Tags
      summary: Delete Tag Binding
      description: Remove one or more tags from a knowledge base.
      operationId: unbindTagFromDataset
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - target_id
              properties:
                tag_ids:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  description: Tag IDs to unbind. Required unless the legacy `tag_id` is provided. See [List Knowledge Type Tags](/en/api-reference/tags/list-knowledge-tags).
                tag_id:
                  type: string
                  deprecated: true
                  description: Legacy single-tag form. Normalized into `tag_ids` server-side. Use `tag_ids` for new integrations.
                target_id:
                  type: string
                  description: Knowledge base to unbind the tags from. See [List Knowledge Bases](/en/api-reference/knowledge-bases/list-knowledge-bases).
      responses:
        '204':
          description: Success.
        '404':
          description: '`not_found` : The target knowledge base does not exist.'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Dataset not found
      x-mint:
        href: /en/api-reference/tags/delete-tag-binding
        metadata:
          title: Delete Tag Binding
          sidebarTitle: Delete Tag Binding
  /datasets/{dataset_id}/tags:
    get:
      tags:
      - Tags
      summary: Get Knowledge Base Tags
      description: Returns the tags bound to a knowledge base.
      operationId: queryDatasetTags
      parameters:
      - name: dataset_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: Knowledge base ID. See [List Knowledge Bases](/en/api-reference/knowledge-bases/list-knowledge-bases).
      responses:
        '200':
          description: Tags bound to the knowledge base.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: List of tags bound to this knowledge base.
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Tag identifier.
                        name:
                          type: string
                          description: Tag display name.
                  total:
                    type: integer
                    description: Total number of tags bound to this knowledge base.
              examples:
                success:
                  summary: Response Example
                  value:
                    data:
                    - id: f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d
                      name: Product Docs
                    total: 1
        '403':
          description: '`forbidden` : Dataset api access is not enabled.'
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden (api access)
                  value:
                    status: 403
                    code: forbidden
                    message: Dataset api access is not enabled.
        '404':
          description: '`not_found` : Dataset not found.'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Dataset not found.
      x-mint:
        href: /en/api-reference/tags/get-knowledge-base-tags
        metadata:
          title: Get Knowledge Base Tags
          sidebarTitle: Get Knowledge Base Tags
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: 'Every request authenticates with an API key: `Authorization: Bearer {API_KEY}`. App endpoints take an app API key; knowledge endpoints take a knowledge base API key ([Get Started](/en/api-reference/guides/get-started)).


        Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP `401` (`unauthorized`).'