API reference/POST /presets

Presets

Save a reusable bundle of output settings once, then apply it on any processing call with preset=<name>. List with GET /presets, create or update with POST /presets, remove with DELETE /presets/{name}.

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

Parameters

Send as multipart/form-data unless noted otherwise.

namerequiredstring–Preset name, 1 to 64 characters. Saving with an existing name overwrites that preset.
configobject–Stored defaults. Accepted keys: quality, max_dim, width, height, despill, watermark. Unknown keys are dropped. Example: {"max_dim":2048,"quality":90}.

Request

# Save (or overwrite) a preset
curl -X POST "https://useknockout--api.modal.run/presets"   -H "Authorization: Bearer $TOKEN"   -H "Content-Type: application/json"   -d '{"name":"catalog","config":{"max_dim":2048,"quality":90}}'

# Use it
curl -X POST "https://useknockout--api.modal.run/remove"   -H "Authorization: Bearer $TOKEN"   -F "file=@cat.jpg" -F "preset=catalog" -o out.png

# Delete it
curl -X DELETE "https://useknockout--api.modal.run/presets/catalog"   -H "Authorization: Bearer $TOKEN"

Response

HTTP/1.1 200 OK
content-type: application/json

Errors

400bad_request–Missing or too-long name, or a key that is not tied to a user account.
401unauthorized–Missing or invalid token.
402payment_required–Saving presets requires Knockout Plus.
503service_unavailable–Preset storage is temporarily unavailable. Retry.
Every error response also includes a request_id in the JSON body. Quote it when reporting issues.

Notes

  • Three routes: GET /presets lists your presets, POST /presets creates one or overwrites the one with the same name, DELETE /presets/{name} removes one.
  • Apply a preset with preset=<name> on /remove, /remove-url, /replace-bg, /studio-shot, /collage, and /psd. Explicit params always win over stored values.
  • Presets belong to your account, so they need a per-user API key. Saving one requires Knockout Plus; applying one does too.