API reference
Run HazeFix from your code.
Submit an image to the full de-haze, flatten, 4× upscale, quantise and SVG trace pipeline. Create a job, poll its status, then download the files through three REST endpoints.
https://api.hazefix.comThis is the only supported origin — there is no same-origin fallback. The web Studio talks to it too, via a signed-in session cookie instead of a bearer key.
Authentication
Pass your key as a bearer token on every request. Create keys from your account dashboard — the full secret is shown once, on creation. Keys are metered at $0.03 per completed image on the API plan; failed jobs are never billed.
Authorization: Bearer hzfx_live_…Create a job
POST/api/v1/jobs
Send the image as multipart/form-data. Returns 202 Accepted immediately. Processing time varies with image dimensions, preset, queue load and whether the GPU pass is enabled; poll the job endpoint instead of assuming a fixed duration.
imageThe image to fix — PNG, JPEG or WebP, up to 24 MB.
presetOne of logo, clipart (default), illustration, lineart. Sets the palette size and export defaults.
kPalette-size override. Leave it unset to use the preset value.
upscaleRun the illustration-tuned 4× GPU upscale (stage C).
svgTrace an editable SVG from the reduced-palette result (stage E).
curl -s https://api.hazefix.com/api/v1/jobs \ -H "Authorization: Bearer $HAZEFIX_API_KEY" \ -F "image=@./input.png" \ -F "preset=clipart" \ -F "upscale=true" \ -F "svg=true"
{ "id": "9f2b1c4e-6a1d-4c3b-9e7f-2d8a5b1c4e6f", "object": "job", "status": "processing", "created_at": "2026-07-12T14:31:07.412Z", "preset": "clipart", "options": { "k": 24, "upscale": true, "svg": true }, "warnings": [], "error": null, "result": null}
Poll a job
GET/api/v1/jobs/:id
Poll every second or two until status is done or error. Finished jobs include before/after output metrics and per-stage timings for monitoring or automated checks. The values below illustrate the response shape; actual metrics and timings come from each job.
curl -s https://api.hazefix.com/api/v1/jobs/$JOB_ID \ -H "Authorization: Bearer $HAZEFIX_API_KEY"
{ "id": "9f2b1c4e-6a1d-4c3b-9e7f-2d8a5b1c4e6f", "object": "job", "status": "done", "preset": "clipart", "options": { "k": 24, "upscale": true, "svg": true }, "warnings": [], "error": null, "result": { "metrics": { "before": { "size": "1024x1536", "unique_colors": 77914, "black_point": 9.4, "white_point": 250.6 }, "after": { "size": "4096x6144", "unique_colors": 32, "black_point": 0.0, "white_point": 255.0 } }, "timings": { "t_dehaze_flatten_s": 0.9, "t_upscale_s": 12.4, "t_quantize_s": 4.1, "t_svg_s": 3.8 }, "files": { "png": "/api/v1/jobs/9f2b1c4e-…/files/img1_final.png", "svg": "/api/v1/jobs/9f2b1c4e-…/files/img1_final.svg" } }}
Download output
GET/api/v1/jobs/:id/files/:name
File names come from result.files on the job. Outputs are retained for 24 hours on Free and 30 days on the API plan. Pro is not currently available.
# stream the PNG (add ?download=1 for a Content-Disposition attachment)curl -sL "https://api.hazefix.com/api/v1/jobs/$JOB_ID/files/img1_final.png" \ -H "Authorization: Bearer $HAZEFIX_API_KEY" -o fixed.pngcurl -sL "https://api.hazefix.com/api/v1/jobs/$JOB_ID/files/img1_final.svg" \ -H "Authorization: Bearer $HAZEFIX_API_KEY" -o fixed.svg
Presets
| PRESET | K | BEST FOR |
|---|---|---|
| logo | 12 | Few bold colours, SVG-first |
| clipart | 24 | Transparent PNG + SVG, POD-ready |
| illustration | 48 | Richer palette, poster-grade |
| lineart | 2 | Pure black & white line art |
Errors
Errors return a JSON body of the shape { error: { code, message } }.
| STATUS | CODE | MEANING |
|---|---|---|
| 400 | invalid_request | Malformed body, unknown preset, or k outside 2–64. |
| 401 | unauthorized | Missing or invalid API key. |
| 404 | not_found | Unknown job id or output file. |
| 413 | too_large | Image exceeds 24 MB. |
| 415 | unsupported_type | Input must be png, jpeg or webp. |
| 429 | rate_limited | Monthly plan quota exceeded — see /pricing for current plan availability. |
| 500 | processing_failed | The pipeline failed on this input — you are not billed. |
Rate limits
Every request — bearer key or session cookie — is metered against your account’s monthly quota (10 images on Free; API usage is metered). Going over returns 429 rate_limited. The API plan is uncapped and metered per image, with volume pricing at 10,000+ images a month.