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

# Media Upload



## OpenAPI

````yaml post /api/v1/media
openapi: 3.0.0
info:
  title: Libredesk API
  description: >-
    REST API documentation for Libredesk helpdesk system.


    ## Authentication


    The Libredesk API supports two authentication methods:


    ### 1. Basic Authentication

    Use your API key and secret with Basic authentication:

    ```

    Authorization: Basic <base64_encoded_api_key:api_secret>

    ```


    ### 2. Token Authentication  

    Use your API key and secret with token authentication:

    ```

    Authorization: token api_key:api_secret

    ```


    To obtain API credentials, generate them from your agent profile in the
    Libredesk dashboard.
  version: 1.0.0
servers:
  - url: http://localhost:8080
    description: Local development server
security:
  - basicAuth: []
  - tokenAuth: []
paths:
  /api/v1/media:
    post:
      tags:
        - Media
      summary: Media Upload
      operationId: handleMediaUpload
      requestBody:
        description: Media upload
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: string
                  format: binary
                  description: File to upload
                inline:
                  type: string
                  description: >-
                    Set to 'true' to store the file with an inline disposition
                    (e.g. an inline image) instead of as an attachment.
                linked_model:
                  type: string
                  enum:
                    - messages
                  description: Name of the model the uploaded media is linked to.
                  example: messages
              required:
                - files
      responses:
        '200':
          description: Successful media upload response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaResponse'
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      security:
        - basicAuth: []
        - tokenAuth: []
components:
  schemas:
    MediaResponse:
      type: object
      properties:
        status:
          type: string
          example: success
        data:
          $ref: '#/components/schemas/Media'
    Media:
      type: object
      properties:
        id:
          type: integer
          example: 123
        created_at:
          type: string
          format: date-time
          example: '2025-08-28T10:00:00Z'
        updated_at:
          type: string
          format: date-time
          example: '2025-08-28T10:00:00Z'
        uuid:
          type: string
          example: 550e8400-e29b-41d4-a716-446655440000
        store:
          type: string
          example: fs
        filename:
          type: string
          example: example.jpg
        content_type:
          type: string
          example: image/jpeg
        content_id:
          type: string
          example: ''
        model_id:
          type: integer
          nullable: true
          example: 456
        model_type:
          type: string
          nullable: true
          example: messages
        disposition:
          type: string
          nullable: true
          example: attachment
        size:
          type: integer
          example: 102400
        meta:
          type: object
          example:
            width: 800
            height: 600
        url:
          type: string
          example: /uploads/550e8400-e29b-41d4-a716-446655440000
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Basic authentication using base64 encoded API key and secret. Format:
        `Authorization: Basic <base64(api_key:api_secret)>`
    tokenAuth:
      type: apiKey
      name: Authorization
      in: header
      description: >-
        Token authentication using API key and secret. Format: `Authorization:
        token api_key:api_secret`

````