生成工具API
生成二维码、网站图标、截图和从URL捕获PDF的端点。某些端点接受JSON而非multipart/form-data -- 请检查每个端点的内容类型。
二维码生成
POST
/api/qr-generate从文本或URL生成二维码图像。发送JSON正文(Content-Type: application/json)。可自定义颜色、大小和纠错级别。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
text | string | Required | 要编码到二维码中的内容(文本、URL、WiFi配置等) |
size | number | Optional | 二维码大小(像素)。默认:300 |
errorCorrection | string | Optional | 纠错级别:"L"(7%)、"M"(15%)、"Q"(25%)、"H"(30%)。默认:"M" |
fgColor | string | Optional | 前景颜色(十六进制,例如:"#000000")。默认:"#000000" |
bgColor | string | Optional | 背景颜色(十六进制,例如:"#ffffff")。默认:"#ffffff" |
Response:
PNG图像bash
curl -X POST https://freefiletools.io/api/qr-generate \
-H "x-api-key: fft_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"text": "https://freefiletools.io",
"size": 400,
"errorCorrection": "H",
"fgColor": "#f97316",
"bgColor": "#ffffff"
}' \
-o qrcode.png网站图标生成
POST
/api/favicon-generate从源图像生成完整的网站图标包。返回包含多种网站图标尺寸(16x16、32x32、48x48等)和ICO文件的ZIP文件。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Required | 源图像文件(推荐PNG、JPG或SVG) |
Response:
包含网站图标文件的ZIP文件bash
curl -X POST https://freefiletools.io/api/favicon-generate \
-H "x-api-key: fft_your_api_key" \
-F "[email protected]" \
-o favicons.zipHTML转图像
POST
/api/html-to-image捕获网页截图。发送JSON正文(Content-Type: application/json)。可自定义视口大小和输出格式。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | 要捕获的URL(必须包含https://) |
format | string | Optional | 输出格式:"png"或"jpg"。默认:"png" |
width | number | Optional | 视口宽度(像素)。默认:1280 |
height | number | Optional | 视口高度(像素)。默认:800 |
Response:
PNG或JPG图像bash
curl -X POST https://freefiletools.io/api/html-to-image \
-H "x-api-key: fft_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"format": "png",
"width": 1440,
"height": 900
}' \
-o screenshot.pngURL转PDF
POST
/api/url-to-pdf将网页转换为PDF文档。发送JSON正文(Content-Type: application/json)。转换前页面会完全渲染。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | 要转换的URL(必须包含https://) |
Response:
PDF文件bash
curl -X POST https://freefiletools.io/api/url-to-pdf \
-H "x-api-key: fft_your_api_key" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}' \
-o page.pdf