Browse Docs
On This Page

Getting Started

Base URL

https://api.tools.fast

1) Get an API key

Create a free account — you'll get 500 Pro credits that never expire, no credit card required. Then go to API Keys and create a key. Pass it in the X-Fast-Api-Key header with every request. You can call GET /compress at any time to see available compressors and accepted formats. The CLI wrappers in step 6 read the TOOLS_FAST_API_KEY environment variable. The inline examples below use a local API_KEY shell variable for brevity.

2) Discover supported compressors

Call GET /compress to list all available compressors and their accepted input formats.

3) Compress a file

Submit any supported file to POST /compress — the server detects the format from the file extension:

cURL
API_KEY="fast_prod_your_key_here"

# submit compression
JOB_ID=$(curl -sS -X POST "https://api.tools.fast/compress" \
  -H "X-Fast-Api-Key: $API_KEY" \
  -F "file=@photo.jpg" | jq -r '.id')

echo "Job submitted: $JOB_ID"
C#
using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-Fast-Api-Key", "fast_prod_your_key_here");

using var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("photo.jpg")), "file", "photo.jpg");

var response = await http.PostAsync("https://api.tools.fast/compress", form);
var job = await response.Content.ReadFromJsonAsync<JsonElement>();
var jobId = job.GetProperty("id").GetString();
PowerShell
$headers = @{ "X-Fast-Api-Key" = "fast_prod_your_key_here" }

# submit compression
$job = Invoke-RestMethod -Method Post "https://api.tools.fast/compress" `
  -Headers $headers `
  -Form @{ file = Get-Item "photo.jpg" }

Write-Host "Job submitted: $($job.id)"

4) Poll for completion

cURL
# poll until terminal status
while true; do
  STATUS=$(curl -sS "https://api.tools.fast/compress/job/${JOB_ID}" \
    -H "X-Fast-Api-Key: $API_KEY" | jq -r '.status')
  [ "${STATUS}" = "Succeeded" ] && break
  [ "${STATUS}" = "Failed" ] || [ "${STATUS}" = "Canceled" ] && exit 1
  sleep 1
done
C#
string status;
do
{
    await Task.Delay(1000);
    var poll = await http.GetFromJsonAsync<JsonElement>(
        $"https://api.tools.fast/compress/job/{jobId}");
    status = poll.GetProperty("status").GetString()!;
} while (status is "Queued" or "Running");
PowerShell
# poll until terminal status
do {
  $status = (Invoke-RestMethod "https://api.tools.fast/compress/job/$($job.id)" `
    -Headers $headers).status
  if ($status -in "Failed", "Canceled") { throw "Job $($job.id) $status" }
  Start-Sleep -Seconds 1
} while ($status -ne "Succeeded")

5) Download the result

cURL
curl -sS "https://api.tools.fast/compress/job/${JOB_ID}/download" \
  -H "X-Fast-Api-Key: $API_KEY" \
  -o "photo-compressed.jpg"
C#
var output = await http.GetByteArrayAsync(
    $"https://api.tools.fast/compress/job/{jobId}/download");
File.WriteAllBytes("photo-compressed.jpg", output);
PowerShell
Invoke-RestMethod "https://api.tools.fast/compress/job/$($job.id)/download" `
  -Headers $headers -OutFile "photo-compressed.jpg"

6) CLI wrappers

For quick scripts or LLM agent use, our CLI wrappers handle submit, poll, and download in a single command.

cURL
curl -fsSL https://compress.fast/compress.fast.sh -o compress.fast.sh && chmod +x compress.fast.sh
export TOOLS_FAST_API_KEY="fast_prod_your_key_here"

./compress.fast.sh photo.jpg
./compress.fast.sh document.pdf
./compress.fast.sh report.docx
PowerShell
Invoke-RestMethod "https://compress.fast/compress.fast.ps1" -OutFile compress.fast.ps1
$env:TOOLS_FAST_API_KEY = "fast_prod_your_key_here"

./compress.fast.ps1 photo.jpg
./compress.fast.ps1 document.pdf
./compress.fast.ps1 report.docx
Copied.