API
Escriba は小さな REST API を公開しており、自動化(n8n、スクリプト)に便利です。認証は常に必要です。
API トークンを使う場合(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"セッションクッキーを使う場合:
curl -c cookies.txt -F "password=$GOD_PASSWORD" https://your-domain/api/logincurl -b cookies.txt -F "file=@document.pdf" https://your-domain/api/convertPOST /api/convert(multipart/form-data):file または url、加えて任意の lang、ocr、pages、llm_provider、llm_api_key、llm_model。レスポンス:
{ "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 または画像)、任意の lang、anon_strict、anon_detectors、anon_rules。墨消し PDF(バイナリ)を返し、X-Redacted-Entities ヘッダーに黒塗りした件数を示します。
Markdown の後処理
Section titled “Markdown の後処理”JSON を入力し、JSON またはファイルを出力します。
| エンドポイント | メソッド | 説明 |
|---|---|---|
/api/export | POST | Markdown を対象形式(docx、odt、epub、html、latex、rst、docbook、jats、tei、opml)に変換します。 |
/api/compact | POST | トークンを節約するために空白を除去した Markdown。 |
/api/chunk | POST | トークン上限つきの RAG チャンク(.jsonl を返します)。 |
/api/model_prices | GET | リアルタイムのモデル価格とコンテキストウィンドウ(OpenRouter、キャッシュ済み)。 |