LexFlow Public API (v1)

프로그래매틱 액세스를 위한 공개 엔드포인트 목록입니다. 응답은 JSON · Atom · CSV · iCalendar 형식이며, 모든 응답은 Cache-Control: public + ETag/304 conditional GET을 지원합니다.

Read-only UTF-8 No auth Rate limit: nginx default
빠른 시작 (curl 예제)
# 자동완성 — 사건번호 prefix
curl -sS "https://lexflow.clinic/api/v1/search/suggest?q=2025%EB%8F%84"

# 최근 헌재결정례 50건 JSON
curl -sS "https://lexflow.clinic/api/v1/caselaw/detc/recent" | jq '.items[0]'

# 단일 판례 detail
curl -sS "https://lexflow.clinic/api/v1/caselaw/prec/100004" | jq '.meta'

# 검색 결과 CSV (Excel/한컴 호환 BOM 포함)
curl -sS "https://lexflow.clinic/api/caselaw_search.php?q=%EC%9E%84%EB%8C%80%EC%B0%A8&type=prec&limit=50&format=csv" -o cases.csv

# 법령 전 조문 CSV
curl -sS "https://lexflow.clinic/law/%EB%AF%BC%EB%B2%95/articles.csv" -o civil-law.csv

# Atom 피드 구독 (RSS reader)
curl -sS "https://lexflow.clinic/caselaw/prec.atom"

# Conditional GET (ETag로 변경 없으면 304 + body 0 byte)
ETAG=$(curl -sSI "https://lexflow.clinic/api/v1/caselaw/prec/recent" | awk -F'"' '/etag/i {print $2}')
curl -sS -o /dev/null -w "%{http_code}\n" -H "If-None-Match: \"$ETAG\"" \
     "https://lexflow.clinic/api/v1/caselaw/prec/recent"
# → 304

검색 + 자동완성

메서드 경로 설명
GET /api/v1/search/suggest?q={q}&types={law,case,glossary,tool,router} 헤더 자동완성 — 법령명·판례 제목·사건번호·용어·도구를 prefix/contain 매치. types 파라미터로 tier 토글.
GET /api/caselaw_search.php?q={q}&type={prec|detc|expc|decc|ppc|all}&limit=N&format=csv 판례 본문 검색 (ripgrep 기반, 200ms 내). format=csv 추가 시 UTF-8 BOM CSV로 다운로드.
GET /api/caselaw_search.php?q={q}&type=all&format=atom 판례 검색 결과 Atom 피드 (keyword-watch in RSS reader).
GET /api/search.php?q={q}&format=atom 법령 본문 검색 결과 Atom 피드 (조문 단위 entry).
GET /api/admrul_search.php?q={q}&format=atom 행정규칙 검색 결과 Atom 피드 (행정규칙 단위 entry).
GET /api/v1/trending 최근 7일 trending 검색어 (익명 집계, query+scope+count, 5min 캐시).

법령

메서드 경로 설명
GET /api/v1/laws/families 법령 family 목록 (페이지네이션, 필터링).
GET /api/v1/laws/recent 최근 시행·개정 법령 top 50 JSON (Atom 피드 /recent.atom의 카운터파트).
GET /api/v1/laws/pending 시행 예정 법령 top 200 JSON (.ics /pending.ics의 카운터파트).
GET /law/{family}/articles.csv 법령 전 조문 CSV (UTF-8 BOM, num_label/law_kind/part/chapter/section/title/body).
GET /api/v1/law/{family} 단일 법령 family JSON (article_total / by_kind / last_amendment / csv_url).
POST /api/v1/verify-citations 인용 검증기 — 본문에서 "법령명 제N조 제K항" 인용을 파싱하고 LexFlow 미러 DB와 cross-check (anti-hallucination, 법령 약칭 자동 해결).

판례·결정례

메서드 경로 설명
GET /caselaw/{type}.atom Atom 1.0 피드 — 5종: prec/detc/decc/expc/ppc. RSS 리더 구독.
GET /api/v1/caselaw/{type}/recent 최근 50건 JSON — 같은 5종 type. type별 1개 라우트.
GET /api/v1/caselaw/{type}/{id} 단일 사건 detail JSON — meta + 본문 fields + 인용 통계 + 외부 URL.
GET /api/v1/caselaw/{type}/{id}?compact=1 판결문 압축본 — head 800 + 중략 + tail 400 + 참조조문/판례 densify (RAG/LLM 토큰 절감).
GET /api/v1/decisions 17 unified decision domains 카탈로그 (korean-law-mcp 호환) — 우리 보유 7종 + 미보유 10종 status.

행정규칙

메서드 경로 설명
GET /api/v1/admrul/{id} 단일 행정규칙 JSON — meta + articles 본문.

용어집·기타

메서드 경로 설명
GET /api/v1/glossary 법률 용어집 전체 (term + slug + definition + source).
GET /api/v1/wiki?family={family} 위키 항목 목록 (조문 해설).
GET /api/v1/comments?ref={kind}/{id} 특정 ref에 달린 공개 댓글.
GET /api/v1/health 시스템 헬스체크 (ping/uptime/version).
GET /api/v1/stats 주요 통계 (law families, caselaw, admrul, glossary 카운트).

Atom 피드 (RSS 구독)

메서드 경로 설명
GET /recent.atom 최근 시행 법령 Atom.
GET /posts.atom LexFlow 소식 Atom.
GET /caselaw/prec.atom 판례 Atom (사이드카 기반).
GET /caselaw/detc.atom 헌재결정례 Atom.
GET /caselaw/decc.atom 행정심판례 Atom.
GET /caselaw/expc.atom 법령해석례 Atom.
GET /caselaw/ppc.atom 개인정보위 의결 Atom.
GET /pending.ics 시행 예정 법령 iCalendar (RFC 5545).

사용 안내 + 라이선스

  • 인증 — 공개 API는 인증 없이 호출 가능. 인증 필요 endpoint는 별도 안내.
  • Rate limit — nginx 단의 IP-당 burst 제한 적용. 대량 sync 필요 시 사전 협의.
  • 데이터 소스 — 모든 데이터는 open.law.go.kr OpenAPI / data.go.kr 등 공공 OpenAPI에서 합법 수집한 미러. 1차 출처는 law.go.kr·scourt.go.kr·ccourt.go.kr.
  • 변경 정책 — v1 endpoint는 6개월 이상 유지. breaking change 시 deprecation header (Sunset) 및 별도 공지.
  • 주의 — 본 API는 정보 제공용으로, 법률 자문이 아닙니다 (변호사법 §109).