{"openapi":"3.1.0","info":{"title":"SynthFlux API","version":"0.2.0","description":"Converts, crops, resizes and optimizes images. Files are deleted after the response, or after the Retention Time for Result Links."},"servers":[{"url":"https://synthflux.synthetixmind.com"}],"paths":{"/v1/transform":{"post":{"operationId":"transform","summary":"Convert, crop, resize and optimize one image","description":"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).","tags":["Transform"],"parameters":[{"name":"format","in":"query","required":false,"schema":{"type":"string"},"description":"Output format. original keeps JPEG, PNG or SVG (minified). Default: webp. Allowed: webp, avif, original."},{"name":"quality","in":"query","required":false,"schema":{"type":"string"},"description":"Strength of lossy compression. Default: medium. Allowed: low, medium, high, 1-100."},{"name":"ratio","in":"query","required":false,"schema":{"type":"string"},"description":"Crop to the largest area of this aspect ratio, e.g. 16:9. Default: none. Allowed: W:H, 1-100 each."},{"name":"focus","in":"query","required":false,"schema":{"type":"string"},"description":"Crop Focus: the middle, a point (x, y) or the most detailed area. Default: center. Allowed: center, point, detail."},{"name":"x","in":"query","required":false,"schema":{"type":"integer"},"description":"Horizontal focus point in percent (focus=point). Default: 50. Allowed: 0-100."},{"name":"y","in":"query","required":false,"schema":{"type":"integer"},"description":"Vertical focus point in percent (focus=point). Default: 50. Allowed: 0-100."},{"name":"width","in":"query","required":false,"schema":{"type":"integer"},"description":"Target width in pixels. Default: none. Allowed: 1-16384."},{"name":"height","in":"query","required":false,"schema":{"type":"integer"},"description":"Target height in pixels. Default: none. Allowed: 1-16384."},{"name":"fit","in":"query","required":false,"schema":{"type":"string"},"description":"With width and height: fit inside, fill and crop, or stretch. Default: contain. Allowed: contain, cover, fill."},{"name":"upscale","in":"query","required":false,"schema":{"type":"boolean"},"description":"Allow output larger than the source. Default: false. Allowed: true, false."},{"name":"keep_exif","in":"query","required":false,"schema":{"type":"boolean"},"description":"Keep EXIF data (orientation set to normal). Default removes EXIF, XMP, IPTC and GPS. Default: false. Allowed: true, false."},{"name":"widths","in":"query","required":false,"schema":{"type":"string"},"description":"Responsive Set: one output per width; widths above the source are listed as skipped. Default: none. Allowed: 2-10 widths, comma-separated."},{"name":"placeholder","in":"query","required":false,"schema":{"type":"string"},"description":"Adds a BlurHash string or a 32 px WebP data URI; the answer is JSON. Default: none. Allowed: blurhash, tiny."},{"name":"preset","in":"query","required":false,"schema":{"type":"string"},"description":"Applies a stored Preset; parameters in the request override it. Default: none. Allowed: a Preset name."},{"name":"response","in":"query","required":false,"schema":{"type":"string"},"description":"json returns metadata and a Result Link instead of the image. Default: binary. Allowed: binary, json."},{"name":"webhook_url","in":"query","required":false,"schema":{"type":"string"},"description":"Called once when a Job ends (requests above the Async Threshold). Default: none. Allowed: https URL, public host."}],"responses":{"200":{"description":"The Output Image, with X-SynthFlux-Source-Bytes, -Output-Bytes, -Saved-Percent, -Width, -Height (and -Passthrough when the source came back unchanged). Or: JSON with format, width, height, byte counts, saved_percent and a Result Link (response=json, widths, placeholder).","content":{"image/webp":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"type":"object"}}}},"202":{"description":"JSON with job_id: the request runs as a Job.","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]}}}}}},"/v1/batch":{"post":{"operationId":"batch","summary":"Process 2 to 50 images with one parameter set","description":"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.","tags":["Batch"],"parameters":[{"name":"format","in":"query","required":false,"schema":{"type":"string"},"description":"Output format. original keeps JPEG, PNG or SVG (minified). Default: webp. Allowed: webp, avif, original."},{"name":"quality","in":"query","required":false,"schema":{"type":"string"},"description":"Strength of lossy compression. Default: medium. Allowed: low, medium, high, 1-100."},{"name":"ratio","in":"query","required":false,"schema":{"type":"string"},"description":"Crop to the largest area of this aspect ratio, e.g. 16:9. Default: none. Allowed: W:H, 1-100 each."},{"name":"focus","in":"query","required":false,"schema":{"type":"string"},"description":"Crop Focus: the middle, a point (x, y) or the most detailed area. Default: center. Allowed: center, point, detail."},{"name":"x","in":"query","required":false,"schema":{"type":"integer"},"description":"Horizontal focus point in percent (focus=point). Default: 50. Allowed: 0-100."},{"name":"y","in":"query","required":false,"schema":{"type":"integer"},"description":"Vertical focus point in percent (focus=point). Default: 50. Allowed: 0-100."},{"name":"width","in":"query","required":false,"schema":{"type":"integer"},"description":"Target width in pixels. Default: none. Allowed: 1-16384."},{"name":"height","in":"query","required":false,"schema":{"type":"integer"},"description":"Target height in pixels. Default: none. Allowed: 1-16384."},{"name":"fit","in":"query","required":false,"schema":{"type":"string"},"description":"With width and height: fit inside, fill and crop, or stretch. Default: contain. Allowed: contain, cover, fill."},{"name":"upscale","in":"query","required":false,"schema":{"type":"boolean"},"description":"Allow output larger than the source. Default: false. Allowed: true, false."},{"name":"keep_exif","in":"query","required":false,"schema":{"type":"boolean"},"description":"Keep EXIF data (orientation set to normal). Default removes EXIF, XMP, IPTC and GPS. Default: false. Allowed: true, false."},{"name":"preset","in":"query","required":false,"schema":{"type":"string"},"description":"Applies a stored Preset; parameters in the request override it. Default: none. Allowed: a Preset name."},{"name":"webhook_url","in":"query","required":false,"schema":{"type":"string"},"description":"Called once when a Job ends (requests above the Async Threshold). Default: none. Allowed: https URL, public host."}],"responses":{"200":{"description":"JSON with url, expires_at, files, done, failed, byte counts and report.","content":{"application/json":{"schema":{"type":"object"}}}},"202":{"description":"JSON with job_id: the batch runs as a Job.","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"files":{"type":"array","items":{"type":"string","format":"binary"}}},"required":["files"]}}}}}},"/v1/jobs/{job_id}":{"get":{"operationId":"job","summary":"Read the status of a Job","description":"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.","tags":["Jobs"],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string"},"description":"From the HTTP 202 answer."}],"responses":{"200":{"description":"JSON with job_id, status, created_at, updated_at, result or error_code.","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}]}},"/v1/results/{token}":{"get":{"operationId":"result","summary":"Download a result file","description":"No API Key needed: the random token is the access. Files are kept for the Retention Time (default 1 hour), then the link answers 410 and the file is deleted within 5 minutes.","tags":["Result Links"],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"},"description":"Last part of the Result Link."}],"responses":{"200":{"description":"The file (image or ZIP).","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[]}},"/health":{"get":{"operationId":"health","summary":"Readiness","description":"200 when the instance accepts requests, 503 while it starts or stops. No API Key needed.","tags":["Health"],"parameters":[],"responses":{"200":{"description":"{\"status\":\"ok\"}","content":{"application/json":{"schema":{"type":"object"}}}},"503":{"description":"{\"status\":\"starting\"}","content":{"application/json":{"schema":{"type":"object"}}}}},"security":[]}}},"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"Error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string","enum":["key_in_url","invalid_parameter","preset_not_found","format_not_supported","animation_not_supported","webhook_url_not_allowed","file_missing","invalid_key","key_disabled","key_expired","not_found","gone","file_too_large","request_too_large","unsupported_format","invalid_image","image_too_large","all_files_failed","rate_limited","quota_exceeded","internal","busy"]},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}