Skip to main content

엔드포인트

POST /v2/workflows

인증

모든 요청에 X-API-Key 헤더 필수:
curl -X POST https://api.imprun.dev/v2/workflows \
  -H "X-API-Key: your-api-key-here"

요청 본문

{
  "type": "scraping",  // 또는 "document_parsing"
  "params": {
    "siteCode": "HOMETAX",  // 또는 "WEHAGO" 등
    // 각 타입별 파라미터
  }
}

응답

성공 (200 OK)

{
  "id": "wf_abc123xyz",
  "status": "RUNNING",
  "createdAt": "2026-03-07T10:20:00Z",
  "progressUrl": "https://imprun.dev/console/workflows/wf_abc123xyz"
}

실패

{
  "error": "Invalid request",
  "message": "credentialId is required",
  "code": "VALIDATION_ERROR"
}

워크플로우 상태

상태설명
RUNNING실행 중
SUCCEEDED성공 완료
FAILED실패
TIMED_OUT타임아웃

Scraping 요청

홈택스

{
  "type": "scraping",
  "params": {
    "siteCode": "HOMETAX",
    "function": "get_business_info|get_sales_stats|get_purchase_stats|get_vat_info",
    "credentialId": "cred_...",
    "year": 2025,
    "month": 3
  }
}

웨하고

{
  "type": "scraping",
  "params": {
    "siteCode": "WEHAGO",
    "credentialId": "cred_...",  // 또는 sessionToken
    "group": "financial|transactions",
    "endpoint": "balance-sheet|sales-report|...",
    "period": "2025-03"
  }
}

Document Parsing 요청

{
  "type": "document_parsing",
  "params": {
    "documentType": "land|building|aggregate_building",
    "imageUrl": "https://...",  // 또는 imageBase64
    "priority": "normal|high"
  }
}

에러 코드

코드메시지해결
INVALID_API_KEY유효하지 않은 API 키API 키 확인
INSUFFICIENT_CREDIT크레딧 부족크레딧 충전
CREDENTIAL_EXPIRED자격증명 만료자격증명 재등록
AUTHENTICATION_FAILED로그인 실패자격증명 확인
TIMEOUT타임아웃나중에 재시도

속도 제한

  • 1초당 최대 10개 요청
  • 1시간당 최대 10,000개 요청
제한 초과 시 429 Too Many Requests 응답.

예제

cURL

curl -X POST https://api.imprun.dev/v2/workflows \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "scraping",
    "params": {
      "siteCode": "HOMETAX",
      "function": "get_business_info",
      "credentialId": "cred_abc123",
      "year": 2025
    }
  }'

JavaScript

const response = await fetch('https://api.imprun.dev/v2/workflows', {
  method: 'POST',
  headers: {
    'X-API-Key': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    type: 'scraping',
    params: {
      siteCode: 'WEHAGO',
      credentialId: 'cred_abc123',
      group: 'financial',
      endpoint: 'balance-sheet'
    }
  })
});

const data = await response.json();
console.log(data.id);  // 워크플로우 ID

Python

import requests

headers = {
  'X-API-Key': 'your-api-key',
  'Content-Type': 'application/json'
}

payload = {
  'type': 'scraping',
  'params': {
    'siteCode': 'HOMETAX',
    'function': 'get_business_info',
    'credentialId': 'cred_abc123',
    'year': 2025
  }
}

response = requests.post(
  'https://api.imprun.dev/v2/workflows',
  headers=headers,
  json=payload
)

data = response.json()
print(data['id'])  # 워크플로우 ID

다음 단계