추출 목록
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 키 / 토큰. |
