API
Escriba expose une petite API REST, pratique pour l’automatisation (n8n, scripts). L’authentification est toujours requise.
S’authentifier
Section intitulée « S’authentifier »Avec un token d’API (définissez 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"Avec un cookie de session :
curl -c cookies.txt -F "password=$GOD_PASSWORD" https://your-domain/api/logincurl -b cookies.txt -F "file=@document.pdf" https://your-domain/api/convertConvertir
Section intitulée « Convertir »POST /api/convert (multipart/form-data) : file ou url, plus les options lang,
ocr, pages, llm_provider, llm_api_key, llm_model. Réponse :
{ "source": "…", "title": "…", "markdown": "…","words": 1234, "chars": 5678, "elapsed_ms": 87,"pdf_type": "scanned", "ocr_applied": true, "note": null }Caviarder
Section intitulée « Caviarder »POST /api/redact (multipart/form-data) : file (PDF ou image), options lang,
anon_strict, anon_detectors, anon_rules. Renvoie le PDF caviardé (binaire)
avec l’en-tête X-Redacted-Entities qui compte ce qui a été noirci.
Post-traitement du Markdown
Section intitulée « Post-traitement du Markdown »JSON en entrée, JSON ou fichier en sortie :
| Endpoint | Méthode | Description |
|---|---|---|
/api/export | POST | Convertir le Markdown vers un format cible (docx, odt, epub, html, latex, rst, docbook, jats, tei, opml). |
/api/compact | POST | Markdown débarrassé des espaces pour économiser des tokens. |
/api/chunk | POST | Morceaux RAG bornés en tokens (renvoie .jsonl). |
/api/model_prices | GET | Tarifs et fenêtres de contexte des modèles en temps réel (OpenRouter, en cache). |