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으로 추출된 모든 필드가 포함됩니다.

POST/inboxes/{inbox_id}/upload-syncAPI 문서 →
curl \
  -X POST \
  https://api.airparser.com/inboxes/<INBOX_ID>/upload-sync \
  -F 'file=@./receipt.pdf' \
  -H "X-API-Key: <YOUR_API_KEY>"import requests

header = {"X-API-Key": "<API_KEY>"}
url = "https://api.airparser.com/inboxes/<INBOX_ID>/upload-sync"

with open('invoice.pdf', 'rb') as f:
    files = {'file': f}
    with requests.request("POST", url, files=files, headers=header) as response:
        print('response: ', response)const fetch = require("node-fetch");
const fs = require("fs");
const FormData = require("form-data");

const APIKEY = "<YOUR_API_KEY>";
const inboxId = "<INBOX_ID>";
const filePath = "/path/to/your/file.pdf";
const metadata = { foo: "bar" };

async function parseDocument(inboxId, filePath, metadata) {
  const url = `https://api.airparser.com/inboxes/${inboxId}/upload-sync`;

  const fileStream = fs.createReadStream(filePath);

  const form = new FormData();
  form.append("file", fileStream);
  form.append("meta", JSON.stringify(metadata));

  try {
    const response = await fetch(url, {
      method: "POST",
      body: form,
      headers: {
        "X-API-Key": APIKEY,
      },
    });

    const docId = await response.json();
    console.log(response.status);
    console.log("Document id:", docId);
  } catch (e) {
    console.error("Error:", e.message);
  }
}

parseDocument(inboxId, filePath, metadata);<?php

$apikey = '<API_KEY>';
$url = 'https://api.airparser.com/inboxes/<INBOX_ID>/upload-sync';
$filepath = './invoice.pdf';

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'X-API-Key: ' . $apikey
));
curl_setopt($curl, CURLOPT_POST, true);

$meta = array(
  'foo' => 'bar',
  'my_id' => 42,
);
$metaJson = json_encode($meta);

curl_setopt($curl, CURLOPT_POSTFIELDS, array(
    'file' => curl_file_create($filepath, 'application/pdf', 'invoice.pdf'),
    'meta' => $metaJson
));

$response = curl_exec($curl);
curl_close($curl);

echo $response;
응답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. 1 서버나 ngrok과 같은 서비스에서 웹훅 엔드포인트 URL을 복사하세요.
  2. 2 Airparser 계정에서 통합 → 웹훅으로 이동하세요.
  3. 3 "Create a webhook"을 클릭하고 엔드포인트 URL을 붙여넣으세요.
  4. 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)const express = require('express');
const app = express();

app.post('/webhook', express.raw({type: 'application/json'}), (request, response) => {
  const payload = request.body;
  const data = JSON.parse(payload);

  // Process the parsed data
  // data contains all extracted fields

  // Return 200 to acknowledge receipt
  response.send();
});

app.listen(4242, () => console.log('Running on port 4242'));<?php
$payload = @file_get_contents('php://input');
$data = json_decode($payload, true);

// Process the parsed data
// $data contains all extracted fields

// Always return 200 to acknowledge receipt
http_response_code(200);
echo "OK";

리소스

비기술적인 개요를 찾고 계신가요? 문서 추출 API란 무엇인가 를 읽어보세요 — 코드 예제 없이 개념, 사용 사례, Airparser API의 작동 방식을 다룹니다.