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

# Edit Category Name

> Rename a category across all documents.

This endpoint renames a category for all documents that currently have it assigned.
Useful for fixing typos or reorganizing your document categorization system without
manually updating each document.

**Args**:
    `req`: Request body containing old and new category names

**Returns**:
    None (204 No Content on success)

**Raises**:
    - `400`: If the old category doesn't exist or new name is invalid
    - `400`: If the new category name already exists

**Example**:
    **Request**:
    ```
        PATCH /api/v3/documents/categories/edit
        Headers: {"Authorization": "Bearer <api_key>"}
        Body:
        {
            "old_name": "finacial",
            "new_name": "financial"
        }
    ```
    **Response**:
        204 No Content

    **Note**:
        This operation affects all documents with the old category name,
        updating them to use the new category name.



## OpenAPI

````yaml https://api.nugen.in/openapi-public.json patch /api/v3/documents/categories/edit
openapi: 3.1.0
info:
  title: Nugen Intelligence API
  description: 'Nugen Intelligence : Powering Specialized Intelligence At Scale'
  version: 25.4.20
servers: []
security: []
paths:
  /api/v3/documents/categories/edit:
    patch:
      tags:
        - Documents
      summary: Edit Category Name
      description: >-
        Rename a category across all documents.


        This endpoint renames a category for all documents that currently have
        it assigned.

        Useful for fixing typos or reorganizing your document categorization
        system without

        manually updating each document.


        **Args**:
            `req`: Request body containing old and new category names

        **Returns**:
            None (204 No Content on success)

        **Raises**:
            - `400`: If the old category doesn't exist or new name is invalid
            - `400`: If the new category name already exists

        **Example**:
            **Request**:
            ```
                PATCH /api/v3/documents/categories/edit
                Headers: {"Authorization": "Bearer <api_key>"}
                Body:
                {
                    "old_name": "finacial",
                    "new_name": "financial"
                }
            ```
            **Response**:
                204 No Content

            **Note**:
                This operation affects all documents with the old category name,
                updating them to use the new category name.
      operationId: edit_category_name
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditCategoryRequest'
        required: true
      responses:
        '200':
          description: >-
            Returns the updated category across all documents. This endpoint
            updates the name of an existing category for all documents that have
            it assigned, allowing you to fix typos or reorganize your
            categorization system without manually updating each document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EditCategoryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    EditCategoryRequest:
      properties:
        old_name:
          type: string
          title: Old Name
          description: Current category name
          example: customer_support
        new_name:
          type: string
          title: New Name
          description: New category name
          example: customer_service
      type: object
      required:
        - old_name
        - new_name
      title: EditCategoryRequest
      description: Request model for editing category name
    EditCategoryResponse:
      properties:
        old_name:
          type: string
          title: Old Name
          description: Previous category name
          example: customer_support
        new_name:
          type: string
          title: New Name
          description: Updated category name
          example: customer_service
        message:
          type: string
          title: Message
          description: Human-readable confirmation message
      type: object
      required:
        - old_name
        - new_name
        - message
      title: EditCategoryResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````