DocsAuthentication

Authentication

All programmatic API requests require an API key for authentication. This page explains how to authenticate your requests.

The x-api-key Header

Include your API key in the x-api-key HTTP header with every request. The API key is a string that starts with fft_.

cURL

bash
curl -X POST https://freefiletools.io/api/image-compress \
  -H "x-api-key: fft_your_api_key_here" \
  -F "[email protected]" \
  -F "quality=80" \
  -o compressed.jpg

JavaScript / fetch

javascript
const formData = new FormData();
formData.append("file", fileInput.files[0]);
formData.append("quality", "80");

const response = await fetch("https://freefiletools.io/api/image-compress", {
  method: "POST",
  headers: {
    "x-api-key": "fft_your_api_key_here",
  },
  body: formData,
});

const blob = await response.blob();

Python

python
import requests

headers = {
    "x-api-key": "fft_your_api_key_here"
}

files = {
    "file": ("image.jpg", open("image.jpg", "rb"), "image/jpeg")
}

data = {
    "quality": "80"
}

response = requests.post(
    "https://freefiletools.io/api/image-compress",
    headers=headers,
    files=files,
    data=data
)

with open("compressed.jpg", "wb") as f:
    f.write(response.content)

Anonymous Access

The FreeFileTools website uses the same API endpoints internally for browser-based file processing. Anonymous access (without an API key) works for browser requests originating from freefiletools.io.

However, programmatic access from external applications requires an API key. Requests without a valid API key from outside the browser will receive a 401 Unauthorized response.

Error Responses

Missing or invalid API key

json
{
  "error": "Unauthorized",
  "message": "Invalid or missing API key. Get your key at freefiletools.io/dashboard/api-keys"
}

HTTP Status: 401

Rate limit exceeded

json
{
  "error": "Rate limit exceeded",
  "message": "You have exceeded the rate limit. Please try again later."
}

HTTP Status: 429

Next Steps

API Key Management -- Learn how to create, regenerate, and secure your API keys.

Rate Limits -- Understand rate limits and how to handle them.