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

# Upload document

> Upload a document for AI chat context



## OpenAPI

````yaml openapi.json post /api/v1/documents
openapi: 3.0.0
info:
  description: Dualship backend API for workflow automation and API management.
  title: Dualship API
  termsOfService: https://dualship.run/terms
  contact:
    name: Dualship Support
    url: https://dualship.run/support
    email: support@dualship.run
  version: '1.0'
servers:
  - url: https://api.dualship.run
security: []
paths:
  /api/v1/documents:
    post:
      tags:
        - documents
      summary: Upload document
      description: Upload a document for AI chat context
      parameters:
        - description: Workspace ID
          name: X-Workspace-Id
          in: header
          required: true
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  description: Document file
                  type: string
                  format: binary
              required:
                - file
        required: true
      responses:
        '201':
          description: Document uploaded successfully
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_dualship_dualship-be_internal_storage_postgres.Document
        '400':
          description: Invalid request or unsupported file type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api_handler.BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api_handler.UnauthorizedError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api_handler.InternalServerError'
        '503':
          description: Document service not configured
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/internal_api_handler.ServiceUnavailableError
      security:
        - BearerAuth: []
components:
  schemas:
    github_com_dualship_dualship-be_internal_storage_postgres.Document:
      type: object
      properties:
        createdAt:
          type: string
        fileName:
          type: string
        fileSizeBytes:
          type: integer
        fileType:
          type: string
        id:
          type: string
        organizationID:
          type: string
        parseError:
          type: string
        parseStatus:
          $ref: >-
            #/components/schemas/github_com_dualship_dualship-be_internal_storage_postgres.DocumentParseStatus
        parsedContent:
          type: string
        s3Key:
          type: string
        tensorlakeFileID:
          type: string
        tensorlakeParseID:
          type: string
        tokenCount:
          type: integer
        updatedAt:
          type: string
        uploadedBy:
          type: string
    internal_api_handler.BadRequestError:
      description: Bad request error
      type: object
      properties:
        code:
          type: string
          example: BAD_REQUEST
        error:
          type: string
          example: invalid request parameters
    internal_api_handler.UnauthorizedError:
      description: Unauthorized error
      type: object
      properties:
        code:
          type: string
          example: UNAUTHORIZED
        error:
          type: string
          example: unauthorized
    internal_api_handler.InternalServerError:
      description: Internal server error
      type: object
      properties:
        code:
          type: string
          example: INTERNAL_ERROR
        error:
          type: string
          example: internal server error
    internal_api_handler.ServiceUnavailableError:
      description: Service unavailable error
      type: object
      properties:
        code:
          type: string
          example: SERVICE_UNAVAILABLE
        error:
          type: string
          example: service unavailable
    github_com_dualship_dualship-be_internal_storage_postgres.DocumentParseStatus:
      type: string
      enum:
        - pending
        - parsing
        - completed
        - failed
      x-enum-varnames:
        - DocumentParseStatusPending
        - DocumentParseStatusParsing
        - DocumentParseStatusCompleted
        - DocumentParseStatusFailed
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Bearer token authentication

````