API reference/POST /preview

Low-res quick preview

Fast preview that downsamples the input to 256px before processing. Costs nothing against your quota — useful for hover previews and thumbnail grids.

POSThttps://useknockout--api.modal.run/preview

Parameters

Send as multipart/form-data unless noted otherwise.

filerequiredfileImage to process. JPG, PNG, WebP, HEIC. Up to 10 MB and 4096×4096.
formatstringpngOutput format — png (with alpha) or webp.

Request

curl -X POST "https://useknockout--api.modal.run/preview" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file=@cat.jpg" \
  -o out.png

Response

HTTP/1.1 200 OK
content-type: image/png
x-knockout-latency: 64
x-knockout-preview: 1

Errors

401unauthorizedMissing or invalid token.
429rate_limit_exceededSlow down. Retry-After header tells you when.
Every error response also includes a request_id in the JSON body. Quote it when reporting issues.

Notes

  • Free tier: previews don't count toward your 50/mo quota.
  • Paid tier: previews are billed at $0.0005/image (10× cheaper than full /remove).
  • Always use /preview for hover/thumbnail UX. Reserve /remove for the final export.