SynthFlux API

Version 0.2.0 (build 0.2.0.11). Base URL https://synthflux.synthetixmind.com. Download openapi.json

Authentication

Every request to /v1/ needs an API Key in the X-API-Key header. Result Links are the only exception. A key in the URL is rejected with key_in_url. Errors always come back as JSON with code, message and request_id, also when you asked for an image.

curl -X POST 'https://synthflux.synthetixmind.com/v1/transform' -H 'X-API-Key: sf_YOUR_KEY' -F '[email protected]' -o photo.webp

Transform

POST/v1/transform

Convert, crop, resize and optimize one image. Upload one Source Image as multipart/form-data in the field file. Parameters go in the query string or as form fields. Operations always run in this order: auto-rotate, crop, resize, convert, optimize. By default the answer is the image itself; Responsive Sets and Placeholders answer with JSON. Requests above the Async Threshold run as a Job (HTTP 202).

Needs an API Key in the X-API-Key header.

ParameterTypeDefaultAllowed valuesDescription
filebinaryrequiredone fileThe Source Image (multipart field file).
formatstringwebpwebp, avif, originalOutput format. original keeps JPEG, PNG or SVG (minified).
qualitystringmediumlow, medium, high, 1-100Strength of lossy compression.
ratiostringnoneW:H, 1-100 eachCrop to the largest area of this aspect ratio, e.g. 16:9.
focusstringcentercenter, point, detailCrop Focus: the middle, a point (x, y) or the most detailed area.
xinteger500-100Horizontal focus point in percent (focus=point).
yinteger500-100Vertical focus point in percent (focus=point).
widthintegernone1-16384Target width in pixels.
heightintegernone1-16384Target height in pixels.
fitstringcontaincontain, cover, fillWith width and height: fit inside, fill and crop, or stretch.
upscalebooleanfalsetrue, falseAllow output larger than the source.
keep_exifbooleanfalsetrue, falseKeep EXIF data (orientation set to normal). Default removes EXIF, XMP, IPTC and GPS.
widthsstringnone2-10 widths, comma-separatedResponsive Set: one output per width; widths above the source are listed as skipped.
placeholderstringnoneblurhash, tinyAdds a BlurHash string or a 32 px WebP data URI; the answer is JSON.
presetstringnonea Preset nameApplies a stored Preset; parameters in the request override it.
responsestringbinarybinary, jsonjson returns metadata and a Result Link instead of the image.
webhook_urlstringnonehttps URL, public hostCalled once when a Job ends (requests above the Async Threshold).

Responses

  • 200 (image/webp): The Output Image, with X-SynthFlux-Source-Bytes, -Output-Bytes, -Saved-Percent, -Width, -Height (and -Passthrough when the source came back unchanged).
  • 200 (application/json): JSON with format, width, height, byte counts, saved_percent and a Result Link (response=json, widths, placeholder).
  • 202 (application/json): JSON with job_id: the request runs as a Job.

Errors

HTTPCodeWhen
400key_in_urlAn API Key was sent in the query string.
401invalid_keyNo API Key, or an unknown one.
403key_disabledThe API Key is disabled.
403key_expiredThe API Key is past its expiry date.
429rate_limitedThe key's Rate Limit is used up; Retry-After gives the seconds to wait.
429quota_exceededThe key's Monthly Quota is used up; it resets on the 1st at 00:00 UTC.
500internalAn unexpected server error; quote request_id.
400invalid_parameterA parameter is unknown or out of range; the message names it.
400preset_not_foundNo Preset has that name.
400format_not_supportedformat=original for GIF, WebP, TIFF, BMP, AVIF or HEIC sources.
400animation_not_supportedAVIF output was requested for an animated image.
400webhook_url_not_allowedwebhook_url is not https or resolves to a loopback, private or link-local address.
400file_missingThe request has no file, or a batch has fewer than 2 or more than 50 files.
413file_too_largeOne file is larger than the file size limit (default 25 MB).
413request_too_largeThe whole request is larger than the maximum request size (default 95 MB; 1 MB = 1,048,576 bytes). Requests above about 100 MB are refused by the CDN in front of this instance with its own HTML 413 page, before they reach SynthFlux.
415unsupported_formatThe file is not JPEG, PNG, GIF, WebP, TIFF, BMP, AVIF, HEIC/HEIF or SVG.
422invalid_imageThe file can't be decoded (for example truncated).
422image_too_largeThe image has more pixels than the pixel limit (default 50 megapixels).

Example

curl -X POST 'https://synthflux.synthetixmind.com/v1/transform?ratio=16:9&width=1920' -H 'X-API-Key: sf_YOUR_KEY' -F '[email protected]' -o photo.webp

Example response

HTTP/1.1 200 OK
Content-Type: image/webp
X-SynthFlux-Source-Bytes: 6291456
X-SynthFlux-Output-Bytes: 317440
X-SynthFlux-Saved-Percent: 95
X-SynthFlux-Width: 1920
X-SynthFlux-Height: 1080

<binary WebP>

Batch

POST/v1/batch

Process 2 to 50 images with one parameter set. Upload 2 to 50 files in the multipart field files (repeat the field). The answer is JSON with one Result Link to a ZIP that holds the Output Images and report.json. Failed files are listed in the report; the request fails only when every file fails. Batches above the Async Threshold (default 50 MB) run as a Job.

Needs an API Key in the X-API-Key header.

ParameterTypeDefaultAllowed valuesDescription
filesbinaryrequired2-50 filesSource Images (multipart field files, repeated).
formatstringwebpwebp, avif, originalOutput format. original keeps JPEG, PNG or SVG (minified).
qualitystringmediumlow, medium, high, 1-100Strength of lossy compression.
ratiostringnoneW:H, 1-100 eachCrop to the largest area of this aspect ratio, e.g. 16:9.
focusstringcentercenter, point, detailCrop Focus: the middle, a point (x, y) or the most detailed area.
xinteger500-100Horizontal focus point in percent (focus=point).
yinteger500-100Vertical focus point in percent (focus=point).
widthintegernone1-16384Target width in pixels.
heightintegernone1-16384Target height in pixels.
fitstringcontaincontain, cover, fillWith width and height: fit inside, fill and crop, or stretch.
upscalebooleanfalsetrue, falseAllow output larger than the source.
keep_exifbooleanfalsetrue, falseKeep EXIF data (orientation set to normal). Default removes EXIF, XMP, IPTC and GPS.
presetstringnonea Preset nameApplies a stored Preset; parameters in the request override it.
webhook_urlstringnonehttps URL, public hostCalled once when a Job ends (requests above the Async Threshold).

Responses

  • 200 (application/json): JSON with url, expires_at, files, done, failed, byte counts and report.
  • 202 (application/json): JSON with job_id: the batch runs as a Job.

Errors

HTTPCodeWhen
400key_in_urlAn API Key was sent in the query string.
401invalid_keyNo API Key, or an unknown one.
403key_disabledThe API Key is disabled.
403key_expiredThe API Key is past its expiry date.
429rate_limitedThe key's Rate Limit is used up; Retry-After gives the seconds to wait.
429quota_exceededThe key's Monthly Quota is used up; it resets on the 1st at 00:00 UTC.
500internalAn unexpected server error; quote request_id.
400invalid_parameterA parameter is unknown or out of range; the message names it.
400preset_not_foundNo Preset has that name.
400webhook_url_not_allowedwebhook_url is not https or resolves to a loopback, private or link-local address.
400file_missingThe request has no file, or a batch has fewer than 2 or more than 50 files.
413file_too_largeOne file is larger than the file size limit (default 25 MB).
413request_too_largeThe whole request is larger than the maximum request size (default 95 MB; 1 MB = 1,048,576 bytes). Requests above about 100 MB are refused by the CDN in front of this instance with its own HTML 413 page, before they reach SynthFlux.
422all_files_failedEvery file of a batch failed; report lists the reason per file.

Example

curl -X POST 'https://synthflux.synthetixmind.com/v1/batch?preset=thumb' -H 'X-API-Key: sf_YOUR_KEY' -F '[email protected]' -F '[email protected]'

Example response

{"url":"https://synthflux.synthetixmind.com/v1/results/Tq3...","expires_at":"2026-12-02T13:00:00.000Z","files":2,"done":2,"failed":0,"source_bytes":4194304,"output_bytes":524288,"saved_percent":87.5,"report":[...]}

Jobs

GET/v1/jobs/{job_id}

Read the status of a Job. Status queued, processing, done (with result) or failed (with error_code). Only the API Key that created the Job can read it; other keys get 404.

Needs an API Key in the X-API-Key header.

ParameterTypeDefaultAllowed valuesDescription
job_idstringrequiredUUIDFrom the HTTP 202 answer.

Responses

  • 200 (application/json): JSON with job_id, status, created_at, updated_at, result or error_code.

Errors

HTTPCodeWhen
400key_in_urlAn API Key was sent in the query string.
401invalid_keyNo API Key, or an unknown one.
403key_disabledThe API Key is disabled.
403key_expiredThe API Key is past its expiry date.
429rate_limitedThe key's Rate Limit is used up; Retry-After gives the seconds to wait.
429quota_exceededThe key's Monthly Quota is used up; it resets on the 1st at 00:00 UTC.
500internalAn unexpected server error; quote request_id.
404not_foundUnknown route, Job or Result Link.

Example

curl 'https://synthflux.synthetixmind.com/v1/jobs/3f2b8c1e-5d4a-4b6f-9e1c-7a8d9b0c1d2e' -H 'X-API-Key: sf_YOUR_KEY'

Example response

{"job_id":"3f2b8c1e-5d4a-4b6f-9e1c-7a8d9b0c1d2e","status":"done","result":{"url":"https://synthflux.synthetixmind.com/v1/results/Tq3..."}}

Health

GET/health

Readiness. 200 when the instance accepts requests, 503 while it starts or stops. No API Key needed.

No API Key needed.

Responses

  • 200 (application/json): {"status":"ok"}
  • 503 (application/json): {"status":"starting"}

Example

curl https://synthflux.synthetixmind.com/health

Example response

{"status":"ok"}

Limits and retention

File size limit
25 MB
Pixel limit
50 megapixels
Maximum total request size
95 MB
Retention Time
60 minutes
Async Threshold
50 MB

Files are deleted when the response is sent. Files behind Result Links are deleted no later than 5 minutes after the Retention Time.

Webhooks

Requests above the Async Threshold run as a Job (HTTP 202 with job_id). With webhook_url (https, public host), SynthFlux sends one POST when the Job ends: {"job_id", "status", "result_url" or "error_code"}. If the call doesn't answer 2xx within 10 seconds, it is retried after 1, 5 and 15 minutes, then stops.

The header X-SynthFlux-Signature holds the lowercase hex HMAC-SHA256 of the raw body, keyed with your API Key value. Check it before you trust the call:

import { createHmac, timingSafeEqual } from "node:crypto";

function isFromSynthFlux(rawBody, signatureHeader, apiKey) {
  const expected = createHmac("sha256", apiKey).update(rawBody).digest("hex");
  return expected.length === signatureHeader.length
    && timingSafeEqual(Buffer.from(expected), Buffer.from(signatureHeader));
}

Error codes

HTTPCodeWhen
400key_in_urlAn API Key was sent in the query string.
400invalid_parameterA parameter is unknown or out of range; the message names it.
400preset_not_foundNo Preset has that name.
400format_not_supportedformat=original for GIF, WebP, TIFF, BMP, AVIF or HEIC sources.
400animation_not_supportedAVIF output was requested for an animated image.
400webhook_url_not_allowedwebhook_url is not https or resolves to a loopback, private or link-local address.
400file_missingThe request has no file, or a batch has fewer than 2 or more than 50 files.
401invalid_keyNo API Key, or an unknown one.
403key_disabledThe API Key is disabled.
403key_expiredThe API Key is past its expiry date.
404not_foundUnknown route, Job or Result Link.
410goneThe Result Link's Retention Time has ended.
413file_too_largeOne file is larger than the file size limit (default 25 MB).
413request_too_largeThe whole request is larger than the maximum request size (default 95 MB; 1 MB = 1,048,576 bytes). Requests above about 100 MB are refused by the CDN in front of this instance with its own HTML 413 page, before they reach SynthFlux.
415unsupported_formatThe file is not JPEG, PNG, GIF, WebP, TIFF, BMP, AVIF, HEIC/HEIF or SVG.
422invalid_imageThe file can't be decoded (for example truncated).
422image_too_largeThe image has more pixels than the pixel limit (default 50 megapixels).
422all_files_failedEvery file of a batch failed; report lists the reason per file.
429rate_limitedThe key's Rate Limit is used up; Retry-After gives the seconds to wait.
429quota_exceededThe key's Monthly Quota is used up; it resets on the 1st at 00:00 UTC.
500internalAn unexpected server error; quote request_id.
503busyThe server is starting or shutting down; retry shortly.

Transform parameters at a glance

format, quality, ratio, focus, x, y, width, height, fit, upscale, keep_exif, widths, placeholder, preset, response, webhook_url. Defaults: WebP, quality medium, no crop, no resize, metadata removed, sRGB.