> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.neetokb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Merge tags

> This API merges tags into one. Articles that carry a secondary tag get the primary tag. The secondary tags are then deleted. If any tag is unknown, nothing is merged. For CLI sessions, this needs the Manage tags permission.


> [!NOTE]
>
> Replace `{your-subdomain}` with your workspace's subdomain. \
> Learn how to find your subdomain in [Workspace subdomain](https://apidocs.neetokb.com/api/workspace-subdomain.md).


## OpenAPI

````yaml bundled/tags.yaml POST /tags/merge
openapi: 3.0.3
info:
  title: NeetoKB Tags API
  description: APIs to list, create, update, delete and merge tags in a workspace.
  version: 1.0.0
servers:
  - description: NeetoKB API
    url: https://{your-subdomain}.neetokb.com/api/external/v2
    variables:
      your-subdomain:
        default: spinkart
        description: >-
          Replace **spinkart** with your [workspace's
          subdomain](/api/workspace-subdomain).
security: []
paths:
  /tags/merge:
    post:
      tags:
        - Tags
      summary: Merge tags
      description: >
        This API merges tags into one. Articles that carry a secondary tag get
        the primary tag. The secondary tags are then deleted. If any tag is
        unknown, nothing is merged. For CLI sessions, this needs the Manage tags
        permission.
      parameters:
        - $ref: '#/components/parameters/api_key_header'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/merge_tags_request'
      responses:
        '200':
          description: >-
            OK - Tags merged. Returns the primary tag with its new article
            count.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tag:
                    $ref: '#/components/schemas/tag'
        '401':
          $ref: '#/components/responses/unauthorized_response'
        '403':
          $ref: '#/components/responses/forbidden_response'
        '404':
          $ref: '#/components/responses/not_found_response'
        '422':
          description: >-
            Unprocessable Entity - `secondary_ids` is empty, or it includes the
            primary tag
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_body'
components:
  parameters:
    api_key_header:
      in: header
      name: X-Api-Key
      description: >-
        Use the X-Api-Key header to provide your workspace API key. Refer to
        [Authentication](/api/authentication) for more information.
      required: true
      schema:
        type: string
        default: your-api-key
  schemas:
    merge_tags_request:
      type: object
      required:
        - primary_id
        - secondary_ids
      properties:
        primary_id:
          type: string
          format: uuid
          description: The tag that stays.
        secondary_ids:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            Tags merged into the primary tag and then deleted. Must not include
            the primary tag.
    tag:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          example: Billing
        description:
          type: string
          nullable: true
        style:
          type: string
          enum:
            - primary
            - secondary
            - info
            - success
            - warning
            - danger
          example: secondary
        articles_count:
          type: integer
          example: 2
    error_body:
      type: object
      properties:
        error:
          type: string
  responses:
    unauthorized_response:
      description: Unauthorized - API key is missing or invalid
    forbidden_response:
      description: >-
        Forbidden - The CLI session does not have the permission this change
        needs
    not_found_response:
      description: Not Found - The record does not exist in this workspace
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Not found.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.