API for developers

The server version of Office Lab has a simple HTTP API, so office systems and scripts can convert files without the website. It is part of the server version only (not GitHub Pages).

Keys

Programs send a key in a header and get their own, larger limit. The server's administrator makes keys (python -m app.keys new <name>); only their hash is kept. Without a key you get the visitor's limit per IP address; a wrong key is refused.

Authorization: Bearer olab_…

Converting a file

Send the file as multipart form data, with the tool's options as JSON. The answer is the converted file itself.

curl -X POST https://your-server/api/convert/word-to-pdf \
  -H "Authorization: Bearer olab_…" \
  -F "file=@report.docx" \
  -F 'options={"pdfa": true}' \
  -o report.pdf
  • GET /api/capabilities — which tools this server can run, and its size limit in MB
  • POST /api/convert/{tool} — fields: file, options (JSON); answer: the file

Errors

On failure the answer is JSON like {"code": "too-big"} with a matching HTTP status. The codes:

wrong-typetoo-bigpasswordcorruptedbad-optionsbad-keynot-foundbusytimeout

Tools (19)

ToolAcceptsOptions
word-to-pdf
Word to PDF
docx, doc, odt, rtf
pdfa: true | false (default false)
excel-to-pdf
Excel to PDF
xlsx, xls, ods
one_page: true | false (default false)
landscape: true | false (default false)
pdfa: true | false (default false)
powerpoint-to-pdf
PowerPoint to PDF
pptx, ppt, ppsx, pps, odp
pdfa: true | false (default false)
convert-to-pdf
Convert anything to PDF
doc, docx, docm, dot, dotx, odt, ott, rtf, txt, wpd, wps, hwp, pages, xls, xlsx, xlsm, xlsb, ods, numbers, ppt, pptx, pptm, pps, ppsx, odp, key, odg, pub, vsd, vsdx, svg, emf, wmf
landscape: true | false (default false)
pdfa: true | false (default false)
html-to-pdf
HTML to PDF
html, htm
paper: a4 | letter (default a4)
landscape: true | false (default false)
background: true | false (default true)
pdf-to-word
PDF to Word
pdf—
pdf-to-excel
PDF to Excel
pdf—
pdf-to-pdfa
PDF to PDF/A
pdf
level: PDF/A-1b | PDF/A-2b | PDF/A-3b (default PDF/A-2b)
compress-pdf-strong
Strong PDF compression
pdf
mode: level | target (default level)
level: screen | ebook | printer (default ebook)
target_mb: 0.05–500 (default 2)
repair-pdf
Repair PDF
pdf—
ocr-pdf-server
OCR for large PDFs
pdf
lang: ara+eng | ara | eng (default ara+eng)
straighten: true | false (default false)
redo: true | false (default false)
pdfa: true | false (default false)
ebook-convert
Ebook converter
epub, mobi, azw3, azw, fb2, docx, odt, rtf, txt, pdf
to: epub | azw3 | mobi | fb2 | docx | pdf | txt (default epub)
epub-to-pdf
EPUB to PDF
epub—
pdf-to-epub
PDF to EPUB
pdf—
mobi-to-epub
Kindle (MOBI/AZW3) to EPUB
mobi, azw3, azw—
document-convert
Document converter (pandoc)
md, markdown, txt, docx, odt, epub, html, htm, tex, rst, org
to: docx | odt | md | html | epub | tex | rst (default docx)
latex-to-word
LaTeX to Word
tex—
word-to-latex
Word to LaTeX
docx, odt—
media-convert
Audio & video converter (FFmpeg)
mp4, m4v, mov, webm, mkv, avi, wmv, asf, flv, 3gp, 3g2, mpg, mpeg, ts, mts, m2ts, vob, ogv, mp3, wav, ogg, oga, opus, m4a, aac, flac, amr, wma, aif, aiff, ac3, caf, mka
to: mp4 | webm | mp3 | m4a | wav | ogg (default mp4)
quality: high | medium | low | very-low (default medium)
height: 0 | 1080 | 720 | 480 | 360 (default 0)
mute: true | false (default false)
kbps: 64 | 128 | 192 | 320 (default 128)

Browser tools run on the visitor's device and have no API: there is nothing to send to a server.