Back to Blog

PDF to DOCX and 100+ Other Conversions: REST API or AI Agent?

PDF to DOCX, DOCX to PDF, HEIC to JPG, MOV to MP4: how to run the most common conversions through the FileConvert REST API and through its MCP tools from an AI agent, with a format matrix and the trade-offs of each approach.

PDF to DOCX is the conversion developers search for most, and it is a good lens for a broader question: should your software call a conversion API directly, or should an AI agent call it for you? file-convert.online supports both against the same engine and the same account. Here is how each looks for the common cases, and when to choose one over the other.

The common cases

  • PDF to DOCX, for editing a document that arrived as PDF. Layout fidelity depends on how the PDF was produced; text-based PDFs convert cleanly, scans need OCR first.
  • DOCX to PDF, for delivery and archiving. The most reliable conversion in the catalogue.
  • XLSX to PDF and PPTX to PDF, for sharing spreadsheets and decks as read-only documents.
  • HEIC to JPG and PNG to WebP, for photos from phones and for web performance.
  • MOV to MP4 and MKV to MP4, for videos that have to play everywhere.
  • WAV or M4A to MP3, for recordings headed to transcription or distribution.
  • EPUB to MOBI or AZW3, and DJVU to EPUB, for reading on a different device.

Doing it with the REST API

A PDF to DOCX conversion from your own code is upload, start, poll, download. Formats are addressed by numeric ids from the catalogue endpoint; document formats share format_type_id 4.

FC=https://file-convert.online
KEY="Authorization: Bearer $FC_API_KEY"

# catalogue (cache it): find the ids for pdf and docx
curl -s $FC/api/conversion/v1/file_formats -H "$KEY" | jq '.data[] | select(.extension=="PDF" or .extension=="DOCX") | {id,extension,format_type_id}'

FILE=$(curl -s -X POST $FC/api/file/v1/file -H "$KEY" -F "[email protected]" | jq -r .data.uid)
JOB=$(curl -s -X POST $FC/api/conversion/v1/conversion -H "$KEY" -H "Content-Type: application/json" \
  -d "{\"file_uid\":\"$FILE\",\"format_type_id\":4,\"source_format_id\":<pdf_id>,\"target_format_id\":<docx_id>}" | jq -r .data.uid)
until [ "$(curl -s $FC/api/conversion/v1/conversion/uid/$JOB/status -H "$KEY" | jq -r .data.status)" = Completed ]; do sleep 2; done
OUT=$(curl -s $FC/api/conversion/v1/conversion/uid/$JOB -H "$KEY" | jq -r .data.converted_file_uid)
curl -s -o contract.docx $FC/api/file/v1/file/download/$OUT   # no auth needed: the file id is the capability

The full contract, including retention, history search and key management, is the OpenAPI document at https://file-convert.online/api/mcp/openapi.json. Quickstarts exist for curl, Go and Python.

Doing it with an AI agent

With the MCP server connected to Claude Code, Cursor, VS Code or n8n, the same job is a sentence:

Convert contract.pdf (attached) to DOCX and give me the link.

The agent calls upload_file with the attachment, then start_conversion(file_id, "pdf", "docx"), polls get_job_status and finishes with get_download_url. For a file at a URL it uses convert_file in one call. It never needs the numeric ids: formats are named by extension and the server resolves them, and every extension in the catalogue maps to exactly one category.

Which should you use?

  • Choose the REST API for deterministic pipelines: a nightly job, a webhook handler, a product feature with SLAs. You control retries, logging and where the file lands.
  • Choose the agent when a person is in the loop and the task varies: a support engineer converting whatever the customer sent, a writer producing deliverables, a developer in an editor. The agent handles the variety; the API handles the file.
  • Choose both when you embed an agent in a product: the agent converts during conversations through MCP while your backend manages keys, retention and history through REST.

Format matrix at a glance

Conversions run within a category. The catalogue has six:

  • Document (cost 2 credits): pdf, docx, doc, odt, rtf, txt, xlsx, xls, csv, pptx, ppt.
  • Image (1 credit): png, jpg, webp, gif, heic, svg, tiff, bmp, psd, ico and more.
  • Audio (2 credits): mp3, wav, m4a, flac, aac, ogg, opus and more.
  • Video (5 credits): mp4, mov, mkv, avi, webm, wmv and more.
  • Archive (2 credits): zip, 7z, tar, gz, bz2, xz, rar, iso and more.
  • Ebook (2 credits): epub, mobi, azw3, fb2, djvu, htmlz.

Both surfaces expose the same list through /api/conversion/v1/file_formats and list_formats respectively, so a client can always check before it promises a conversion to a user.

Limits, retention and price

Files up to 200 MiB can be fetched by URL, 25 MiB inline through the MCP upload tool, and larger files through direct multipart upload with the REST API. Results are kept for about an hour by default and up to 14 days on request. Free accounts get 10 credits per day when their balance is empty; plans with monthly allowances and higher per-minute rate limits are on file-convert.online/pricing. Compared with pay-per-minute converters, the credit model makes an agent's spend predictable: it knows what a batch will cost before it starts.

Start

Create an account and a key at file-convert.online/account/api-keys, then either call the REST API from the quickstarts or connect the MCP server with the guide at file-convert.online/blog/add-file-conversion-mcp-server-to-claude-cursor-vscode. The tool and limit reference is at file-convert.online/blog/file-convert-mcp-server-readme.

Ready to Convert Your Files?

Try our free online file converter. No registration required.

Start Converting