> ## 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.

# Upload a document



## OpenAPI

````yaml post /api/documents
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:
    post:
      tags:
        - Documents
      summary: Upload a document
      operationId: upload_document_api_documents_post
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_document_api_documents_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Content Too Large
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    Body_upload_document_api_documents_post:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
          description: >-
            Document to ingest. Supported formats are ``PDF``, ``DOCX``,
            ``PPTX``, ``MD``, ``TXT``, and ``HTML``.
        confirm_ocr:
          type: boolean
          title: Confirm Ocr
          description: >-
            Set to ``true`` to opt into Optical Character Recognition (OCR) for
            scanned PDFs.
          default: false
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
          description: >-
            DataHub document subtype. Valid values are ``Runbook``, ``FAQ``,
            ``Insight``, ``Definition``, and ``Decision``. Omit or leave empty
            for no subtype, DataHub shows 'None' in the Type dropdown.
      type: object
      required:
        - file
      title: Body_upload_document_api_documents_post
    DocumentResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        filename:
          type: string
          title: Filename
        owner:
          type: string
          title: Owner
        mime_type:
          type: string
          title: Mime Type
        size_bytes:
          type: integer
          title: Size Bytes
        page_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page Count
        chunk_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunk Count
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        status:
          $ref: '#/components/schemas/DocumentStatusEnum'
        enrichment_status:
          $ref: '#/components/schemas/DocumentEnrichmentStatusEnum'
        datahub_urn:
          anyOf:
            - type: string
            - type: 'null'
          title: Datahub Urn
        extraction_warning:
          anyOf:
            - type: string
            - type: 'null'
          title: Extraction Warning
        suggested_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Suggested Summary
        suggested_tags:
          items:
            $ref: '#/components/schemas/SuggestionItem'
          type: array
          title: Suggested Tags
        suggested_glossary_terms:
          items:
            $ref: '#/components/schemas/SuggestionItem'
          type: array
          title: Suggested Glossary Terms
        suggested_domain:
          anyOf:
            - $ref: '#/components/schemas/SuggestionItem'
            - type: 'null'
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        s3_key:
          anyOf:
            - type: string
            - type: 'null'
          title: S3 Key
      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
        is_existing:
          type: boolean
          title: Is Existing
          default: false
        urn:
          anyOf:
            - type: string
            - type: 'null'
          title: Urn
      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

````