File to PDF
Send any document, get a PDF back.
Upload a file or point to a URL — converted in under a second.
Word, Excel, PowerPoint, images, HTML, Markdown, and more.
# Upload a file and get a PDF back
curl -X POST https://api.filetopdf.dev/file \
-H "x-api-key: YOUR_API_KEY" \
-F "files=@invoice.docx" \
--output output.pdfSub-second conversion
Most documents convert in under a second — no queues, no waiting.
File upload or URL
Upload a file directly or pass a public URL — we download and convert.
130+ supported formats
Office, images, HTML, Markdown, EPUB, Visio, iWork, and more.
Full PDF control
Page ranges, landscape mode, password protection, PDF/A compliance.
Try it
Drop a file here or click to browse
Any supported document · Max 50 MB
Conversion Parameters
Configure optional conversion parameters.
Documentation
Endpoint
https://api.filetopdf.dev/fileAuthentication
Include your API key in the x-api-key header. CORS is enabled.
Limits
Maximum file size is 30 MB (Starter & Pro) or 50 MB (Scale). Requests exceeding this limit are rejected with a 413 file_too_large error.
Parameters
All parameters are form fields sent as multipart/form-data. The conversion engine is auto-detected from the file extension.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| files | file | Required | — | The document to convert. One file per request. |
| pdfa | enum | Optional | — | Archive-ready PDF format. Mutually exclusive with encryption. |
| landscape | boolean | Optional | false | Rotate the output to landscape orientation. |
| nativePageRanges | string | Optional | — | Restrict output to specific pages (e.g. '1-5', '1,3,5'). Pages are counted from 1. |
| losslessImageCompression | boolean | Optional | false | Use PNG (lossless) compression for images in the PDF instead of JPEG (lossy). Best for diagrams and line art. |
| quality | integer (1–100) | Optional | 90 | JPEG compression quality for embedded images. Lower = smaller file, higher = better image quality. |
| reduceImageResolution | boolean | Optional | false | Downsample images to maxImageResolution. Reduces file size. |
| maxImageResolution | integer (DPI) | Optional | 300 | Maximum image resolution in DPI when reduceImageResolution is enabled. |
| pdfua | boolean | Optional | false | Apply PDF/UA accessibility post-processing. |
| flatten | boolean | Optional | false | Bake interactive form fields into static content (non-editable output). |
| userPassword | string | Optional | — | Password required to open the PDF. Mutually exclusive with PDF/A. |
| ownerPassword | string | Optional | — | Password controlling PDF permissions (printing, copying, editing). |
| metadata | JSON object | Optional | — | XMP metadata to inject (Author, Title, Subject, Keywords, etc.). Writing metadata breaks PDF/A compliance. |
| password | string | Optional | — | Password to open a password-protected source document (.docx, .xlsx, etc.). |
| singlePageSheets | boolean | Optional | false | Force each spreadsheet sheet to fit on one PDF page, scaling content as needed. Overrides the user's print-area settings. |
| exportFormFields | boolean | Optional | true | When true, form fields remain interactive in the PDF. Set to false to flatten them into static content for archival. |
| exportNotes | boolean | Optional | false | Include document comments/annotations in the PDF output. Useful for review workflows. |
| exportNotesPages | boolean | Optional | false | Export Impress/PowerPoint speaker notes as 'notes pages' (slide thumbnail + notes). Ideal for presenter handouts. |
| exportHiddenSlides | boolean | Optional | false | Include slides marked as hidden in Impress/PowerPoint presentations in the PDF output. |
| skipEmptyPages | boolean | Optional | false | Suppress auto-inserted blank pages added for odd/even page numbering in double-sided printing. Saves space in digital-only PDFs. |
| nativeWatermarkText | string | Optional | — | Render a centered text watermark behind content on every page (e.g. 'DRAFT', 'CONFIDENTIAL'). |
| addOriginalDocumentAsStream | boolean | Optional | false | Embed the original source document as an attachment inside the PDF. Useful for PDF/A archival with editable source preservation. |
| displayPDFDocumentTitle | boolean | Optional | false | Show the document's title metadata in the PDF viewer title bar instead of the filename. |
Supported formats
Response
Every endpoint supports two response formats. Choose the one that fits your integration.
Default Raw PDF binary
The response body is the PDF file itself. Pipe it straight to disk, return it to a client, or stream it to storage.
| Header | Value |
|---|---|
| X-Request-Id | Unique request identifier |
| Content-Type | application/pdf |
| Content-Disposition | attachment; filename="filename.pdf" |
| Content-Length | PDF file size in bytes |
| X-Page-Count | Number of pages in the PDF |
| X-Credits-Used | Conversions consumed (always 1) |
| X-Credits-Remaining | Conversions left in your cycle |
| X-Processing-Time | Server-side processing time (e.g. 1320ms) |
Optional JSON with base64-encoded PDF
Add Accept: application/json to your request headers. The response body becomes a JSON object — useful for serverless functions, browser-based integrations, or pipelines where you need structured metadata alongside the PDF.
{
"status": "success",
"data": {
"pdf": "JVBERi0xLjQgMSAwIG9i... (base64)",
"filename": "invoice.pdf",
"pages": 3,
"size_bytes": 184320,
"credits_used": 1,
"credits_remaining": 49
}
}X-Request-Id and X-Processing-Time headers are still present on JSON responses.
| Field | Type | Description |
|---|---|---|
| status | string | Always "success" on 200. |
| data.pdf | string | Base64-encoded PDF binary. Decode and write to file, or embed as a data URI. |
| data.filename | string | Suggested filename for the converted PDF. |
| data.pages | number | Total page count of the generated PDF. |
| data.size_bytes | number | Size of the PDF file in bytes. |
| data.credits_used | number | Number of credits consumed (always 1). |
| data.credits_remaining | number | Credits left in your billing cycle after this conversion. |
Errors
All errors return JSON with error.code and error.message fields.
{
"status": "error",
"error": {
"code": "missing_input",
"message": "Missing input. Upload a file in the 'files' field, or provide a 'url' field."
}
}| Status | Code | Description |
|---|---|---|
| 400 | missing_input | No file uploaded and no url field provided. |
| 400 | invalid_content_type | Request is not multipart/form-data or application/json. |
| 400 | invalid_url | The url field is malformed or uses an unsupported protocol. |
| 400 | unsupported_format | File extension is not supported for PDF conversion. |
| 400 | parse_error | Could not parse the multipart request body. |
| 401 | missing_api_key | No x-api-key header or Authorization token provided. |
| 401 | invalid_token | The provided Firebase Auth token is invalid or expired. |
| 402 | payment_required | Insufficient credits. Top up or upgrade your plan. |
| 402 | subscription_required | No active subscription found on the workspace. |
| 403 | forbidden | Invalid API key, or user is not a member of the workspace. |
| 403 | forbidden_url | The url points to a private/internal network address. |
| 405 | method_not_allowed | Request method is not POST. |
| 408 | conversion_timeout | Conversion or file download exceeded the time limit. |
| 413 | file_too_large | File exceeds your plan's size limit (30 MB or 50 MB). |
| 422 | conversion_failed | The document could not be converted to PDF. |
| 422 | download_failed | Could not download the file from the provided URL. |
| 429 | concurrency_limit | Too many concurrent requests for your plan. |
| 500 | internal_error | Unexpected server error. Retry or contact support. |
| 503 | service_unavailable | The conversion service is temporarily unavailable. |