listmonk Media API

The Media API from listmonk — 2 operation(s) for media.

OpenAPI Specification

listmonk-media-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: listmonk Bounces Media API
  description: 'REST API for listmonk, the free and open-source, self-hosted newsletter and mailing-list manager. All endpoints are served by a self-hosted listmonk instance under the /api path and are secured with HTTP Basic auth using an API user and token (or an equivalent `Authorization: token api_user:token` header). There is no hosted SaaS; replace the server host with your own instance.'
  termsOfService: https://listmonk.app
  contact:
    name: listmonk
    url: https://listmonk.app/docs/apis/apis/
  license:
    name: AGPL-3.0
    url: https://github.com/knadh/listmonk/blob/master/LICENSE
  version: '4.1'
servers:
- url: http://localhost:9000/api
  description: Default local self-hosted instance
- url: '{host}/api'
  description: Self-hosted instance
  variables:
    host:
      default: http://localhost:9000
      description: Base URL of your listmonk instance
security:
- BasicAuth: []
- TokenAuth: []
tags:
- name: Media
paths:
  /media:
    get:
      operationId: getMedia
      tags:
      - Media
      summary: Retrieve uploaded media files.
      responses:
        '200':
          description: A list of media files.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaResponse'
    post:
      operationId: uploadMedia
      tags:
      - Media
      summary: Upload a media file.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '200':
          description: The uploaded media file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaResponse'
  /media/{media_id}:
    parameters:
    - name: media_id
      in: path
      required: true
      schema:
        type: integer
    get:
      operationId: getMediaFile
      tags:
      - Media
      summary: Retrieve a specific media file.
      responses:
        '200':
          description: The media file.
    delete:
      operationId: deleteMedia
      tags:
      - Media
      summary: Delete an uploaded media file.
      responses:
        '200':
          description: Deletion result.
components:
  schemas:
    Media:
      type: object
      properties:
        id:
          type: integer
        uuid:
          type: string
        filename:
          type: string
        content_type:
          type: string
        url:
          type: string
        thumb_url:
          type: string
        created_at:
          type: string
          format: date-time
    MediaResponse:
      type: object
      properties:
        data:
          oneOf:
          - $ref: '#/components/schemas/Media'
          - type: array
            items:
              $ref: '#/components/schemas/Media'
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: HTTP Basic auth using an API user name and token (api_user:token).
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Authorization header in the form: token api_user:token.'