인증
모든 프로그래밍 방식의 API 요청에는 인증을 위한 API Key가 필요합니다. 이 페이지에서는 요청 인증 방법을 설명합니다.
x-api-key 헤더
모든 요청의 x-api-key HTTP 헤더에 API Key를 포함하세요. API Key는 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.jpgJavaScript / 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)익명 접근
FreeFileTools 웹사이트는 브라우저 기반 파일 처리를 위해 동일한 API 엔드포인트를 내부적으로 사용합니다. freefiletools.io에서의 브라우저 요청은 익명 접근(API Key 없이)이 가능합니다.
그러나 외부 애플리케이션에서의 프로그래밍 방식 접근에는 API Key가 필요합니다. 브라우저 외부에서 유효한 API Key 없이 보내는 요청은 401 Unauthorized 응답을 받습니다.
오류 응답
API Key가 없거나 유효하지 않습니다
json
{
"error": "Unauthorized",
"message": "Invalid or missing API key. Get your key at freefiletools.io/dashboard/api-keys"
}HTTP 상태: 401
속도 제한 초과
json
{
"error": "Rate limit exceeded",
"message": "You have exceeded the rate limit. Please try again later."
}HTTP 상태: 429
다음 단계
API Key 관리 -- API Key 생성, 재생성 및 보안에 대해 알아보세요.
속도 제한 -- 속도 제한과 처리 방법을 이해하세요.