抽出一覧
GET /v1/extractions
認証済みユーザーの抽出レコードを一覧表示します。結果は逆時系列順(最新のものが先頭)で返されます。カーソルベースのページネーションと、テンプレート、バッチ実行ID、または日付範囲によるフィルタリングをサポートしています。
試してみる
このエンドポイントを Swagger UI でインタラクティブにテストできます。
認証が必要です
Authorization ヘッダーにAPIキーを含めてください。
リクエスト
ヘッダー
| ヘッダー | 値 | 必須 |
|---|---|---|
Authorization | Bearer <token> | はい |
クエリパラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
templateId | string | いいえ | 特定のテンプレートからの抽出に結果をフィルタリング。 |
runId | string | いいえ | 特定のバッチ実行からの抽出に結果をフィルタリング。すべての一致結果を返します(limit/cursor は無視されます)。 |
limit | number | いいえ | 返す結果の最大数。デフォルト: 50、最大: 100。 |
cursor | string | いいえ | ページネーションカーソル。前のページの最後のアイテムの createdAt 値を渡して次のページを取得します。 |
dateFrom | string | いいえ | この日付以降に作成された抽出をフィルタリング(YYYY-MM-DD)。 |
dateTo | string | いいえ | この日付以前に作成された抽出をフィルタリング(YYYY-MM-DD)。 |
ページネーション
レスポンスには hasMore ブーリアン値が含まれます。true の場合、最後のアイテムの createdAt 値を cursor パラメータとして渡して次のページを取得してください。
runId でフィルタリングする場合、すべての一致する抽出が単一のレスポンスで返されます(バッチ実行は通常小さいため、ページネーションは不要です)。
コード例
bash
# List all extractions (default limit of 50)
curl https://api.docmap.io/v1/extractions \
-H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"
# Filter by template and limit results
curl "https://api.docmap.io/v1/extractions?templateId=48291&limit=10" \
-H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"
# Filter by batch run ID
curl "https://api.docmap.io/v1/extractions?runId=b4704c6e-8917-4671-8c92-178aec3eba92" \
-H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"
# Filter by date range
curl "https://api.docmap.io/v1/extractions?dateFrom=2025-01-01&dateTo=2025-01-31" \
-H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"
# Paginate through results
curl "https://api.docmap.io/v1/extractions?limit=10&cursor=2025-01-15T09:30:00.000Z" \
-H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"typescript
const apiKey = process.env.DOCMAP_API_KEY
// List all extractions
const response = await fetch('https://api.docmap.io/v1/extractions', {
headers: { 'Authorization': `Bearer ${apiKey}` },
})
const { data, hasMore } = await response.json()
console.log(`Found ${data.length} extractions, hasMore: ${hasMore}`)
// Paginate through all results
let cursor: string | undefined
const allExtractions = []
do {
const url = new URL('https://api.docmap.io/v1/extractions')
url.searchParams.set('limit', '50')
if (cursor) url.searchParams.set('cursor', cursor)
const res = await fetch(url, {
headers: { 'Authorization': `Bearer ${apiKey}` },
})
const page = await res.json()
allExtractions.push(...page.data)
cursor = page.hasMore ? page.data.at(-1)?.createdAt : undefined
} while (cursor)
console.log(`Total: ${allExtractions.length} extractions`)
// Filter by template
const filtered = await fetch(
'https://api.docmap.io/v1/extractions?templateId=48291&limit=10',
{ headers: { 'Authorization': `Bearer ${apiKey}` } },
)
const { data: filteredData } = await filtered.json()python
import requests
api_key = "dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"
headers = {"Authorization": f"Bearer {api_key}"}
# List all extractions
response = requests.get(
"https://api.docmap.io/v1/extractions",
headers=headers,
)
result = response.json()
print(f"Found {len(result['data'])} extractions, hasMore: {result['hasMore']}")
# Paginate through all results
all_extractions = []
cursor = None
while True:
params = {"limit": 50}
if cursor:
params["cursor"] = cursor
response = requests.get(
"https://api.docmap.io/v1/extractions",
headers=headers,
params=params,
)
page = response.json()
all_extractions.extend(page["data"])
if not page["hasMore"]:
break
cursor = page["data"][-1]["createdAt"]
print(f"Total: {len(all_extractions)} extractions")
# Filter by date range
response = requests.get(
"https://api.docmap.io/v1/extractions",
headers=headers,
params={"dateFrom": "2025-01-01", "dateTo": "2025-01-31"},
)レスポンス
ステータス: 200 OK
レスポンスボディには、抽出レコードの data 配列と、追加のページが存在するかを示す hasMore ブーリアン値が含まれています。
トップレベルフィールド
| フィールド | 型 | 説明 |
|---|---|---|
data | ExtractionRecord[] | 抽出レコードの配列。 |
hasMore | boolean | 現在のページの後にさらに結果がある場合は true。runId でフィルタリング時は常に false(すべての結果が返されます)。 |
抽出レコードフィールド
配列内の各抽出レコードには、抽出を実行のレスポンスと同じフィールドが含まれます:
| フィールド | 型 | 説明 |
|---|---|---|
id | string | 一意の抽出ID(extract- プレフィックス付き)。 |
userId | string | この抽出を所有するユーザーのID。 |
templateId | string | 抽出に使用されたテンプレートのID。 |
templateName | string | 使用されたテンプレートの表示名。 |
fileName | string | アップロードされたドキュメントの元のファイル名。 |
status | "processing" | "completed" | "failed" | 現在の抽出ステータス。処理中は "processing"、成功時は "completed"、エラー時は "failed"。 |
extractedData | object | null | テンプレートフィールドに一致する抽出データ。抽出が失敗した場合は null。 |
error | string | null | 失敗を説明するエラーメッセージ。抽出が成功した場合は null。 |
variables | Variable[] | 抽出中に使用されたテンプレート変数定義の配列。 |
source | "dashboard" | "api" | 抽出がトリガーされた方法。 |
runId | string | null | 指定された場合のバッチ実行ID。 |
processingTimeMs | number | null | 処理にかかった合計時間(ミリ秒)。 |
createdAt | string | 抽出が作成されたISO 8601タイムスタンプ。 |
例
json
{
"data": [
{
"id": "extract-KmL9nOpQrStUvWxYz",
"userId": "L5kM9nRpQ7vX3yZ1wD4eF6gHjA2",
"templateId": "48291",
"templateName": "Invoice Template",
"fileName": "invoice-2024-001.pdf",
"status": "completed",
"extractedData": {
"vendor_name": "Acme Corp",
"invoice_number": "INV-2024-001",
"total_amount": 1250.00
},
"error": null,
"variables": [
{
"name": "vendor_name",
"type": "string",
"description": "Name of the vendor or supplier"
}
],
"source": "api",
"runId": null,
"processingTimeMs": 3842,
"createdAt": "2025-01-20T14:30:00.000Z"
}
],
"hasMore": true
}エラー
| ステータス | コード | 説明 |
|---|---|---|
401 | UNAUTHORIZED | APIキー/トークンが欠落、無効、または期限切れです。 |
