File Conversion API
A free, open source REST API for file conversion. Convert between image formats, resize, compress, extract text from PDFs, and more โ all in memory, nothing stored on disk.
Overview
All operations happen entirely in memory. Files are processed and returned immediately โ no temporary files are written to disk, and nothing is retained after the response is sent.
Supported Image Formats
PDF Operations
| Operation | Description | Output |
|---|---|---|
| Text extraction | Extract raw text from all pages | JSON |
| Page to images | Render each page as an image | ZIP file |
| Metadata | Page count, author, dimensions, encryption | JSON |
Base URL
https://file-conversion-api-xnhs.onrender.com
All endpoints accept multipart/form-data. JSON responses use application/json. File responses include a Content-Disposition: attachment header.
Authentication
๐ No authentication required. All endpoints are publicly accessible. CORS is enabled for all origins.
File Limits
| Constraint | Value |
|---|---|
| Max file size | 20 MB per request |
| Max image dimension (resize) | 10,000 ร 10,000 px |
| PDF to images DPI | 72 โ 300 DPI |
| Quality range (JPG/WebP) | 1 โ 100 |
โ ๏ธ Converting a large PDF to images at 300 DPI is memory-intensive. For files over 10MB, use 150 DPI or lower.
Rate Limiting
| Endpoint | Limit |
|---|---|
| Image endpoints | 30 requests / minute per IP |
| PDF text / info | 30 requests / minute per IP |
| PDF to images | 10 requests / minute per IP |
Exceeded limits return HTTP 429 with a Retry-After header.
Image Endpoints
Form Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file | File | required | โ | Input image file. |
format | string | optional | png | Output format: png, jpg, webp, gif, bmp, tiff. |
quality | integer | optional | 85 | Compression quality 1โ100 (applies to JPG and WebP only). |
Example Request
curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/image \
-F "file=@photo.png" \
-F "format=webp" \
-F "quality=80" \
--output converted.webp
Returns the converted image file with appropriate Content-Type and Content-Disposition headers.
Form Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file | File | required | โ | Input image. |
width | integer | required | โ | Target width in pixels. |
height | integer | required | โ | Target height in pixels. |
keep_aspect | boolean | optional | true | Preserve aspect ratio (thumbnail mode). If false, stretches to exact dimensions. |
format | string | optional | png | Output format. |
quality | integer | optional | 85 | Quality 1โ100 (JPG/WebP only). |
Response Headers
| Header | Description |
|---|---|
X-Original-Size | Original dimensions, e.g. 1920x1080 |
X-Output-Size | Final dimensions after resizing |
Example Request
curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/image/resize \
-F "file=@photo.jpg" \
-F "width=800" \
-F "height=600" \
-F "keep_aspect=true" \
-F "format=jpg" \
--output resized.jpg
Form Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file | File | required | โ | Input image. |
quality | integer | optional | 60 | Output quality 1โ100. Lower = smaller file. |
format | string | optional | Same as input | Output format (defaults to same as input). |
Response Headers
| Header | Description |
|---|---|
X-Original-Size-Bytes | Input file size in bytes |
X-Compressed-Size-Bytes | Output file size in bytes |
X-Compression-Ratio | Size reduction, e.g. 42.3% |
Example Request
curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/image/compress \
-F "file=@photo.jpg" \
-F "quality=50" \
--output compressed.jpg -v
PDF Endpoints
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
file | File | required | Input PDF file. |
Example Request
curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/pdf/text \
-F "file=@document.pdf"
Example Response
{
"page_count": 3,
"full_text": "Introduction\n\nThis document describes...",
"pages": [
{ "page": 1, "text": "Introduction\n\nThis document describes..." },
{ "page": 2, "text": "Chapter 1: Getting Started..." },
{ "page": 3, "text": "" }
]
}
๐ก Text extraction works only on text-based PDFs. Scanned image PDFs will return empty strings per page โ use OCR software for those.
Form Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file | File | required | โ | Input PDF. |
format | string | optional | png | png or jpg. |
dpi | integer | optional | 150 | Render resolution (72โ300). Higher = sharper but larger files. |
Returns a application/zip file named pdf_pages.zip containing page_1.png, page_2.png, etc.
Example Request
curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/pdf/images \
-F "file=@document.pdf" \
-F "format=png" \
-F "dpi=150" \
--output pages.zip
โ ๏ธ Requires poppler-utils to be installed on the server. Included in the Render deployment via render.yaml.
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
file | File | required | Input PDF. |
Example Request
curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/pdf/info \
-F "file=@document.pdf"
Example Response
{
"page_count": 5,
"encrypted": false,
"file_size_bytes": 204800,
"metadata": {
"title": "Annual Report 2025",
"author": "Jane Doe",
"subject": null,
"creator": "Microsoft Word",
"producer": "Adobe PDF Library",
"creation_date": "D:20250115120000",
"modification_date": "D:20250116090000"
},
"pages": [
{ "page": 1, "width_pt": 595.28, "height_pt": 841.89 },
{ "page": 2, "width_pt": 595.28, "height_pt": 841.89 }
]
}
Utility Endpoints
{
"image_input": ["png", "jpg", "jpeg", "webp", "gif", "bmp", "tiff"],
"image_output": ["png", "jpg", "jpeg", "webp", "gif", "bmp", "tiff"],
"pdf_operations": ["text", "images", "info"]
}
{ "status": "ok" }
Error Codes
| Code | Meaning | Common Cause |
|---|---|---|
| 400 | Bad Request | Unsupported format, invalid quality/DPI, non-PDF file sent to PDF endpoint, corrupt image. |
| 413 | Payload Too Large | File exceeds the 20 MB limit. |
| 429 | Too Many Requests | Rate limit exceeded. |
| 501 | Not Implemented | pdf2image / poppler not installed on the server. |
Error Response Format
{ "detail": "File exceeds 20MB limit." }
Legal & Privacy
Data Retention
No files are ever stored. All processing happens exclusively in RAM. Once the HTTP response is sent, the data is discarded. There are no logs containing file content, and no backups of processed files.
GDPR Compliance
Because no personal data is persisted, this API does not create data retention obligations. However, integrators are responsible for ensuring they have a lawful basis for processing files that may contain personal data belonging to their own users.
Content Responsibility
Users are solely responsible for the legality and copyright status of files submitted to the API. Do not upload files you do not own or have a license to process. The API may not be used to process unlawful content.
Copyright Notice
Text extraction from a PDF does not grant any rights to the extracted content. Copyright remains with the original author. The API is a technical tool โ use it only on content you are authorized to process.
Acceptable Use
Must not be used for bulk automated processing of copyrighted material, malware distribution, or any unlawful purpose. The service reserves the right to block abusive IPs.
License
Source code is released under the MIT License. You are free to self-host, modify, and redistribute.
Self-Hosting
Dependencies
pdf2image (used by POST /convert/pdf/images) requires poppler:
# Ubuntu / Debian
apt-get install -y poppler-utils
# macOS
brew install poppler
Run locally
git clone https://github.com/your-username/file-conversion-api
cd file-conversion-api
pip install -r requirements.txt
uvicorn main:app --reload
Interactive docs at http://localhost:8000/docs
Deploy on Render
The render.yaml automatically installs poppler-utils as a build step. Connect your GitHub repo and Render handles the rest.