Skip to content
pdfconversionapi

LOG to TXT API

POST /v2/convert/log/to/txt rewrites a log as plain text with the line endings and character set you choose. Left at the defaults, every line ends in CRLF and the text is UTF-8, so the 23-line sample grows from 2,126 to 2,149 bytes.

Endpoint
POST /v2/convert/log/to/txt
Accepts
log
Sample timing
under 1 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/log/to/txt \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@invoice-worker.log \
  -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 OKunder 1 ms median1 file, 2.1 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0,
  "Files": [
    {
      "FileName": "invoice-worker.txt",
      "FileExt": "txt",
      "FileSize": 2149,
      "FileData": "MjAyNi0xMS0wMVQwMjowMDow…"
    }
  ]
}

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.

invoice-worker.txt, 23 lines

2026-11-01T02:00:00.014Z INFO  worker[2381] starting invoice-worker 4.12.0 (build 7f3c2a1)2026-11-01T02:00:00.220Z INFO  worker[2381] connected to queue invoices.pending (prefetch=20)2026-11-01T02:00:00.231Z DEBUG worker[2381] template cache warmed: 6 templates, 1.8 MB2026-11-01T02:00:01.507Z INFO  invoice inv_8812 rendered in 412 ms (3 pages, account=acct_1093)2026-11-01T02:00:01.611Z INFO  invoice inv_8812 sent to billing@example.com (message id 4f1e9c)2026-11-01T02:00:01.913Z WARN  invoice inv_8813 currency EUR has no tax table for region=PT; using the default rate of 23.0%2026-11-01T02:00:02.288Z INFO  invoice inv_8813 rendered in 377 ms (2 pages, account=acct_2240)2026-11-01T02:00:02.402Z INFO  invoice inv_8814 rendered in 455 ms (4 pages, account=acct_0871)2026-11-01T02:00:02.519Z INFO  event {"type":"invoice.sent","id":"inv_8814","account":"acct_0871","to":"accounts@example.org","total":"€1,240.00","due":"2026-12-01","attachments":["inv_8814.pdf","usage-october.csv"]}2026-11-01T02:00:03.140Z INFO  invoice inv_8815 rendered in 398 ms (2 pages, account=acct_3317)2026-11-01T02:00:03.702Z INFO  invoice inv_8816 rendered in 421 ms (3 pages, account=acct_1402)2026-11-01T02:00:04.881Z ERROR invoice inv_8817 failed: render timeout after 30000 ms    at RenderPool.acquire (render/pool.js:88:13)    at async renderInvoice (render/invoice.js:41:5)    at async Worker.handle (worker.js:117:9)2026-11-01T02:00:04.882Z INFO  invoice inv_8817 requeued (attempt 2 of 5, delay=60s)2026-11-01T02:00:05.004Z WARN  render pool at 8/8 workers; 14 jobs waiting2026-11-01T02:00:09.377Z INFO  render pool back to 5/8 workers; 0 jobs waiting2026-11-01T02:01:04.903Z INFO  invoice inv_8817 rendered in 2911 ms (12 pages, account=acct_0099)2026-11-01T02:01:05.020Z INFO  invoice inv_8817 sent to finance@example.net (message id 7a02d4)2026-11-01T02:01:05.110Z INFO  batch done: 6 invoices sent, 1 retried, 0 failed, 58.9 s2026-11-01T02:01:05.111Z INFO  worker[2381] idle; next poll in 30 s# This log is a sample file written for pdfconversionapi.com. The service, accounts and addresses are fictional.
Input
invoice-worker.log (2.1 KB)
Output
invoice-worker.txt (2.1 KB)
Source
A log from a fictional invoice service, written by us: 23 lines with a stack trace and a long JSON line (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
LineEndingenum, default crlfWhat ends each line. crlf is ConvertAPI's default and adds one byte per line to a Unix log (23 in the sample). lf returned a byte-for-byte copy of the sample. A value outside the list returns 400 "LineEnding must be one of: crlf, cr, lfcr, lf".Values: crlf, lf, cr, lfcr
SaveFormatenum, default unicodetextunicodetext writes UTF-8 without a byte order mark. wintext writes Windows-1252: the sample's € becomes byte 80, making the file 2,147 bytes, and characters 1252 lacks, such as →, become ?. dostext, dostextlb and wintextlb return 400.Values: unicodetext, wintext
AllowSubstitutionsboolean, default falseAccepted with unicodetext, where every character fits. With SaveFormat=wintext only false works; true returns 400 "AllowSubstitutions is not supported yet for SaveFormat=wintext".
InsertLineBreaksboolean, default trueAccepted for ConvertAPI compatibility. Lines are never rewrapped, so neither value changes the output; a value that is not a boolean returns 400.
FileNamestringName of the .txt without the extension; FileName=nov1 returns nov1.txt instead of invoice-worker.txt.
StoreFileboolean, default falseReturn a download link, valid for 3 hours, in place of the text.

What carries over, and what doesn't

Kept

  • Every line and every character of the text: with LineEnding=lf the sample came back byte for byte identical
  • Indentation and spacing inside lines, such as the 4 spaces before each stack frame
  • Long lines, unwrapped: the 216-character line with the JSON event stays one line
  • Non-ASCII text read from UTF-8, UTF-16 with a byte order mark or Windows-1252 logs, written out as UTF-8: café from a UTF-16 log stayed café
  • The final line break, when the log has one

Lost or not yet supported

  • A UTF-8 byte order mark at the start of the log is not written back.
  • With SaveFormat=wintext, characters outside Windows-1252 become ?; an arrow in our test log did.
  • Mixed line endings: whatever each line ended with, the output uses one style for all of them.

Limits

  • One log per request, up to 10 MB on the Free plan or 100 MB on paid plans with all fields. A conversion can run for up to 120 seconds; after that the API returns 504.
  • Lines are split at LF. A log that ends lines with CR alone is read as one line: LineEnding leaves its CRs in place, except that a CR at the very end of the file is dropped.

Where teams use it

Logs for tools that split lines on CRLF

A program that looks for CRLF sees a Unix log, which ends lines with LF alone, as one long line. The default CRLF output gives it one entry per line.

Normalizing logs from mixed sources

Some Windows tools export logs as UTF-16 or Windows-1252. Sending every log through this route with LineEnding=lf gives UTF-8 with LF endings, so grep and log shippers read them all the same way.

Attaching logs to support tickets

Ticket systems that take .txt files but block .log files get the same entries under a .txt name, re-encoded only if you ask for it.

Questions

Why does the output have Windows line endings?

CRLF is ConvertAPI's default for this conversion, and we kept it. Send LineEnding=lf for Unix endings; for a UTF-8 log with LF endings that returns the file unchanged, with a .txt name.

Can it read logs exported from Windows in UTF-16?

Yes, when the file starts with a byte order mark, as Windows tools write it. Our UTF-16 test log came back as UTF-8 with café and → intact. Without a byte order mark, the bytes are read as UTF-8 if they are valid and as Windows-1252 if not.

Does it change timestamps or wrap long lines?

No. The text of each line is copied as it is; only line endings and, with wintext, the character encoding change. InsertLineBreaks is accepted but does nothing, because lines are never wrapped.

Which SaveFormat values work?

unicodetext (UTF-8, the default) and wintext (Windows-1252). ConvertAPI also documents dostext, dostextlb and wintextlb; here they return 400, for example "SaveFormat=dostext is not supported yet for LOG → TXT (supported: unicodetext, wintext)".

Convert your first LOG file in a minute.