Skip to content

File conversion API

Word to Markdown API

Use Word to Markdown from your code: send the file and get the Markdown back.

At a glance

Takes
DOCX or ODT
Makes
Markdown
Costs
1 credit per file; nothing with a test key, nothing when it fails
Files
One a job
File size
Up to 1 MB with a test key; 100 MB on Free, up to 5 GB on API Scale; this conversion takes up to 25 MB
Engine
Markdown conversion (Workers AI)

Convert a file

Send the file to POST /v1/convert, naming the conversion, with an API key from the dashboard. The answer is the Markdown.

curl "https://api.formatjet.com/v1/convert?conversion=word-to-markdown" \
  -H "Authorization: Bearer $FORMATJET_API_KEY" \
  -F file=@input.docx \
  -o output.md
TypeScript
import { readFile, writeFile } from 'node:fs/promises';

const form = new FormData();
form.append('file', new Blob([await readFile('input.docx')]), 'input.docx');

const response = await fetch('https://api.formatjet.com/v1/convert?conversion=word-to-markdown', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.FORMATJET_API_KEY}` },
  body: form,
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);

await writeFile('output.md', new Uint8Array(await response.arrayBuffer()));
Python
import os

import requests

files = {"file": open("input.docx", "rb")}
response = requests.post(
    "https://api.formatjet.com/v1/convert",
    params={"conversion": "word-to-markdown"},
    headers={"Authorization": f"Bearer {os.environ['FORMATJET_API_KEY']}"},
    files=files,
    timeout=60,
)
response.raise_for_status()

with open("output.md", "wb") as file:
    file.write(response.content)

The quickstart makes a test key and runs a request like this one. Requests take up to 25 MB; for larger files, files at a URL or a webhook when it’s done, make a job.