Entity Enricher REST API를 사용하면 엔터티를 강화하고, 스키마를 관리하며, 레코드를 프로그래밍 방식으로 검색할 수 있습니다. 모든 응답은 JSON입니다. 실시간 진행 상황은 Server-Sent Events(SSE)를 사용합니다.
세 단계로 Entity Enricher를 통합합니다:
GET /api/schema/saved저장된 스키마를 나열하거나 샘플 데이터로부터 하나를 생성합니다
POST /api/single/enrich/stream강화를 시작하고 SSE 스트리밍용 작업 ID를 받으세요
GET /api/records/{id}구조화 출력과 함께 전체 enrichment record를 조회합니다
모든 API 엔드포인트(로그인/등록 제외)는 인증이 필요합니다. 조직 액세스 키와 함께 X-API-Key 헤더를 사용하세요:
curl -H "X-API-Key: ent_your_key_here" \
https://your-instance.example.com/api/enrichment/optionsAPI Keys 페이지 또는 POST /api/auth/api-keys를 통해 API key를 생성하세요. key 유형과 권한에 대한 자세한 내용은 API Keys 가이드를 참조하세요.
| 메서드 | 엔드포인트 | 설명 |
|---|---|---|
| GET | /api/enrichment/options | 사용 가능한 model, 언어 및 전략 |
| POST | /api/single/enrich/stream | 단일 엔터티 강화 시작 (SSE용 job_id 반환) |
| POST | /api/single/enrich/sync | 비 SSE 클라이언트(Make.com, curl)를 위한 블로킹 단일 보강 |
| POST | /api/enrichment/batch/start | 여러 엔터티에 대한 배치 강화 시작 |
| POST | /api/enrichment/batch/fetch | 외부 URL에서 엔터티를 가져옵니다 |
| 메서드 | 엔드포인트 | 설명 |
|---|---|---|
| GET | /api/llm/stream/{job_id} | 모든 LLM 작업(강화, 스키마, 융합)을 위한 SSE 스트림 |
| POST | /api/llm/cancel/{job_id} | 실행 중이거나 일시 중지된 작업을 취소합니다 |
| POST | /api/llm/continue/{job_id} | 일시 중지된 작업 재개(예: 분류 불일치 후) |
| 메서드 | 엔드포인트 | 설명 |
|---|---|---|
| GET | /api/schema/saved | 저장된 모든 스키마 목록 표시 |
| POST | /api/schema/saved | 새 schema 생성 |
| POST | /api/schema/generate/stream | 샘플 데이터에서 스키마 생성 (SSE) |
| POST | /api/schema/saved/{id}/prompt/stream | 자연어로 스키마 AI 편집 (SSE) |
| 메서드 | 엔드포인트 | 설명 |
|---|---|---|
| GET | /api/records | 페이지네이션 및 필터링으로 레코드 목록 표시 |
| GET | /api/records/{id} | 구조화된 출력으로 전체 레코드 상세 정보 가져오기 |
| POST | /api/records/batch-delete | 여러 레코드 삭제 (최대 100개) |
| POST | /api/fusion/merge | 여러 model의 결과를 fusion합니다 |
| 메서드 | 엔드포인트 | 설명 |
|---|---|---|
| POST | /api/attachments | 하나 이상의 파일을 업로드합니다(multipart/form-data) |
| POST | /api/attachments/base64 | JSON base64로 파일 하나를 업로드합니다(multipart를 지원하지 않는 클라이언트용) |
| GET | /api/attachments/{id}/download | 원본 파일 바이트를 다운로드합니다 |
| DELETE | /api/attachments/{id} | 첨부 파일 삭제 (강화 후 정리) |
강화, 스키마 생성 및 융합 작업은 실시간 진행 상황을 위해 Server-Sent Events를 사용합니다. 작업을 시작하고 job_id를 받은 다음 SSE 스트림에 연결합니다:
| 이벤트 | 설명 |
|---|---|
| model_started | 모델 처리가 시작됩니다 |
| expertise_completed | 전문 분야 하나 완료(부분 결과 포함) |
| model_completed | 모델이 result, record_id, cost와 함께 완료되었습니다 |
| fusion_started / fusion_completed | 다중 모델 퓨전 수명 주기 이벤트 |
| entity_started / entity_completed | 배치 전용 엔티티별 이벤트(entity_index 포함) |
| completed | 종료 이벤트 - 연결을 닫습니다 |
| error | 작업 수준 오류가 발생했습니다 |
스키마를 나열하고, 강화를 시작하고, 결과를 스트리밍하고, 최종 레코드를 가져오는 완전한 워크플로:
import httpx
import json
BASE = "https://your-instance.example.com"
KEY = "ent_your_api_key"
HEADERS = {"X-API-Key": KEY, "Content-Type": "application/json"}
# 1. List saved schemas
schemas = httpx.get(f"{BASE}/api/schema/saved", headers=HEADERS).json()
schema_id = schemas["schemas"][0]["id"]
# 2. Start enrichment
resp = httpx.post(f"{BASE}/api/single/enrich/stream", headers=HEADERS, json={
"entity_data": {"name": "Moderna Inc", "country": "US"},
"schema_id": schema_id,
"models": ["anthropic::claude-sonnet-4-5-20250514"],
"strategy": "multi_expertise",
})
job_id = resp.json()["job_id"]
# 3. Stream SSE events
record_id = None
with httpx.stream("GET", f"{BASE}/api/llm/stream/{job_id}", headers=HEADERS) as stream:
for line in stream.iter_lines():
if not line.startswith("data: "):
continue
event = json.loads(line[6:])
if event["type"] == "model_completed" and event.get("record_id"):
record_id = event["record_id"]
elif event["type"] == "completed":
break
# 4. Retrieve the enrichment record
if record_id:
record = httpx.get(f"{BASE}/api/records/{record_id}", headers=HEADERS).json()
print(json.dumps(record["structured_output"], indent=2))두 개의 모델로 배치 강화를 시작하고 결과를 스트리밍하세요:
# Start batch enrichment
JOB_ID=$(curl -s -X POST \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
"$BASE/api/enrichment/batch/start" \
-d '{
"entities": [
{"name": "Pfizer Inc", "country": "US"},
{"name": "Roche", "country": "CH"}
],
"schema_id": "your-schema-uuid",
"models": ["anthropic::claude-sonnet-4-5-20250514", "openai::gpt-4o"],
"strategy": "multi_expertise",
"arbitration_model": "anthropic::claude-sonnet-4-5-20250514"
}' | jq -r '.job_id')
# Stream events
curl -N -H "X-API-Key: $KEY" "$BASE/api/llm/stream/$JOB_ID"
# List resulting records
curl -s -H "X-API-Key: $KEY" \
"$BASE/api/records?type=enrichment&page_size=10" | jq '.records'| 상태 | 의미 | 예시 |
|---|---|---|
| 200 | 성공 | 요청 완료 |
| 400 | 잘못된 요청 | 잘못된 모델 키 또는 누락된 필드 |
| 401 | 권한 없음 | API 키가 없거나 잘못되었습니다 |
| 403 | 금지됨 | 이 엔드포인트에 대한 권한이 부족합니다 |
| 404 | 찾을 수 없음 | 레코드, 스키마 또는 작업을 찾을 수 없습니다 |
| 500 | 서버 오류 | 내부 오류 |
오류 응답에는 사람이 읽을 수 있는 오류 메시지가 담긴 detail 필드가 포함됩니다. 스트리밍 도중 문제가 발생하면 SSE 스트림은 최종 completed 이벤트 이전에 error 이벤트 유형을 발생시킵니다.
모델은 provider_name::model_name 형식의 복합 키로 식별됩니다. 사용 가능한 모델과 해당 키를 나열하려면 GET /api/enrichment/options를 사용하세요.
anthropic::claude-sonnet-4-5-20250514openai::gpt-4ogoogle::gemini-2.5-prodeepseek::deepseek-chat애플리케이션에는 요청/응답 예시가 포함된 대화형 API 문서가 있습니다. 접근하려면 관리자 인증이 필요합니다: