Skip to content

Quickstart

This converts a Word document to PDF in one request. It takes a few minutes and costs nothing: test keys run real conversions for free.

  1. Make a test key. Sign in to the dashboard, open API keys and choose Make a key, with Test as its mode. Copy the key: it’s shown once. Then make it available to your code:

    Terminal window
    export FORMATJET_API_KEY=fj_test_…
  2. Get a file to convert. Any Word document will do, or our sample:

    Terminal window
    curl -O https://formatjet.com/docs/samples/report.docx
  3. Convert it. Send the file to POST /v1/convert with the format you want (to=pdf). The TypeScript and Python use our SDKs: install one first with npm install @formatjet/sdk or pip install formatjet.

    Terminal window
    curl "https://api.formatjet.com/v1/convert?to=pdf" \
    -H "Authorization: Bearer $FORMATJET_API_KEY" \
    -F file=@report.docx \
    -o report.pdf

    The TypeScript runs as it is on Node.js 22.18 or later (node quickstart.ts) or Bun; the Python needs Python 3.11 or later.

  4. Open report.pdf. That’s the converted file.

The API detected that the file is a DOCX from its bytes, ran it through the Word to PDF conversion and answered with the PDF. The answer’s headers say what it did:

Header What it says
FormatJet-Credits Credits charged: 0 with a test key
FormatJet-Engine The engine and its version
FormatJet-Job-Id The job behind the request, which GET /v1/jobs/{id} shows
FormatJet-Request-Id Quote it if you contact us

If something is wrong, the answer is a problem document instead of the file, with a code your code can branch on. With curl, it’s written to report.pdf: open it in a text editor to read it.

  • Test keys take files up to 1 MB and run 100 jobs a day. Make a live key (fj_live_…) to convert larger files on your plan’s credits: limits has the numbers.
  • POST /v1/convert takes files up to 25 MB. For larger files, files at a URL, or to be told when a conversion ends, use jobs.
  • GET /v1/operations lists every conversion with its options; the reference shows the fields.
  • The SDKs also upload larger files, wait for jobs, retry safely and check webhook signatures.