API 참조
문서에서 구조화된 데이터를 추출하는 REST API입니다. 파일을 전송하면 구조화된 JSON을 받습니다.
REST APIJSON 응답웹훅60개 이상 언어
인증
모든 요청에는 X-API-Key 헤더가 필요합니다. Airparser 계정의 설정 → API에서 키를 받으세요.
cURL
curl https://api.airparser.com/inboxes \
-H "X-API-Key: YOUR_API_KEY"API 키를 안전하게 보관하세요 — 비밀번호처럼 다루세요.
문서 분석
모든 파일을 업로드하고 단일 동기 요청으로 완전히 추출된 데이터를 받으세요 — 웹훅도, 폴링도, 두 번째 호출도 필요 없습니다. 응답에는 워크플로우에서 즉시 사용할 수 있는 구조화된 JSON으로 추출된 모든 필드가 포함됩니다.
curl \
-X POST \
https://api.airparser.com/inboxes/<INBOX_ID>/upload-sync \
-F 'file=@./receipt.pdf' \
-H "X-API-Key: <YOUR_API_KEY>"응답200 OK
{
"doc_id": "64abc123def456...",
"parsing_in_progress": false,
"status": "parsed",
"name": "invoice.pdf",
"content_type": "application/pdf",
"created_at": "2026-03-10T12:00:00.000Z",
"processed_at": "2026-03-10T12:00:04.321Z",
"json": {
"invoice_number": "INV-001",
"vendor": "Acme Corp",
"total": 1250.00,
"currency": "USD",
"date": "2024-01-15"
}
}추출된 데이터 조회
ID로 문서를 조회하여 추출 상태와 결과를 받으세요. 이 엔드포인트를 폴링하거나 웹훅을 사용하여 처리 완료 시점을 확인하세요.
GET
/documents/{document_id}cURL
curl https://api.airparser.com/documents/doc_abc123 \
-H "X-API-Key: YOUR_API_KEY"응답200 OK
{
"doc_id": "64abc123def456...",
"parsing_in_progress": false,
"status": "parsed",
"name": "invoice.pdf",
"content_type": "application/pdf",
"created_at": "2026-03-10T12:00:00.000Z",
"processed_at": "2026-03-10T12:00:04.321Z",
"json": {
"invoice_number": "INV-001",
"vendor": "Acme Corp",
"total": 1250.00,
"date": "2024-01-15"
}
}추출 스키마 정의
추출할 필드를 정의하세요. 스칼라 필드, 목록(항목용), 열거형을 지원합니다.
POST
/inboxes/{inbox_id}/schema{
"fields": [
{
"type": "scalar",
"data": {
"name": "invoice_number",
"description": "Invoice reference number",
"type": "string",
"default_value": ""
}
},
{
"type": "list",
"data": {
"name": "items",
"description": "List of items in the invoice",
"attributes": [
{
"name": "description",
"description": "Item description",
"type": "string",
"default_value": ""
},
{
"name": "amount",
"description": "Item amount",
"type": "decimal",
"default_value": "0.00"
}
]
}
},
{
"type": "enum",
"data": {
"name": "payment_status",
"description": "Current payment status",
"values": ["paid", "pending", "overdue"]
}
}
]
}후처리
통합으로 전송되기 전에 추출된 데이터에서 Python 코드를 실행하세요. 비즈니스 로직을 추가하고, 필드를 병합하고, 값을 서식화하세요.
필드 병합
# Merge first and last name into full name
data['fullname'] = data['first_name'] + " " + data['last_name']
# Using f-strings (recommended)
data["fullname"] = f"{data['first_name']} {data['last_name']}"
# Using format() function
data['fullname'] = '{} {}'.format(data['first_name'], data['last_name'])조건부 로직
# Only process invoices above certain amount
if float(data.get('total_amount', 0)) > 1000:
data['priority'] = 'high'
else:
data['priority'] = 'normal'
# Add timestamp
import datetime
data['processed_at'] = datetime.datetime.now().isoformat()웹훅
Airparser는 추출이 완료되면 엔드포인트로 POST 요청을 전송합니다. 200 로 응답하여 확인하세요.
설정 단계
- 1 서버나 ngrok과 같은 서비스에서 웹훅 엔드포인트 URL을 복사하세요.
- 2 Airparser 계정에서 통합 → 웹훅으로 이동하세요.
- 3 "Create a webhook"을 클릭하고 엔드포인트 URL을 붙여넣으세요.
- 4 샘플 문서로 웹훅을 테스트하여 통합을 확인하세요.
import json
from flask import Flask, request
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
payload = request.data
data = json.loads(payload)
# Process the parsed data
# data contains all extracted fields
return {'success': True}
if __name__ == '__main__':
app.run(port=4242)리소스
비기술적인 개요를 찾고 계신가요? 문서 추출 API란 무엇인가 를 읽어보세요 — 코드 예제 없이 개념, 사용 사례, Airparser API의 작동 방식을 다룹니다.
Postman 컬렉션