API

Document conversion and OCR API

Turn Word, HTML and text files into PDF, and pull text out of PDFs and scanned images with OCR.

What it does

  • The Document Conversion and OCR API does two jobs that every business app needs sooner or later. It makes PDFs from the files people already have, and it reads text out of PDFs and pictures.
  • It solves the "install LibreOffice on a server and hope" problem. Office converters, HTML renderers and OCR engines are heavy, fiddly to patch and easy to get wrong. Here they sit behind two endpoints. You upload a file and get a result back, with no engines to run yourself.
  • To make a PDF, post a Word file (.docx, .doc, .docm, .dotx), an OpenDocument text (.odt), an .rtf, an HTML page, or a plain text type (.txt, .md, .log, .csv, .tsv). HTML pages can bring their images, styles and fonts with them, either as extra attachments or as one .zip bundle with an entry document. Remote asset links are blocked by default, to stop a document from making your server fetch internal addresses. You can opt in for documents you trust.
  • To read text, post a PDF or an image. For PDFs the embedded text layer is read first, and pages with no usable text (scans) are rendered and sent to OCR automatically. Images in common formats, including multi-page TIFFs, go straight to OCR. You choose OCR mode (auto, force or never), one or more languages, such as eng or eng+spa, and an optional page range like 1-3,7.
  • The text result includes the full text, text per page, the engine used, the page count and whether OCR ran. The PDF result is either the raw PDF stream or a JSON body with the file as base64.
  • A capabilities endpoint tells you which engines are installed in this environment and the largest upload accepted. A missing engine returns 503 and an unsupported file type returns 415, so you can tell a setup issue from a bad input.
  • Authenticate with an X-API-Key header or a Bearer token from Takelan SSO. Over the limit you get a 429 with a Retry-After header. We do not publish conversion times or OCR accuracy figures, because they depend on the file.
  • Affordable by design. Start free* inside platform limits. *Free within platform limits; usage beyond limits may be charged to maintain the platform. Connected ShadowCradle organizations can switch on Takelan SSO and these free* services with one switch. Airgap licences work without any Takelan connection.

See how it works

A document in, a PDF or text out

Two endpoints cover both jobs. Office, HTML and text files become PDFs; PDFs and images become text, with OCR used only where a page has no usable text.

Example use cases

Quotes and letters as PDF

A small business keeps its quote template as a Word file. The app fills it in, posts it to the converter and emails the PDF to the customer.

Branded reports from HTML

A developer renders an HTML report with its own logo and stylesheet, zips it with its images, and gets back a clean PDF for the client portal.

Make scanned paperwork searchable

An office scans paper invoices to PDF. The to-text endpoint reads them with OCR so the text can be indexed and searched in the app.

Read a photo of an error screen

A support tool lets a customer upload a photo of an error screen. The app extracts the text from the image and drops it into the ticket.

Multi-language archives

An IT team that handles English and Spanish documents sets the language to eng+spa, and limits OCR to the pages it needs.

Feed documents to search or AI

A developer converts uploads to plain text first, then adds the text to the tenant knowledge store so the assistant can answer from it.

Try it

Convert a Word file to PDF

curl -X POST https://app.takelan.com/api/v1/documents/to-pdf \
  -H "X-API-Key: $TAKELAN_API_KEY" \
  -F "file=@quote.docx" \
  -o quote.pdf

Add ?response_format=json to get the PDF as base64 inside JSON instead of a raw stream.

Extract text from a scan

curl -X POST https://app.takelan.com/api/v1/documents/to-text \
  -H "X-API-Key: $TAKELAN_API_KEY" \
  -F "file=@invoice-scan.pdf" \
  -F "ocr=auto" \
  -F "language=eng" \
  -F "page_range=1-2"

# Response (abridged, fictional)
# {
#   "success": true,
#   "source_filename": "invoice-scan.pdf",
#   "source_kind": "pdf",
#   "ocr_used": true,
#   "language": "eng",
#   "page_count": 2,
#   "text": "INVOICE 1042 ...",
#   "pages": [ { "page": 1, "text": "INVOICE 1042 ..." } ]
# }

Endpoints

  • GET /api/v1/documents/capabilities Which engines are installed, accepted file types and the upload size cap.
  • POST /api/v1/documents/to-pdf Convert Office, HTML, text or a .zip bundle to PDF. Options: attachments, entrypoint, allow_remote_assets, response_format=pdf|json.
  • POST /api/v1/documents/to-text Extract text from a PDF or image. Options: ocr=auto|force|never, language, page_range.

MCP

Available as tools through /mcp/utils; writes off by default. The capabilities route can be read with a read-only key. Both conversion calls are POST requests, so they are treated as writes and stay off until the tenant turns on the writes switch and uses a key that is not read-only. File uploads are multipart, so batch conversion is usually simpler over plain REST. Check tools/list for what your agent actually sees. About MCP

Common questions

how to convert docx to pdf with an api

POST the file to /api/v1/documents/to-pdf as multipart form data with your X-API-Key. You get back a PDF stream, or base64 JSON if you add response_format=json.

can I convert html with images and css to pdf

Yes. Upload the HTML as the file and its images, styles and fonts as attachments, or upload one .zip with an entry document. Remote asset URLs are blocked unless you set allow_remote_assets.

how to extract text from a scanned pdf with ocr api

POST the PDF to /api/v1/documents/to-text. In the default auto mode, pages that already have text are read directly and scanned pages go through OCR. Use ocr=force if the text layer is garbled.

which image formats does the OCR support

PNG, JPG, GIF, BMP, TIFF (multi-frame), WebP, HEIC/HEIF and JPEG 2000, plus other formats the image library can read. Multi-frame files return one entry per frame.

does it support OCR in other languages

Yes. Pass Tesseract language codes in the language field, such as spa or eng+spa. Which language packs are present depends on the environment, and capabilities shows the engines.

is it safe to convert untrusted html to pdf

Remote asset fetching is off by default as a protection against server-side request forgery. Leave it off for documents you do not control.

what is the maximum document size

It is a deployment setting. GET /api/v1/documents/capabilities returns max_file_size_mb for your environment. A file over the cap is rejected.

is the document conversion api free

It is affordable by design: start free* within platform limits. *Free within platform limits; usage beyond limits may be charged to maintain the platform.

Analytics & Cookies

We use self-hosted Matomo analytics. By default we measure anonymously with no cookies. Enable cookies to help us improve your experience. You can change this anytime.