API
Escriba exposes a small REST API, handy for automation (n8n, scripts). Authentication is always required.
Authenticate
Section titled “Authenticate”With an API token (define API_TOKEN):
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:
curl -c cookies.txt -F "password=$GOD_PASSWORD" https://your-domain/api/logincurl -b cookies.txt -F "file=@document.pdf" https://your-domain/api/convertConvert
Section titled “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 }Redact
Section titled “Redact”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.
Markdown post-processing
Section titled “Markdown post-processing”JSON in, JSON or file out:
| Endpoint | Method | Description |
|---|---|---|
/api/export | POST | Convert Markdown to a target format (docx, odt, epub, html, latex, rst, docbook, jats, tei, opml). |
/api/compact | POST | Whitespace-stripped Markdown to save tokens. |
/api/chunk | POST | Token-bounded RAG chunks (returns .jsonl). |
/api/model_prices | GET | Live model pricing & context windows (OpenRouter, cached). |