Endpoint Group: Jobs
Base group: /compress/job
Examples
API_KEY="fast_prod_your_key_here"
JOB_ID="019c56457340753ba9441d7b4e6516a0"
# status
curl -sS "https://api.tools.fast/compress/job/${JOB_ID}" \
-H "X-Fast-Api-Key: ${API_KEY}"
# download
curl -sS "https://api.tools.fast/compress/job/${JOB_ID}/download" \
-H "X-Fast-Api-Key: ${API_KEY}" \
-o "./compressed-output.jpg"
# cancel
curl -sS -X POST "https://api.tools.fast/compress/job/${JOB_ID}/cancel" \
-H "X-Fast-Api-Key: ${API_KEY}"
# delete
curl -sS -X DELETE "https://api.tools.fast/compress/job/${JOB_ID}" \
-H "X-Fast-Api-Key: ${API_KEY}"using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-Fast-Api-Key", "fast_prod_your_key_here");
var jobId = "019c56457340753ba9441d7b4e6516a0";
// status
var status = await http.GetFromJsonAsync<JsonElement>(
$"https://api.tools.fast/compress/job/{jobId}");
// download
var output = await http.GetByteArrayAsync(
$"https://api.tools.fast/compress/job/{jobId}/download");
File.WriteAllBytes("compressed-output.jpg", output);
// cancel
await http.PostAsync($"https://api.tools.fast/compress/job/{jobId}/cancel", null);
// delete
await http.DeleteAsync($"https://api.tools.fast/compress/job/{jobId}");$headers = @{ "X-Fast-Api-Key" = "fast_prod_your_key_here" }
$jobId = "019c56457340753ba9441d7b4e6516a0"
# status
Invoke-RestMethod "https://api.tools.fast/compress/job/$jobId" -Headers $headers
# download
Invoke-RestMethod "https://api.tools.fast/compress/job/$jobId/download" `
-Headers $headers -OutFile "compressed-output.jpg"
# cancel
Invoke-RestMethod -Method Post "https://api.tools.fast/compress/job/$jobId/cancel" `
-Headers $headers
# delete
Invoke-RestMethod -Method Delete "https://api.tools.fast/compress/job/$jobId" `
-Headers $headersEndpoints
GET /compress/job/{id}: get job statusGET /compress/job/{id}/download: download output filePOST /compress/job/{id}/cancel: cancel queued/running jobDELETE /compress/job/{id}: delete completed/failed/canceled jobGET /compress/job/{id}/compare: generate before/after comparison previews
Status response example
{
"id": "019c56457340753ba9441d7b4e6516a0",
"status": "Succeeded",
"format": "jpg",
"progress": {
"percent": 100,
"phase": null
},
"metrics": {
"inputBytes": 10333959,
"outputBytes": 3421187,
"creditCost": 1,
"compressionRatio": 0.33,
"savingsPercent": 66.9
},
"error": null,
"output": {
"fileName": "photo-compressed.jpg",
"contentType": "image/jpeg",
"fileCount": 1
}
}
Job statuses
| Status | Description |
|---|---|
Queued | Job is waiting to be processed |
Running | Job is actively being compressed |
Succeeded | Compression complete, output ready for download |
Failed | Compression failed (check error field) |
Canceled | Job was canceled before completion |
Compare endpoint
GET /compress/job/{id}/compare generates before/after preview images for visual comparison. Returns base64-encoded preview images with size metrics.
{
"beforeImage": "<base64>",
"afterImage": "<base64>",
"originalBytes": 10333959,
"compressedBytes": 3421187,
"beforeMimeType": "image/webp",
"afterMimeType": "image/webp",
"previewWidth": 800,
"previewHeight": 600,
"afterPreviewWidth": 800,
"afterPreviewHeight": 600,
"inputWidth": 4032,
"inputHeight": 3024,
"outputWidth": 4032,
"outputHeight": 3024,
"wasResized": false
}
Errors
See Errors for the full error reference.
| Status | Code | Endpoint | Cause |
|---|---|---|---|
401 | api_key.invalid_or_ip_not_allowed | all | Invalid API key |
403 | jobs.forbidden | all | Job owned by another user |
404 | jobs.not_found | all | Job ID does not exist |
409 | jobs.not_ready | download | Job still processing |
409 | jobs.not_cancellable | cancel | Job already completed/failed |
409 | jobs.not_deletable | delete | Cannot delete queued/running jobs — cancel first |
409 | compare.not_ready | compare | Job not yet succeeded |
410 | jobs.expired | download | Output artifacts cleaned up |
410 | compare.expired | compare | Output artifacts cleaned up |
504 | compare.timeout | compare | Preview generation timed out |
Example -- job not found:
{
"error": "jobs.not_found",
"detail": null
}
Example -- download before job finishes:
{
"error": "jobs.not_ready",
"detail": "Job is still processing or waiting to start."
}