APIドキュメント
セルフホスト型promptShieldエンジンのREST APIリファレンスです。すべてのエンドポイントは、デプロイ先のURLで利用できます。
ベースURL
http://localhost:8000デプロイ先のホストとポートに置き換えてください。
OpenAPIスキーマ
サーバーは/docs(Swagger UI)、/redoc、/openapi.jsonを提供しています。APIキーを設定している場合、この3つはいずれもAuthorizationヘッダーが必要なため、ブラウザーで直接開くことはできません。スキーマを取得し、ヘッダーを送信できるクライアントに読み込んでください。
curl -H "Authorization: Bearer $PROMPTSHIELD_API_KEY" \
http://localhost:8000/openapi.json -o promptshield-openapi.jsonブラウザーはページを開くときにAuthorizationヘッダーを送信できないため、APIキーを設定している場合、/docs自体は401を返します。上記のスキーマを使う方法をご利用ください。
認証
PROMPTSHIELD_API_KEYを設定している場合(promptshield serve --api-keyまたはDockerの環境変数で指定)、すべてのリクエストにAuthorization: Bearer <api-key>としてAPIキーを含める必要があります。APIキーがないか誤っている場合は401が返り、一部の操作だけに権限を限定したAPIキーでは、それ以外の操作に403が返ります。/healthエンドポイントは常に認証の対象外です。APIキーを設定していない場合、サーバーは認証なしで動作し、すべてのリクエストを受け付けます。この設定は、信頼できるローカルネットワーク内でのみ使ってください。
クイックスタート
Dockerを使ってローカルAPIを起動します。初回のプルは約3.8 GBです。
APIキーを取得する
export PROMPTSHIELD_API_KEY="ps_live_your_key_here"APIキーは次のページで確認できます:APIキーの管理画面。
サーバーを起動する
docker run -d --name promptshield \
-e PROMPTSHIELD_API_KEY="$PROMPTSHIELD_API_KEY" \
-p 8000:8000 \
-v promptshield-data:/data \
promptshield/promptshield-api:latestイメージには、Tesseract OCR、LibreOffice、英語とフランス語の検出モデルが含まれています。ほかの言語は、promptshield models installでインストールします。
起動を確認する
curl http://localhost:8000/health
# → {"status": "ok", "version": "1.3.6"}最初の文書を処理する
AUTH="Authorization: Bearer ps_live_your_key_here"
curl -X POST http://localhost:8000/api/documents/upload \
-H "$AUTH" \
-F "file=@contract.pdf"
# → {"doc_id": "abc123", "filename": "contract.pdf", "page_count": 5, "status": "EXTRACTED"}
curl -X POST http://localhost:8000/api/documents/abc123/detect \
-H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"confidence_threshold": 0.7}'
# → {"doc_id": "abc123", "total_regions": 42, "regions": [...]}
curl -X POST http://localhost:8000/api/documents/abc123/anonymize \
-H "$AUTH"
# → {"doc_id": "abc123", "tokens_created": 42, "regions_removed": 0, "output_path": "..."}
curl -o contract-safe.pdf \
-H "$AUTH" \
http://localhost:8000/api/documents/abc123/download/pdfローカルのPython環境にインストールする場合
PythonパッケージはまだPyPIで公開していないため、pip install promptshield-appではインストールできません。上記のDockerイメージを使うか、ソースからビルドしてください。パッケージを公開したら、このページを更新します。
セットアップガイド
ローカルAPIのセットアップから業務への組み込みまでを、順番に説明します。
1. 前提条件
始める前に、次のソフトウェアがインストールされていることをご確認ください。
任意(すべての形式に対応する場合):
2. SDKのインストール
promptShieldのPythonパッケージをインストールします。基本のインストールでPDFファイルを扱えます。Word、Excel、PowerPointを扱う場合は、officeエクストラを追加してください。
PythonパッケージはまだPyPIで公開していないため、下記の2つのコマンドではインストールできません。当面は、セクション5のDockerイメージをご利用ください。このページのほかの内容は、どちらの方法にも当てはまります。
pip install promptshield-apppip install "promptshield-app[office]"言語モデル(固有名詞の検出用パック)をCLIでインストールします。
# Set the install directory (add to your shell profile)
export PROMPTSHIELD_ASSETS_DIR="$HOME/.local/share/promptshield/assets"
# Windows: $env:PROMPTSHIELD_ASSETS_DIR = "$env:APPDATA\promptshield\assets"
# English pack — required (medium is recommended)
promptshield models install spacy-en-md
# For maximum accuracy (larger download)
promptshield models install spacy-en-lgほかの言語パックも、同じ方法でインストールできます。
promptshield models install spacy-fr-md # French
promptshield models install spacy-de-md # German
promptshield models install spacy-es-md # Spanish
promptshield models install spacy-it-md # Italian
promptshield models install spacy-nl-md # Dutch
promptshield models install spacy-pt-md # Portuguese3. 認証
ローカルAPIは、promptShieldのAPIキーでライセンスを確認します。APIキーは環境変数に設定するか、サーバーの起動時に指定してください。
export PROMPTSHIELD_API_KEY="ps_live_your_key_here"$env:PROMPTSHIELD_API_KEY = "ps_live_your_key_here"APIキーは、起動時と、その後6時間ごとにオンラインで確認されます。確認の結果はローカルにキャッシュされるため、ライセンスサーバーに接続できない場合でも、サーバーは最長3日間動作し続けます。
4. APIサーバーの起動
次のコマンド1つで、ローカルサーバーを起動します。
promptshield serve
# Starting PromptShield API server on 127.0.0.1:8000
# Health: http://127.0.0.1:8000/health (no auth)
# Schema: http://127.0.0.1:8000/openapi.json (send: Authorization: Bearer <your-api-key>)
# /docs and /redoc are served but require that same header, so a browser cannot open them directly.指定できるオプション:
| --host | バインドするアドレス(既定:127.0.0.1) |
| --port | バインドするポート(既定:8000) |
| --api-key | APIキー(環境変数の代わりに指定) |
起動すると、表示されたURLでAPIを利用できます。OpenAPIスキーマは/openapi.jsonで取得できます。取得するときも、APIキーを含めてください。
5. Dockerでのデプロイ
本番環境へのデプロイには、Dockerをお勧めします。依存関係がすべて含まれているため、個別のインストールは必要ありません。
docker run -d --name promptshield \
-e PROMPTSHIELD_API_KEY="ps_live_your_key_here" \
-p 8000:8000 \
-v promptshield-data:/data \
promptshield/promptshield-api:latest# docker-compose.yml
services:
promptshield:
image: promptshield/promptshield-api:latest
ports:
- "8000:8000"
volumes:
- promptshield-data:/data
environment:
- PROMPTSHIELD_API_KEY=${PROMPTSHIELD_API_KEY}
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
volumes:
promptshield-data:APIキーを記載した.envファイルを作成します。
PROMPTSHIELD_API_KEY=ps_live_your_key_hereDockerイメージには、次のものが含まれています。
6. APIでの処理の流れ
文書の処理は、標準で次の5つのステップで進めます。
処理全体の例(cURL)
# 1. Upload
AUTH="Authorization: Bearer ps_live_your_key_here"
DOC_ID=$(curl -s -X POST http://localhost:8000/api/documents/upload \
-H "$AUTH" \
-F "file=@contract.pdf" | python -c "import sys,json; print(json.load(sys.stdin)['doc_id'])")
echo "Document ID: $DOC_ID"
# 2. Detect PII (with optional inline overrides)
curl -X POST http://localhost:8000/api/documents/$DOC_ID/detect \
-H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"confidence_threshold": 0.7, "regex_enabled": true, "ner_enabled": true}'
# → {"doc_id": "...", "total_regions": 42, "regions": [...]}
# 3. Review detected regions
curl -H "$AUTH" http://localhost:8000/api/documents/$DOC_ID/regions | python -m json.tool
# → [{"id": "...", "pii_type": "PERSON", "text": "John Smith", "confidence": 0.98,
# "action": "TOKENIZE", ...}, ...]
# 3b. Bulk-update region actions before anonymizing (region_ids from step 3)
curl -X PUT http://localhost:8000/api/documents/$DOC_ID/regions/batch-action \
-H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"region_ids": ["<id1>", "<id2>"], "action": "REMOVE"}'
# 4. Anonymize
curl -X POST http://localhost:8000/api/documents/$DOC_ID/anonymize \
-H "$AUTH"
# → {"doc_id": "...", "tokens_created": 42, "regions_removed": 0}
# 5. Download the anonymized document
curl -o contract-safe.pdf \
-H "$AUTH" \
http://localhost:8000/api/documents/$DOC_ID/download/pdf
echo "Done! Anonymized file saved to contract-safe.pdf"7. CLIコマンド
サーバーを起動せずに、コマンドラインから直接文書を処理できます。
promptshield detect invoice.pdf
# Detected 23 PII entities across 5 pages
promptshield detect invoice.pdf -o report.json
# Report saved to report.json
# Tune the pipeline per run — every desktop-app setting is also a CLI flag.
promptshield detect contract.pdf \
--language en --countries US \
--ner-backend Davlan/bert-base-multilingual-cased-ner-hrl \
--no-llm --fuzziness 0.5 \
--ner-types PERSON,ORG \
-e SA-2026-0847 -e "84-329-1057" \
--export-review -o contract.psreview
# Or load all of the above from demo/setup.json by locale:
promptshield detect contract.pdf --preset en --export-review -o contract.psreviewpromptshield anonymize contract.pdf -o contract-safe.pdf
# Anonymized: 42 tokens created, saved to contract-safe.pdf
# Permanently redact PII (black boxes, irreversible)
promptshield anonymize contract.pdf --redact -o contract-redacted.pdfpromptshield detokenize contract-safe.pdf -o contract-restored.pdf
# Restored 42 tokens, saved to contract-restored.pdfすべてのCLIコマンドは、APIキーを確認したうえで、文書をローカルで処理します。文書のデータがお使いのデバイスの外に出ることはありません。
モデルのアドオン
組み込みのmodelsコマンドで、固有名詞の検出用の言語パックを一覧表示、インストール、削除できます。CLIと起動中のサーバーの両方がパックを見つけられるように、PROMPTSHIELD_ASSETS_DIRを設定してください。
export PROMPTSHIELD_ASSETS_DIR="$HOME/.local/share/promptshield/assets"
# Windows: $env:PROMPTSHIELD_ASSETS_DIR = "$env:APPDATA\promptshield\assets"promptshield models list
# Language packs (NER)
# [ ] spacy-en-sm English (small) (12 MB)
# [installed] spacy-en-md English (medium) (33 MB)
# [ ] spacy-fr-md French (medium) (16 MB) ...promptshield models install spacy-fr-md
# Installing spacy-fr-md (French (medium))...
# Downloading... 16.0/16.0 MB (100%)
# Verifying integrity...
# Extracting...
# Installed to ~/.local/share/promptshield/assets/spacy/fr_core_news_mdpromptshield models installed
# Installed models:
# spacy-en-md English (medium)
# spacy-fr-md French (medium)promptshield models remove spacy-fr-mdインストールしたパックは、detect、anonymize、起動中のAPIサーバーで自動的に使われます。installコマンドはライセンスサーバーと直接通信するため、サーバーを起動しておく必要はありません。
8. 登録語句
組み込みの正規表現と固有名詞の検出で、個人情報の大部分は検出できます。ただし、契約番号、社内のプロジェクトコード、税務上のID番号、機密区分など、組織ごとに独自の識別子があります。これらを登録語句(expressions)として追加すると、組み込みの個人情報と同じように扱われます。CUSTOM型として、バウンディングボックス付きで検出されます。ほかのページにも反映されます。CLI(-e / --expression)、セルフホスト型のHTTP API(blacklist_terms)、demo/setup.jsonのプリセットで指定できます。
# Literal text — case-insensitive substring match
promptshield detect contract.pdf -e SA-2026-0847 -e "84-329-1057"
# Repeatable — pass as many -e flags as you need
promptshield detect contract.pdf \
-e ACME-CONFIDENTIAL \
-e "Internal Use Only" \
-e CUST-12345
# Regex — prefix with "re:" for full regex semantics
promptshield detect contract.pdf \
-e "re:CASE-\d{4}-[A-Z]{3}" \
-e "re:Project [A-Z][a-z]+"# Same feature on the self-hosted HTTP API.
curl -X POST http://localhost:8000/api/documents/$DOC_ID/detect \
-H "$AUTH" \
-H "Content-Type: application/json" \
-d '{
"expressions": ["SA-2026-0847", "84-329-1057"],
"expressions_action": "tokenize",
"expressions_fuzziness": 1.0
}'
# expressions_action: "none" | "tokenize" | "remove"
# expressions_fuzziness: 1.0 = exact match, 0.5 = fuzzy edit-distance match
#
# Back-compat: the legacy keys "blacklist_terms" / "blacklist_action" /
# "blacklist_fuzziness" still work and map to the same fields via
# Pydantic alias — existing integrations don't need changes.# demo/setup.json
{
"en": {
"language": "en",
"countries": ["US"],
"ner_backend": "Davlan/bert-base-multilingual-cased-ner-hrl",
"expressions": ["SA-2026-0847", "84-329-1057"],
"fuzziness": 0.5
}
}
# Then any time:
promptshield detect contract.pdf --preset en --export-review -o contract.psreview名前について: 現在は、CLI(-e / --expression)とHTTP API(expressions / expressions_action / expressions_fuzziness)ではexpressionsが正式な名前です。デスクトップアプリの画面では「登録語句」と表示され、同じ機能を指します。HTTP APIの以前のキー(blacklist_terms / blacklist_action / blacklist_fuzziness)も、後方互換のためのPydanticエイリアスで引き続き使えます。既存の連携はそのまま動作します。
確認の流れ:APIからデスクトップアプリへ
大量の文書を自動で検出するだけでは、作業は終わりません。自動検出の精度が100%になることはなく、誤検出の除外と検出漏れの追加は欠かせません。promptShieldでは、受け渡し用の.psreviewファイルで、この2つの工程をつなげます。プログラムで検出した結果をデスクトップアプリに読み込み、人の目で確認してから匿名化します。
ステップ1a:検出してエクスポート(CLI、1回で実行)
# Detect + bundle in one command
promptshield detect contract.pdf --export-review -o contract.psreview
# Ingesting contract.pdf...
# Detecting PII on page 1/3...
# Detecting PII on page 2/3...
# Detecting PII on page 3/3...
# Detected 14 PII region(s) across 3 page(s) in 1240ms.
# Review bundle saved to contract.psreview (14 region(s))ステップ1b:検出してエクスポート(HTTP API)
# 1. Upload document
curl -X POST http://localhost:8000/api/documents/upload \
-H "Authorization: Bearer $PROMPTSHIELD_API_KEY" \
-F "file=@contract.pdf"
# → {"doc_id": "abc123ef", "page_count": 3, ...}
# 2. Run detection
curl -X POST http://localhost:8000/api/documents/abc123ef/detect \
-H "Authorization: Bearer $PROMPTSHIELD_API_KEY"
# 3. Download the review bundle
curl http://localhost:8000/api/documents/abc123ef/export-review \
-H "Authorization: Bearer $PROMPTSHIELD_API_KEY" \
-o contract.psreview.psreview API
/api/documents/{id}/export-review確認用ファイルをエクスポート
文書とすべての領域の注釈を、受け渡し用の.psreview形式のZIPファイルとしてダウンロードします。
/api/documents/import-review確認用ファイルをインポート
.psreviewファイルを送信すると、文書が展開され(OCRも実行されます)、保存されていた領域の注釈が取り込まれます。文書はREVIEWINGの状態で開きます。検出をやり直さずに、そのまま目視で確認できます。
ステップ2:確認、編集、匿名化
領域のサイドバーで誤検出を処理の対象から外し、モデルが見落とした箇所には新しい領域を描画します。最後に「ダウンロード」をクリックすると匿名化が実行され、匿名化したPDFが「ダウンロード」フォルダーに保存されます。
8. Python SDK(直接インポート)
高度な連携には、コアモジュールをPythonのコードに直接インポートします。処理の各ステップを細かく制御できます。
from promptshield import PromptShield
ps = PromptShield()
def process(input_path: str, output_path: str):
# Step 1 — Detect PII (runs the full local pipeline)
result = ps.detect(input_path)
print(f"Loaded: {result.file} ({result.pages} pages)")
print(f"Total PII entities: {result.total_regions}")
for page in result.regions:
for entity in page["entities"]:
print(f" Page {page['page']}: [{entity['type']}] {entity['text']}")
# Step 2 — Anonymize (reversible tokens by default; pass redact=True
# for permanent removal). Output is always a PDF.
out = ps.anonymize(input_path, output_path)
print(f"Anonymized: {out.tokens_created} tokens, saved to {out.output_file}")
# Step 3 — Restore the originals later from the local token vault
restored = ps.detokenize(output_path, "contract-restored.pdf")
print(f"Restored {restored.tokens_replaced} tokens")
process("contract.pdf", "contract-safe.pdf")
# Async variants are available too: ps.adetect / ps.aanonymize / ps.adetokenize一括処理の例
ディレクトリ内の複数のファイルを処理します。
from pathlib import Path
from promptshield import PromptShield
ps = PromptShield()
def batch_process(input_dir: str, output_dir: str):
input_path = Path(input_dir)
output_path = Path(output_dir)
output_path.mkdir(parents=True, exist_ok=True)
files = list(input_path.glob("*.pdf"))
print(f"Processing {len(files)} files...")
for i, file in enumerate(files, 1):
print(f"[{i}/{len(files)}] {file.name}")
out_file = output_path / f"anon_{file.stem}.pdf"
result = ps.anonymize(str(file), str(out_file))
print(f" → {result.tokens_created} tokens, saved to {out_file.name}")
print("Batch complete!")
batch_process("./documents", "./anonymized")9. セキュリティとデータの保護
promptShieldは、ゼロトラストの環境を前提に設計されています。
10. トラブルシューティング
よくある問題と解決方法です。
「No spaCy model found」または「no NER model loaded」というエラーが表示される
PROMPTSHIELD_ASSETS_DIRを設定し、promptshield models install spacy-en-mdでパックをインストールしてください。システム全体にインストールする場合は、python -m spacy download en_core_web_smも使えます。
スキャンしたPDFでOCRが動作しない
Tesseract OCRをインストールし、PATHに含まれていることをご確認ください。Windowsでは、インストール時に自動で追加されます。
Officeファイルを変換できない
Word、Excel、PowerPointのファイル(.docx、.xlsx、.xls、.pptx)は、LibreOfficeを使わずにPythonで変換されます。Office形式に対応する追加パッケージ(promptshield-app[office])がインストールされていること、ファイルにパスワードが設定されていないことをご確認ください。
起動時に「Invalid API key」と表示される
APIキーがps_live_で始まっていること、サブスクリプションが有効であることをご確認ください。APIキーは/developers/api-keysで管理できます。
文書
/api/documents/upload文書を送信
処理する文書をサーバーに送信します。PDF、DOCX、XLSX、PPTX、画像ファイルに対応しています。
/api/documents文書の一覧を取得
送信済みのすべての文書を、検出と匿名化の状態とともに取得します。
/api/documents/{id}文書を取得
指定した文書の詳しい情報(ページ数、検出の状態など)を取得します。
/api/documents/{id}文書を削除
文書と、それに関連するすべてのデータをサーバーから削除します。
検出
/api/documents/{id}/detect個人情報を検出
文書に対して個人情報の検出パイプラインを実行します。任意のJSONボディを指定すると、その実行に限って検出の設定(confidence_threshold、regex_enabled、ner_enabled、regex_typesなど)を上書きできます。
/api/documents/{id}/redetect個人情報を再検出
すべてのパラメーターを指定して検出を再実行します。confidence_threshold、regex_types、ner_types、blacklist_termsなどを指定できます。
/api/documents/{id}/detection-progress検出の進行状況
実行中の検出ジョブの進行状況(進捗率、処理中のページ、状態)を取得します。
/api/documents/{id}/regions領域を取得
文書内で検出された個人情報の領域を、種類、テキスト、信頼度、バウンディングボックスとともにすべて取得します。
/api/documents/{id}/regions/batch-action領域を一括更新
複数の領域のアクション(TOKENIZE、REMOVE、CANCEL)を、情報の種類で絞り込んで一括で設定します。
匿名化と出力
/api/documents/{id}/regions/sync領域を同期
文書の領域リストをすべて置き換えます。クライアント側で領域を編集したあと、匿名化の前に変更を反映するときに使います。
/api/documents/{id}/anonymize文書を匿名化
検出した個人情報をコードに置き換えて、文書を匿名化します。処理済みの文書が返されます。
/api/documents/{id}/download/{type}匿名化した文書をダウンロード
匿名化した出力をダウンロードします。{type}には「pdf」または「text」を指定します。出力は常にPDFとして生成され(PDF以外の入力は変換されます)、「pdf」が基本の形式です。
/api/documents/batch-anonymize一括匿名化
複数の文書を1回のリクエストで匿名化します。最大50件まで指定でき、3件ずつ並行して処理されます。
デコード
/api/detokenizeテキストをデコード
テキスト内のコードを、コード台帳にある元の値に置き換えます。
/api/detokenize/fileファイルをデコード
コード化した文書を送信すると、すべてのコードを元の値に戻した文書が返されます。
コード台帳
/api/vault/statusコード台帳の状態
コード台帳の統計(コードの総数、文書の総数、台帳のサイズ)を取得します。
/api/vault/tokensコードの一覧を取得
コード台帳に保存されている、コードと元の値の対応をすべて取得します。
/api/vault/exportコード台帳をエクスポート
バックアップや移行のために、コード台帳全体をJSONファイルとしてエクスポートします。
/api/vault/importコード台帳をインポート
以前にエクスポートしたコード台帳のJSONをインポートし、コードの対応を復元します。
ヘルスチェック
/healthヘルスチェック
サーバーの稼働状態を返します。監視や、ロードバランサーのヘルスチェックに使います。
設定
/api/settings設定を取得
現在の検出と処理の設定(しきい値、有効な検出方法、言語など)を取得します。
/api/settings設定を更新
検出の全体設定を部分的に更新します。変更は、それ以降のすべての検出に適用されます。
/api/settings/patternsカスタムパターンの一覧を取得
個人情報の検出に使う、ユーザー定義の正規表現パターンをすべて取得します。
/api/settings/patternsカスタムパターンを作成
個人情報を検出するための正規表現パターンを追加します。パターンは、組み込みのルールと合わせて評価されます。
例
# 1. Upload a document
curl -X POST http://localhost:8000/api/documents/upload \
-F "file=@contract.pdf"
# → {"doc_id": "abc123", "filename": "contract.pdf", "page_count": 5, "status": "EXTRACTED"}
# 2. Run PII detection
curl -X POST http://localhost:8000/api/documents/abc123/detect
# → {"doc_id": "abc123", "total_regions": 42, "regions": [...]}
# 3. Get detected regions
curl http://localhost:8000/api/documents/abc123/regions
# → [{"id": "...", "pii_type": "PERSON", "text": "John Smith", "confidence": 0.98,
# "page_number": 1, "bbox": {...}, "source": "NER", "action": "TOKENIZE"}, ...]
# 4. Anonymize the document
curl -X POST http://localhost:8000/api/documents/abc123/anonymize
# → {"doc_id": "abc123", "tokens_created": 42, "regions_removed": 0}
# 5. Download anonymized PDF
curl -o contract-safe.pdf \
http://localhost:8000/api/documents/abc123/download/pdfPython SDK
PromptShieldクラスは、処理全体をローカルで実行します。検出、匿名化、デコードの3つの呼び出しで完結します。すべての処理はお使いのデバイスで行われ、文書のデータが外に出ることはありません。
SDKはPythonパッケージに含まれていますが、パッケージはまだPyPIで公開していません。公開までは、上記のHTTPエンドポイントで同じ処理を行えます。
from promptshield import PromptShield
ps = PromptShield()
# 個人情報を検出
result = ps.detect("contract.pdf")
print(f"{result.total_regions} entities across {result.pages} pages")
for page in result.regions:
for entity in page["entities"]:
print(f" [{entity['type']}] {entity['text']}")
# 匿名化(元に戻せるコード化)
out = ps.anonymize("contract.pdf", "contract-safe.pdf")
print(f"Done: {out.tokens_created} tokens created")
# 元の値に戻す
restored = ps.detokenize("contract-safe.pdf", "contract-restored.pdf")
print(f"Restored {restored.tokens_replaced} tokens")エラー処理
エラーのレスポンスはすべて共通のJSON形式で返され、detailフィールドにエラーの内容が記載されます。
Bad Request:パラメーターが無効か、ファイルが破損しているか、対応していない形式です。
Unauthorized:APIキーを設定している場合に、APIキー(Authorization: Bearer)がないか、無効です。
Forbidden:APIキーに必要な権限(detect / anonymize / detokenize)がありません。
Not Found:指定した文書IDが存在しません。
Unprocessable Entity:必須のフィールドがないか、ファイルがパスワードで保護されています。
Internal Server Error:詳しくはサーバーのログをご確認ください。
必要な検出モデルがインストールされていません。promptshield models installでインストールしてください。
{
"detail": "Document not found: abc123"
}レート制限
セルフホスト型のAPIは、既定では、クライアントのIPアドレスごとに1分あたり6,000件までのリクエストを受け付けます。この上限は、環境変数PROMPTSHIELD_SELF_HOSTED_RATEで変更できます。