FileToPDF.dev
API

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.

File to PDF
# 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.pdf

Sub-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.

Playground

Try it

Drop a file here or click to browse

Any supported document · Max 50 MB

Conversion Parameters

Configure optional conversion parameters.

Copy request as
Reference

Documentation

Endpoint

POSThttps://api.filetopdf.dev/file

Authentication

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.

FieldTypeRequiredDefaultDescription
filesfileRequiredThe document to convert. One file per request.
pdfaenumOptionalArchive-ready PDF format. Mutually exclusive with encryption.
landscapebooleanOptionalfalseRotate the output to landscape orientation.
nativePageRangesstringOptionalRestrict output to specific pages (e.g. '1-5', '1,3,5'). Pages are counted from 1.
losslessImageCompressionbooleanOptionalfalseUse PNG (lossless) compression for images in the PDF instead of JPEG (lossy). Best for diagrams and line art.
qualityinteger (1–100)Optional90JPEG compression quality for embedded images. Lower = smaller file, higher = better image quality.
reduceImageResolutionbooleanOptionalfalseDownsample images to maxImageResolution. Reduces file size.
maxImageResolutioninteger (DPI)Optional300Maximum image resolution in DPI when reduceImageResolution is enabled.
pdfuabooleanOptionalfalseApply PDF/UA accessibility post-processing.
flattenbooleanOptionalfalseBake interactive form fields into static content (non-editable output).
userPasswordstringOptionalPassword required to open the PDF. Mutually exclusive with PDF/A.
ownerPasswordstringOptionalPassword controlling PDF permissions (printing, copying, editing).
metadataJSON objectOptionalXMP metadata to inject (Author, Title, Subject, Keywords, etc.). Writing metadata breaks PDF/A compliance.
passwordstringOptionalPassword to open a password-protected source document (.docx, .xlsx, etc.).
singlePageSheetsbooleanOptionalfalseForce each spreadsheet sheet to fit on one PDF page, scaling content as needed. Overrides the user's print-area settings.
exportFormFieldsbooleanOptionaltrueWhen true, form fields remain interactive in the PDF. Set to false to flatten them into static content for archival.
exportNotesbooleanOptionalfalseInclude document comments/annotations in the PDF output. Useful for review workflows.
exportNotesPagesbooleanOptionalfalseExport Impress/PowerPoint speaker notes as 'notes pages' (slide thumbnail + notes). Ideal for presenter handouts.
exportHiddenSlidesbooleanOptionalfalseInclude slides marked as hidden in Impress/PowerPoint presentations in the PDF output.
skipEmptyPagesbooleanOptionalfalseSuppress auto-inserted blank pages added for odd/even page numbering in double-sided printing. Saves space in digital-only PDFs.
nativeWatermarkTextstringOptionalRender a centered text watermark behind content on every page (e.g. 'DRAFT', 'CONFIDENTIAL').
addOriginalDocumentAsStreambooleanOptionalfalseEmbed the original source document as an attachment inside the PDF. Useful for PDF/A archival with editable source preservation.
displayPDFDocumentTitlebooleanOptionalfalseShow the document's title metadata in the PDF viewer title bar instead of the filename.

Supported formats

Word (.doc, .docx)Excel (.xls, .xlsx, .csv)PowerPoint (.ppt, .pptx)Images (PNG, JPG, WebP, GIF, BMP, TIFF, PSD)HTMLMarkdownEPUBSVG / EPS / EMFVisio (.vsd, .vsdx)Apple iWork (Pages, Numbers, Keynote)Publisher (.pub)OpenDocument (ODT, ODS, ODP)RTF / TXTPDF passthrough

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.

HeaderValue
X-Request-IdUnique request identifier
Content-Typeapplication/pdf
Content-Dispositionattachment; filename="filename.pdf"
Content-LengthPDF file size in bytes
X-Page-CountNumber of pages in the PDF
X-Credits-UsedConversions consumed (always 1)
X-Credits-RemainingConversions left in your cycle
X-Processing-TimeServer-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.

FieldTypeDescription
statusstringAlways "success" on 200.
data.pdfstringBase64-encoded PDF binary. Decode and write to file, or embed as a data URI.
data.filenamestringSuggested filename for the converted PDF.
data.pagesnumberTotal page count of the generated PDF.
data.size_bytesnumberSize of the PDF file in bytes.
data.credits_usednumberNumber of credits consumed (always 1).
data.credits_remainingnumberCredits 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."
  }
}
StatusCodeDescription
400missing_inputNo file uploaded and no url field provided.
400invalid_content_typeRequest is not multipart/form-data or application/json.
400invalid_urlThe url field is malformed or uses an unsupported protocol.
400unsupported_formatFile extension is not supported for PDF conversion.
400parse_errorCould not parse the multipart request body.
401missing_api_keyNo x-api-key header or Authorization token provided.
401invalid_tokenThe provided Firebase Auth token is invalid or expired.
402payment_requiredInsufficient credits. Top up or upgrade your plan.
402subscription_requiredNo active subscription found on the workspace.
403forbiddenInvalid API key, or user is not a member of the workspace.
403forbidden_urlThe url points to a private/internal network address.
405method_not_allowedRequest method is not POST.
408conversion_timeoutConversion or file download exceeded the time limit.
413file_too_largeFile exceeds your plan's size limit (30 MB or 50 MB).
422conversion_failedThe document could not be converted to PDF.
422download_failedCould not download the file from the provided URL.
429concurrency_limitToo many concurrent requests for your plan.
500internal_errorUnexpected server error. Retry or contact support.
503service_unavailableThe conversion service is temporarily unavailable.