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 MBPOST /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)
| Tool | Accepts | Options |
|---|---|---|
word-to-pdfWord to PDF | docx, doc, odt, rtf | pdfa: true | false (default false) |
excel-to-pdfExcel to PDF | xlsx, xls, ods | one_page: true | false (default false)landscape: true | false (default false)pdfa: true | false (default false) |
powerpoint-to-pdfPowerPoint to PDF | pptx, ppt, ppsx, pps, odp | pdfa: true | false (default false) |
convert-to-pdfConvert 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-pdfHTML to PDF | html, htm | paper: a4 | letter (default a4)landscape: true | false (default false)background: true | false (default true) |
pdf-to-wordPDF to Word | — | |
pdf-to-excelPDF to Excel | — | |
pdf-to-pdfaPDF to PDF/A | level: PDF/A-1b | PDF/A-2b | PDF/A-3b (default PDF/A-2b) | |
compress-pdf-strongStrong PDF compression | mode: level | target (default level)level: screen | ebook | printer (default ebook)target_mb: 0.05–500 (default 2) | |
repair-pdfRepair PDF | — | |
ocr-pdf-serverOCR for large PDFs | lang: ara+eng | ara | eng (default ara+eng)straighten: true | false (default false)redo: true | false (default false)pdfa: true | false (default false) | |
ebook-convertEbook converter | epub, mobi, azw3, azw, fb2, docx, odt, rtf, txt, pdf | to: epub | azw3 | mobi | fb2 | docx | pdf | txt (default epub) |
epub-to-pdfEPUB to PDF | epub | — |
pdf-to-epubPDF to EPUB | — | |
mobi-to-epubKindle (MOBI/AZW3) to EPUB | mobi, azw3, azw | — |
document-convertDocument 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-wordLaTeX to Word | tex | — |
word-to-latexWord to LaTeX | docx, odt | — |
media-convertAudio & 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.