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

# Classify a document

> Start the enrichment crew, which suggests a summary, tags, glossary terms and a domain.

Nothing is classified automatically: uploads and imports wait for this call. Running it
again replaces the earlier suggestions. Suggestions are applied only when you confirm them.



## OpenAPI

````yaml post /api/documents/{document_id}/enrichment
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/documents/{document_id}/enrichment:
    post:
      tags:
        - Documents
      summary: Classify a document
      description: >-
        Start the enrichment crew, which suggests a summary, tags, glossary
        terms and a domain.


        Nothing is classified automatically: uploads and imports wait for this
        call. Running it

        again replaces the earlier suggestions. Suggestions are applied only
        when you confirm them.
      operationId: classify_document_api_documents__document_id__enrichment_post
      parameters:
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: ID of the document.
            title: Document Id
          description: ID of the document.
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentResponse'
        '403':
          description: You don't have access to this document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No document matches this ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            The document isn't indexed, is private, or is already being
            classified.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    DocumentResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Unique ID for the document.
        filename:
          type: string
          title: Filename
          description: The uploaded file's name.
        owner:
          type: string
          title: Owner
          description: Keycloak username of the person who uploaded the document.
        mime_type:
          type: string
          title: Mime Type
          description: Media type of the uploaded file. For example, `application/pdf`.
        size_bytes:
          type: integer
          title: Size Bytes
          description: Size of the uploaded file in bytes.
        page_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page Count
          description: How many pages the document has.
        chunk_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunk Count
          description: How many text chunks the document produces for search indexing.
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
          description: The document's DataHub subtype, such as Runbook or FAQ.
        status:
          $ref: '#/components/schemas/DocumentStatusEnum'
          description: The document's state in the upload pipeline.
        enrichment_status:
          $ref: '#/components/schemas/DocumentEnrichmentStatusEnum'
          description: The document's state in the enrichment workflow.
        datahub_urn:
          anyOf:
            - type: string
            - type: 'null'
          title: Datahub Urn
          description: URN identifying the document's entity in DataHub.
        extraction_warning:
          anyOf:
            - type: string
            - type: 'null'
          title: Extraction Warning
          description: >-
            A note about incomplete text extraction, such as a scanned PDF with
            no selectable text.
        suggested_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Suggested Summary
          description: AI-generated summary of the document.
        suggested_tags:
          items:
            $ref: '#/components/schemas/SuggestionItem'
          type: array
          title: Suggested Tags
          description: AI-suggested DataHub tags for the document.
        suggested_glossary_terms:
          items:
            $ref: '#/components/schemas/SuggestionItem'
          type: array
          title: Suggested Glossary Terms
          description: AI-suggested DataHub glossary terms for the document.
        suggested_domain:
          anyOf:
            - $ref: '#/components/schemas/SuggestionItem'
            - type: 'null'
          description: AI-suggested DataHub domain for the document.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message when processing the document failed.
        s3_key:
          anyOf:
            - type: string
            - type: 'null'
          title: S3 Key
          description: Storage key of the original file in S3.
      type: object
      required:
        - id
        - filename
        - owner
        - mime_type
        - size_bytes
        - page_count
        - chunk_count
        - subtype
        - status
        - enrichment_status
        - datahub_urn
        - extraction_warning
        - suggested_summary
        - error
        - s3_key
      title: DocumentResponse
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DocumentStatusEnum:
      type: string
      enum:
        - uploading
        - extracting
        - ocr_required
        - indexed
        - failed
      title: DocumentStatusEnum
      description: Lifecycle status of an ingested document.
    DocumentEnrichmentStatusEnum:
      type: string
      enum:
        - pending
        - running
        - awaiting_review
        - confirmed
        - failed
      title: DocumentEnrichmentStatusEnum
      description: Crew-driven enrichment lifecycle.
    SuggestionItem:
      properties:
        name:
          type: string
          title: Name
          description: The suggested tag, glossary term, or domain name.
        is_existing:
          type: boolean
          title: Is Existing
          description: >-
            True when a DataHub tag, glossary term, or domain with this name
            already exists.
          default: false
        urn:
          anyOf:
            - type: string
            - type: 'null'
          title: Urn
          description: >-
            URN of the existing DataHub entity, present only when is_existing is
            true.
      type: object
      required:
        - name
      title: SuggestionItem
      description: A flagged enrichment suggestion for a tag, glossary term, or domain.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````

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