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

# Upload Document



## OpenAPI

````yaml /openapi/document.yaml post /api/v1/documents
openapi: 3.1.0
info:
  title: Document Service
  description: Centralised document management system.
  version: 1.0.0
servers:
  - url: https://api.diginacape.co.ke/documents
    description: Production
security: []
paths:
  /api/v1/documents:
    post:
      tags:
        - Documents
      summary: Upload Document
      operationId: upload_document_api_v1_documents_post
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_document_api_v1_documents_post'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentUploadResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    Body_upload_document_api_v1_documents_post:
      properties:
        file:
          type: string
          format: binary
          title: File
        document_category:
          type: string
          title: Document Category
        resource_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource Type
        resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource Id
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        tags:
          anyOf:
            - type: string
            - type: 'null'
          title: Tags
        is_public:
          type: boolean
          title: Is Public
          default: false
        allowed_departments:
          anyOf:
            - type: string
            - type: 'null'
          title: Allowed Departments
        allowed_users:
          anyOf:
            - type: string
            - type: 'null'
          title: Allowed Users
        allowed_roles:
          anyOf:
            - type: string
            - type: 'null'
          title: Allowed Roles
      type: object
      required:
        - file
        - document_category
      title: Body_upload_document_api_v1_documents_post
    DocumentUploadResponse:
      properties:
        success:
          type: boolean
          title: Success
        message:
          type: string
          title: Message
        data:
          $ref: '#/components/schemas/DocumentResponse'
      type: object
      required:
        - success
        - message
        - data
      title: DocumentUploadResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DocumentResponse:
      properties:
        id:
          type: string
          title: Id
        resource_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource Type
        resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource Id
        document_category:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Category
        uploaded_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Uploaded By
        created_at:
          type: string
          format: date-time
          title: Created At
        status:
          type: string
          title: Status
        uploader:
          anyOf:
            - type: object
            - type: 'null'
          title: Uploader
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        allowed_departments:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Departments
        allowed_users:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Users
        allowed_roles:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Roles
        mediaconvert_job_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Mediaconvert Job Id
        duration_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Duration Seconds
      type: object
      required:
        - id
        - created_at
        - status
      title: DocumentResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````