Skip to main content
This endpoint generates custom thumbnails by compositing an overlay image on top of a base image. It’s used for creating social media preview images with branded overlays.

Endpoint

POST /api/thumbnail/generate

Request body

This endpoint accepts multipart form data with the following fields:
overlayId
string
required
The ID of the overlay image to apply. The overlay is fetched from /overlays/{overlayId}.png
flipX
boolean
Whether to horizontally flip the overlay image. Defaults to false
file
file
The base image file to apply the overlay to. Either this or originalThumbnail is required
originalThumbnail
string
URL to fetch the base image from. Either this or file is required

Response

Returns the generated thumbnail as a JPEG image with Content-Type: image/jpg.

Use case

This endpoint is used to generate Open Graph thumbnails for social media sharing. When a link to KommtKevinOnline is shared on platforms like Twitter, Discord, or Facebook, a custom thumbnail with branding overlay is displayed. The overlay is composited on top of the base image (either uploaded or fetched from a URL) and can be flipped horizontally for different layouts.

Example

Request (with file upload)

curl -X POST https://kommtkevinonline.de/api/thumbnail/generate \
  -F "overlayId=default" \
  -F "flipX=false" \
  -F "[email protected]"

Request (with URL)

curl -X POST https://kommtkevinonline.de/api/thumbnail/generate \
  -F "overlayId=default" \
  -F "flipX=true" \
  -F "originalThumbnail=https://example.com/image.jpg"

Response

Returns a JPEG image binary with the overlay applied.

Build docs developers (and LLMs) love