{"openapi":"3.0.3","info":{"title":"(라이트)EDI 수량·금액 자동정리 API","version":"1.0.0","description":"EDI·처방전 사진을 올리면 약품별 수량·처방량·단가·금액을 표로 정리해 드립니다 — 저비용·고속 라이트 버전입니다. 깨끗한 단일 표에 최적화했으며, 표가 불완전하면 자동 보정 없이 '확인 필요'로 표시합니다. 최고 정확도(자동 재추출·보정)가 필요하면 상위 버전(EDI 수량·금액 자동정리)을 사용하세요."},"servers":[{"url":"https://marketapi.nadoo.ai"}],"security":[{"ApiKeyAuth":[]}],"paths":{"/api/v1/balance":{"get":{"summary":"충전 잔액 조회","description":"현재 계정의 선불 충전 잔액(원)과 저잔액 알림 임계값을 반환합니다. 상품과 무관한 계정 단위 조회이며 과금되지 않습니다.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceKrw":{"type":"integer","description":"현재 선불 잔액(원)"},"lowBalanceThresholdKrw":{"type":"integer","nullable":true,"description":"저잔액 이메일 알림 임계값(원). null=알림 꺼짐"},"updatedAt":{"type":"string","format":"date-time","nullable":true,"description":"잔액 마지막 변경 시각(ISO 8601). 충전/차감 이력이 없으면 null"}}},"example":{"balanceKrw":49800,"lowBalanceThresholdKrw":5000,"updatedAt":"2026-08-06T02:31:00.000Z"}}}},"401":{"description":"API 키 누락/무효 (invalid_key)"}}}},"/api/v1/hira-extract-lite/extract":{"post":{"summary":"(라이트)EDI 수량·금액 자동정리 — 단건","description":"성공 호출당 200원 (무료 10회 후 과금). 값은 이미지에서 읽어낸 원본입니다.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"재시도 이중 과금 방지. 같은 키+같은 본문은 재처리 없이 최초 결과 반환, 같은 키+다른 본문은 422."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"image":{"type":"string","description":"base64 이미지(≤~18MB). 대용량은 imageUrl 권장"},"imageUrl":{"type":"string","format":"uri","description":"이미지 https URL(presigned 권장)"},"templateId":{"type":"string","description":"프롬프트 템플릿 버전(선택)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"requestId":{"type":"string"},"documentType":{"type":"string","description":"drug_table | business_registration | receipt | other 등"},"foundTable":{"type":"boolean"},"items":{"type":"array","items":{"type":"object","properties":{"drugCode":{"type":"string","nullable":true,"description":"약가코드(보이는 그대로, 9자리 아닐 수 있음)"},"drugName":{"type":"string","nullable":true},"quantity":{"type":"number","nullable":true},"days":{"type":"number","nullable":true},"prescribedQty":{"type":"number","nullable":true,"description":"총처방량(총사용량/총투여량)"},"unitPrice":{"type":"number","nullable":true},"totalAmount":{"type":"number","nullable":true},"codeInMaster":{"type":"boolean","description":"약가 마스터 조회 여부"},"suggestedDrugCode":{"type":"string","nullable":true,"description":"코드 미조회 시 약품명 매칭으로 추정한 약가코드(교정 제안). drugCode(OCR 원본)를 대체하지 않으며, 신호등도 올리지 않음. null=추정 없음"},"priceCheck":{"type":"string","enum":["current","historical","mismatch","none"]},"status":{"type":"string","enum":["GREEN","YELLOW","RED"]},"needsReview":{"type":"boolean"},"review":{"type":"array","items":{"type":"string"}}}}},"summary":{"type":"object","properties":{"items":{"type":"integer"},"needsReview":{"type":"integer"},"byStatus":{"type":"object","properties":{"green":{"type":"integer"},"yellow":{"type":"integer"},"red":{"type":"integer"}}},"completeExtraction":{"type":"boolean","nullable":true}}},"geometry":{"type":"object","description":"전처리 좌표. crop 은 크롭본이 정본일 때만 채워진다(크롭 실패·원본 재추출 시 null).","properties":{"rotation":{"type":"integer","enum":[0,90,180,270],"description":"적용된 총 회전각(반시계) — 서비스 보정 + 표 검출기 자체 보정의 합. 0=보정 없음. source→oriented 재현 시 반시계로 이 각도만큼 회전"},"source":{"type":"object","properties":{"width":{"type":"integer"},"height":{"type":"integer"}},"description":"업로드 원본 크기"},"oriented":{"type":"object","properties":{"width":{"type":"integer"},"height":{"type":"integer"}},"description":"회전 보정 후 크기"},"crop":{"type":"object","nullable":true,"properties":{"score":{"type":"number","nullable":true},"corners":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}}},"description":"회전 보정본 기준 꼭짓점 4개(시계방향 TL·TR·BR·BL)"},"box":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}}},"sourceCorners":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}}},"description":"업로드 원본 기준 꼭짓점 4개(역회전 적용)"},"sourceBox":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}}},"normalized":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}},"description":"회전 보정본 기준 0~1 비율"}}}}},"meta":{"type":"object","description":"진단(imageReadable/imageIssues/rotationApplied/cropped/template)"},"cost":{"type":"object","properties":{"krw":{"type":"number"},"free":{"type":"boolean"}}},"balanceKrw":{"type":"number"}}}}}}}}},"/api/v1/uploads":{"post":{"summary":"대용량 업로드 URL 발급(presigned)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"contentType":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"uploadUrl":{"type":"string"},"imageUrl":{"type":"string"},"expiresIn":{"type":"integer"}}}}}}}}},"/api/v1/hira-extract-lite/extract-batch-async":{"post":{"summary":"(라이트)EDI 수량·금액 자동정리 — 대량 비동기","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"imageUrls":{"type":"array","items":{"type":"string","format":"uri"}},"images":{"type":"array","items":{"type":"string"}},"templateId":{"type":"string"}}}}}},"responses":{"202":{"description":"Queued","content":{"application/json":{"schema":{"type":"object","properties":{"jobId":{"type":"string"},"status":{"type":"string"},"pollUrl":{"type":"string"}}}}}}}}},"/api/v1/jobs/{id}":{"get":{"summary":"작업 폴링","description":"기본은 경량(항목별 itemCount·foundTable·byStatus·extractionId·geometry). items=1 이면 각 항목에 items(단건 /extract 동일 스키마)를 병합.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"items","in":"query","required":false,"schema":{"type":"string","enum":["1"]},"description":"1 이면 결과 항목에 items 를 병합(대량 배치는 응답이 커짐)."}],"responses":{"200":{"description":"OK"}}}},"/api/v1/extractions/{id}":{"get":{"summary":"추출 결과 단건 조회(배치 항목 상세)","description":"폴링 결과의 extractionId 로 개별 추출의 items·summary 를 조회. 본인 소유만.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"extractionId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"extractionId":{"type":"string"},"documentType":{"type":"string"},"foundTable":{"type":"boolean"},"geometry":{"type":"object","description":"전처리 좌표. crop 은 크롭본이 정본일 때만 채워진다(크롭 실패·원본 재추출 시 null).","properties":{"rotation":{"type":"integer","enum":[0,90,180,270],"description":"적용된 총 회전각(반시계) — 서비스 보정 + 표 검출기 자체 보정의 합. 0=보정 없음. source→oriented 재현 시 반시계로 이 각도만큼 회전"},"source":{"type":"object","properties":{"width":{"type":"integer"},"height":{"type":"integer"}},"description":"업로드 원본 크기"},"oriented":{"type":"object","properties":{"width":{"type":"integer"},"height":{"type":"integer"}},"description":"회전 보정 후 크기"},"crop":{"type":"object","nullable":true,"properties":{"score":{"type":"number","nullable":true},"corners":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}}},"description":"회전 보정본 기준 꼭짓점 4개(시계방향 TL·TR·BR·BL)"},"box":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}}},"sourceCorners":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}}},"description":"업로드 원본 기준 꼭짓점 4개(역회전 적용)"},"sourceBox":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}}},"normalized":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}},"description":"회전 보정본 기준 0~1 비율"}}}}},"items":{"type":"array","items":{"type":"object","properties":{"drugCode":{"type":"string","nullable":true,"description":"약가코드(보이는 그대로, 9자리 아닐 수 있음)"},"drugName":{"type":"string","nullable":true},"quantity":{"type":"number","nullable":true},"days":{"type":"number","nullable":true},"prescribedQty":{"type":"number","nullable":true,"description":"총처방량(총사용량/총투여량)"},"unitPrice":{"type":"number","nullable":true},"totalAmount":{"type":"number","nullable":true},"codeInMaster":{"type":"boolean","description":"약가 마스터 조회 여부"},"suggestedDrugCode":{"type":"string","nullable":true,"description":"코드 미조회 시 약품명 매칭으로 추정한 약가코드(교정 제안). drugCode(OCR 원본)를 대체하지 않으며, 신호등도 올리지 않음. null=추정 없음"},"priceCheck":{"type":"string","enum":["current","historical","mismatch","none"]},"status":{"type":"string","enum":["GREEN","YELLOW","RED"]},"needsReview":{"type":"boolean"},"review":{"type":"array","items":{"type":"string"}}}}},"summary":{"type":"object"}}}}}},"404":{"description":"결과 없음/타인 소유 (not_found)"}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}}}}