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

# Attach a file to the chat

> Upload a PDF, Word, PowerPoint, HTML, Markdown, text, CSV or Excel (.xlsx) file the assistant can read. It becomes a document you own (private to you; not added to the DataHub catalogue) and the response carries the `reference` line to put in your message. A scanned PDF comes back `ocr_required`. Size cap: NLP_API_CHAT_ATTACHMENT_MAX_MB.



## OpenAPI

````yaml post /api/chat/attachments
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/chat/attachments:
    post:
      tags:
        - Chat
      summary: Attach a file to the chat
      description: >-
        Upload a PDF, Word, PowerPoint, HTML, Markdown, text, CSV or Excel
        (.xlsx) file the assistant can read. It becomes a document you own
        (private to you; not added to the DataHub catalogue) and the response
        carries the `reference` line to put in your message. A scanned PDF comes
        back `ocr_required`. Size cap: NLP_API_CHAT_ATTACHMENT_MAX_MB.
      operationId: upload_attachment_api_chat_attachments_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_upload_attachment_api_chat_attachments_post
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatAttachmentResponse'
        '413':
          description: File too large.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: File type not supported, or its contents don't match its extension.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: The file can't be read.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Hourly or daily quota reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    Body_upload_attachment_api_chat_attachments_post:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
          description: The file to attach.
      type: object
      required:
        - file
      title: Body_upload_attachment_api_chat_attachments_post
    ChatAttachmentResponse:
      properties:
        document_id:
          type: string
          format: uuid
          title: Document Id
        filename:
          type: string
          title: Filename
        mime_type:
          type: string
          title: Mime Type
        status:
          type: string
          title: Status
          description: indexed, ocr_required or failed.
        page_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page Count
          description: Pages, slides or sheets.
        chunk_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunk Count
        needs_ocr:
          type: boolean
          title: Needs Ocr
          description: 'Scanned: OCR (with approval) would read it.'
        warning:
          anyOf:
            - type: string
            - type: 'null'
          title: Warning
          description: E.g. a spreadsheet read only in part.
        reference:
          type: string
          title: Reference
          description: >-
            The line to put in the message: '[attachment] <filename> —
            document_id: <uuid> — <status>'.
      type: object
      required:
        - document_id
        - filename
        - mime_type
        - status
        - needs_ocr
        - reference
      title: ChatAttachmentResponse
      description: A file dropped into the chat, now a document the sender owns.
    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
  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.