Skip to content

API

Escriba exposes a small REST API, handy for automation (n8n, scripts). Authentication is always required.

With an API token (define API_TOKEN):

Terminal window
curl -H "X-API-Key: YOUR_TOKEN" \
-F "file=@document.pdf" \
https://your-domain/api/convert
# Force OCR / set language: -F "ocr=true" -F "lang=es-ES"

With a session cookie:

Terminal window
curl -c cookies.txt -F "password=$GOD_PASSWORD" https://your-domain/api/login
curl -b cookies.txt -F "file=@document.pdf" https://your-domain/api/convert

POST /api/convert (multipart/form-data): file or url, plus optional lang, ocr, pages, llm_provider, llm_api_key, llm_model. Response:

{ "source": "", "title": "", "markdown": "",
"words": 1234, "chars": 5678, "elapsed_ms": 87,
"pdf_type": "scanned", "ocr_applied": true, "note": null }

POST /api/redact (multipart/form-data): file (PDF or image), optional lang, anon_strict, anon_detectors, anon_rules. Returns the redacted PDF (binary) with the X-Redacted-Entities header counting what was blacked out.

JSON in, JSON or file out:

EndpointMethodDescription
/api/exportPOSTConvert Markdown to a target format (docx, odt, epub, html, latex, rst, docbook, jats, tei, opml).
/api/compactPOSTWhitespace-stripped Markdown to save tokens.
/api/chunkPOSTToken-bounded RAG chunks (returns .jsonl).
/api/model_pricesGETLive model pricing & context windows (OpenRouter, cached).