Skip to content
pdfconversionapi

DOC to TXT API

Send a Word 97-2003 file to POST /v2/convert/doc/to/txt and get its body text as one UTF-8 file with CRLF line endings, one paragraph per line. The sample agreement gave 822 bytes of text.

Endpoint
POST /v2/convert/doc/to/txt
Accepts
doc
Sample timing
22 ms median of 5 runsHow we measure
Request size
Up to 10 MB on the Free plan or 100 MB on paid plans, all files together

Request and response

Every sample below ran against the API before this page was published. Set PDFCONVERSIONAPI_KEY to your key and run it as is.

curl -sS -X POST \
  https://api.pdfconversionapi.com/v2/convert/doc/to/txt \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@loan-agreement.doc \
  -o response.json

# FileData is base64. Save the first file in converted/,
# or print the JSON error.
if jq -e '.Files' response.json > /dev/null; then
  mkdir -p converted
  name=$(jq -r '.Files[0].FileName' response.json)
  jq -r '.Files[0].FileData' response.json \
    | base64 --decode > "converted/$name"
else
  cat response.json
fi
200 OK22 ms median1 file, 822 bytes
{
  "ConversionCost": 1,
  "ConversionTime": 0.022,
  "Files": [
    {
      "FileName": "loan-agreement.txt",
      "FileExt": "txt",
      "FileSize": 822,
      "FileData": "DQpFcXVpcG1lbnQgbG9hbiBh…"
    }
  ]
}

Response from our test run on 2026-11-03. ConversionTime shows the median of 5 runs. FileData is shortened here; the real response carries the whole file as base64.

The sample, converted

The same file the code sends. Download the input and the output and compare them yourself.

loan-agreement.txt, 20 lines

Equipment loan agreement1. PartiesThis agreement is between the Westpoint Harbor Sailing Club (the club) and the member named in section 4 (the borrower). Club rules are posted at example.org/club-rules.2. Equipment on loanItem	Serial number	Deposit (USD)Life jacket, adult	LJ-0412	40.00Dinghy mainsail, 6.9 m²	DS-117	150.00Hand-held VHF radio	VHF-08	90.00Total deposit		280.003. Conditions1.	Rinse all equipment in fresh water before you return it.2.	Report any tear, crack or water in a radio within 24 hours.3.	The deposit is refunded within 10 days of the return.Never leave a radio in a boat overnight.4. SignaturesBy signing, the borrower accepts the conditions in section 3.Borrower	______________________	Date	____________Dockmaster	______________________	Date	____________
Input
loan-agreement.doc (26 KB)
Output
loan-agreement.txt (822 bytes)
Source
A two-page equipment loan agreement for a fictional sailing club, written for this site and saved in the Word 97-2003 format, with a shaded table, a footnote, a picture and page-numbered footers. (CC0-1.0). How it was made
Made by
2026-11-04, API build 9eeeb0640aba

Parameters

Send these as form fields next to the file. Names are case-insensitive. If you set one of the documented options below that we don't support yet, the request fails with a 400 that names it instead of returning a file made without it.

ParameterWhat it does
UpdateFieldsboolean, default falseRefresh fields, such as a stale table of contents, before the text is taken. The sample has none in its body, so the text is the same.
IncludeMarkupboolean, default falseAdd the document's comments at the end under a "Comments" line, numbered [1], [2] with author and quoted anchor text. The sample has no comments.
FileNamestringBase name of the text file; the default is the uploaded name with .txt.
StoreFileboolean, default falseSend back a link to the text file instead of the text. The link expires after 3 hours.

Not supported yet

Setting one of these to anything but its default returns 400.

OptionWhat to do instead
LineEndingLines always end in CRLF, ConvertAPI's default; crlf is accepted and lf, cr or lfcr return 400.
SaveFormatOutput is always UTF-8 (unicodetext); wintext and the DOS formats return 400.
InsertLineBreaksOnly true is accepted. Paragraphs are not wrapped at a page width either way.
AllowSubstitutionsOnly false is accepted.

What carries over, and what doesn't

Kept

  • Every body paragraph in order, one per line, ending in CRLF
  • Table rows, one per line with cells separated by tabs ("Life jacket, adult", tab, "LJ-0412", tab, "40.00"); empty cells keep their tab
  • List numbers as text: "1.", "2.", "3.", each followed by a tab
  • Headings as plain lines, numbering included ("1. Parties")
  • Non-ASCII characters as UTF-8, such as the ² in "6.9 m²"; no byte order mark
  • The empty paragraph before section 4, as a blank line

Lost or not yet supported

  • The footnote, the page header and the footer.
  • The picture. Its paragraph leaves the file starting with an empty line.
  • The link target: the text "example.org/club-rules" stays, the URL behind it does not.
  • All formatting, bold and the red underline included.

Limits

  • Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
  • 120 seconds per conversion, then 504.
  • Protected .doc files: 422 "the input file is password-protected" when Password is missing, and 400 "password-protected DOC files can't be converted to TXT yet" when it is right. Password does nothing for a file without one.

Where teams use it

Search indexing of an old document archive

Text is what a search engine needs. Pull the words out of each .doc once and index them, without keeping a Word reader on the indexing servers.

Checking contract terms in code

Find clauses, amounts or dates with a regular expression. Each numbered condition in the sample is its own line, such as "3." followed by a tab and the sentence.

Questions

Can I get LF line endings?

Not from the API yet: LineEnding=lf returns 400 rather than giving you CRLF silently. Convert the endings after download, for example with text.replace("\r\n", "\n") in Python.

Is the output UTF-8 or Windows-1252?

UTF-8 without a byte order mark. SaveFormat=wintext is refused for now, so code that expects Windows-1252 should decode the file as UTF-8 and re-encode it.

Why does the file start with an empty line?

The sample's first paragraph holds only the club's picture. The picture is dropped and its paragraph stays, as a blank line. Strip leading blank lines if they get in your way.

Are long paragraphs wrapped?

No. Each paragraph is one line, however long, so the sentence that names the club and the borrower is a single 169-character line. Wrap it yourself if you need a fixed width.

Convert your first DOC file in a minute.