API キーを Authorization ヘッダーの Bearer トークンとして送信します。 API キーを使用します。v1 では OAuth は使用しません。
銀行取引明細書抽出 API
PDFの銀行取引明細書を構造化JSONに変換するREST API。取引の99.9%以上を正しく識別し、失敗時は自動返金。
$ curl https://api.bankstatementlab.com/v1/extractions \
-H "Authorization: Bearer bsl_live_..." \
-F "file=@statement.pdf" 銀行取引明細書の抽出
あらゆる PDF からトランザクション、残高、メタデータを抽出します。
構造化された JSON 出力
対応する10言語すべてで一貫したスキーマを提供します。
取引の99.9%以上を正しく識別
失敗時は自動返金。抽出に失敗した場合は料金はかかりません。
同期モードと非同期モード
小さな PDF の場合は同期、大きなバッチの場合は非同期 + ポーリング。
コードサンプル
お使いの言語で統合できます。以下の例をご覧ください。
$ curl https://api.bankstatementlab.com/v1/extractions \
-H "Authorization: Bearer bsl_live_..." \
-F "file=@statement.pdf" const form = new FormData();
form.append("file", fs.createReadStream("statement.pdf"));
const res = await fetch("https://api.bankstatementlab.com/v1/extractions", {
method: "POST",
headers: { Authorization: `Bearer $${process.env.BSL_KEY}` },
body: form,
});
const data = await res.json(); import requests
with open("statement.pdf", "rb") as f:
r = requests.post(
"https://api.bankstatementlab.com/v1/extractions",
headers={"Authorization": f"Bearer {BSL_KEY}"},
files={"file": f},
)
data = r.json() $ch = curl_init("https://api.bankstatementlab.com/v1/extractions");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer " . getenv("BSL_KEY")]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
"file" => new CURLFile("statement.pdf"),
]);
$data = json_decode(curl_exec($ch), true); 応答形式
data、column_names、transaction_count フィールドは status が "completed" の場合にのみ存在します。それ以外の場合は JSON から省略されます(null ではなく、フィールド自体が存在しません)。
GET /v1/extractions/:id
200 OK — 抽出完了
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "ext_3f8a9b2c1d4e5f6a7b8c9d0e",
"status": "completed",
"file_name": "statement-march-2026.pdf",
"created_at": "2026-03-15T10:23:00.000Z",
"completed_at": "2026-03-15T10:23:18.000Z",
"page_count": 3,
"credits_charged": 3,
"api_key_id": "ak_abc123",
"column_names": ["Date", "Description", "Amount"],
"transaction_count": 42,
"data": {
"columns": ["Date", "Description", "Amount"],
"transactions": [
["2026-03-01", "VIREMENT SEPA", "1500.00"],
["2026-03-02", "CB CARREFOUR", "-45.20"]
]
}
} 200 OK — 抽出中
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "ext_3f8a9b2c1d4e5f6a7b8c9d0e",
"status": "processing",
"file_name": "statement-march-2026.pdf",
"created_at": "2026-03-15T10:23:00.000Z",
"page_count": 3,
"credits_charged": 3,
"api_key_id": "ak_abc123"
} 200 OK — 抽出失敗
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "ext_3f8a9b2c1d4e5f6a7b8c9d0e",
"status": "failed",
"file_name": "statement-march-2026.pdf",
"created_at": "2026-03-15T10:23:00.000Z",
"completed_at": "2026-03-15T10:23:32.000Z",
"page_count": 3,
"credits_charged": 3,
"api_key_id": "ak_abc123",
"error": {
"type": "extraction_failed",
"message": "Extraction failed due to an internal error. Contact support if the issue persists."
}
} ポーリングパターン
非同期モードで抽出を実行した場合、ワーカーが完了するまで応答には status: "processing" が含まれます。data、transaction_count、column_names フィールドを読む前に、必ず status が "completed" であることを確認してください — 抽出が完了するまで JSON から省略されます。
クライアント側の推奨ポーリング頻度:5〜10秒。サーバー側のワーカーは10秒ごとに実行されます — ポーリングを速くしても結果は早くなりません。
GET /v1/extractions
200 OK — 混合ページ(状態ごとに1要素)
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": [
{
"id": "ext_001",
"status": "completed",
"file_name": "march.pdf",
"created_at": "2026-03-15T10:00:00.000Z",
"completed_at": "2026-03-15T10:00:18.000Z",
"page_count": 3,
"credits_charged": 3,
"api_key_id": "ak_abc123",
"column_names": ["Date", "Description", "Amount"],
"transaction_count": 42
},
{
"id": "ext_002",
"status": "processing",
"file_name": "april.pdf",
"created_at": "2026-04-15T10:00:00.000Z",
"page_count": 5,
"credits_charged": 5,
"api_key_id": "ak_abc123"
},
{
"id": "ext_003",
"status": "failed",
"file_name": "may.pdf",
"created_at": "2026-05-15T10:00:00.000Z",
"completed_at": "2026-05-15T10:00:42.000Z",
"page_count": 2,
"credits_charged": 2,
"api_key_id": "ak_abc123",
"error": {
"type": "extraction_failed",
"message": "Extraction failed due to an internal error. Contact support if the issue persists."
}
}
],
"has_more": false
} ポーリングパターン
非同期モードで抽出を実行した場合、ワーカーが完了するまで応答には status: "processing" が含まれます。data、transaction_count、column_names フィールドを読む前に、必ず status が "completed" であることを確認してください — 抽出が完了するまで JSON から省略されます。
クライアント側の推奨ポーリング頻度:5〜10秒。サーバー側のワーカーは10秒ごとに実行されます — ポーリングを速くしても結果は早くなりません。
主な用途
会計の自動化
クライアントの明細書を簿記パイプラインに直接インポートします。
融資デューデリジェンス
申請者の銀行取引明細書から収入とキャッシュフローを確認します。
パーソナルファイナンスアプリ
ユーザーが手入力せずに銀行明細書を取り込めるようにします。