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

# Set document category

> Updates the category metadata of a document. Requires SET_DOCUMENT_CATEGORY permission.



## OpenAPI

````yaml /openapi.json patch /documents/{documentId}
openapi: 3.0.0
info:
  title: Korint Documentation
  description: Korint API Documentation
  version: 1.0.0
  contact: {}
servers: []
security:
  - bearerAuth: []
tags: []
paths:
  /documents/{documentId}:
    patch:
      tags:
        - documents
      summary: Set document category
      description: >-
        Updates the category metadata of a document. Requires
        SET_DOCUMENT_CATEGORY permission.
      operationId: DocumentsController_setDocumentCategory
      parameters:
        - name: documentId
          required: true
          in: path
          description: the document id to patch metadata
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetDocumentCategoryInputBody'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SetDocumentCategoryOutput'
        '400':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: >-
                      #/components/schemas/DuplicateNonDelegatedDocumentTypeErrorDto
              examples:
                DUPLICATE_NON_DELEGATED_DOCUMENT_TYPE:
                  $ref: >-
                    #/components/schemas/DuplicateNonDelegatedDocumentTypeErrorDto
          description: ''
        '403':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ForbiddenErrorDto'
              examples:
                FORBIDDEN:
                  $ref: '#/components/schemas/ForbiddenErrorDto'
          description: ''
        '404':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/DocumentNotFoundErrorDto'
              examples:
                DOCUMENT_NOT_FOUND:
                  $ref: '#/components/schemas/DocumentNotFoundErrorDto'
          description: ''
components:
  schemas:
    SetDocumentCategoryInputBody:
      type: object
      properties:
        category:
          type: string
          description: category of the document
          example: kbis
        aiCorrection:
          description: >-
            AI classification correction context, provided when overriding an AI
            suggestion
          allOf:
            - $ref: '#/components/schemas/AIClassificationCorrectionDto'
      required:
        - category
    SetDocumentCategoryOutput:
      type: object
      properties: {}
    DuplicateNonDelegatedDocumentTypeErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - DUPLICATE_NON_DELEGATED_DOCUMENT_TYPE
        message:
          type: string
          example: 'Duplicate non delegated document type: {documentType}'
        details:
          $ref: '#/components/schemas/DuplicateNonDelegatedDocumentTypeDetailsDto'
      required:
        - code
        - message
        - details
    ForbiddenErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - FORBIDDEN
        message:
          type: string
          example: Forbidden
        details:
          $ref: '#/components/schemas/ForbiddenDetailsDto'
      required:
        - code
        - message
        - details
    DocumentNotFoundErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - DOCUMENT_NOT_FOUND
        message:
          type: string
          example: Document {id} not found ({policyId})
        details:
          $ref: '#/components/schemas/DocumentNotFoundDetailsDto'
      required:
        - code
        - message
        - details
    AIClassificationCorrectionDto:
      type: object
      properties:
        traceId:
          type: string
          description: Trace ID from AI classification for correction logging
        originalCategory:
          type: string
          description: Original AI-suggested category before user override
      required:
        - traceId
        - originalCategory
    DuplicateNonDelegatedDocumentTypeDetailsDto:
      type: object
      properties:
        documentType:
          type: string
      required:
        - documentType
    ForbiddenDetailsDto:
      type: object
      properties:
        message:
          type: string
        documentKey:
          type: string
        userId:
          type: string
        ownerId:
          type: string
      required:
        - message
        - documentKey
        - userId
        - ownerId
    DocumentNotFoundDetailsDto:
      type: object
      properties:
        id:
          type: string
        policyId:
          type: string
      required:
        - id

````