The Entity Enricher REST API lets you enrich entities, manage schemas, and retrieve records programmatically. All responses are JSON. Real-time progress uses Server-Sent Events (SSE).
Integrate Entity Enricher in three steps:
GET /api/schema/savedList saved schemas or generate one from sample data
POST /api/single/enrich/streamStart enrichment, get a job ID for SSE streaming
GET /api/records/{id}Retrieve the full enrichment record with structured output
All API endpoints (except login/register) require authentication. Use the X-API-Key header with an organization access key:
curl -H "X-API-Key: ent_your_key_here" \
https://your-instance.example.com/api/enrichment/optionsCreate API keys from the API Keys page or via POST /api/auth/api-keys. See the API Keys guide for details on key types and permissions.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/enrichment/options | Available models, languages, and strategies |
| POST | /api/single/enrich/stream | Start single entity enrichment (returns job_id) |
| POST | /api/enrichment/batch/start | Start batch enrichment for multiple entities |
| POST | /api/enrichment/batch/fetch | Fetch entities from an external URL |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/llm/stream/{job_id} | SSE stream for any LLM job (enrichment, schema, fusion) |
| POST | /api/llm/cancel/{job_id} | Cancel a running or paused job |
| POST | /api/llm/continue/{job_id} | Resume a paused job (e.g., after classification mismatch) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/schema/saved | List all saved schemas |
| POST | /api/schema/saved | Create a new schema |
| POST | /api/schema/generate/stream | Generate schema from sample data (SSE) |
| POST | /api/schema/saved/{id}/prompt/stream | AI-edit schema with natural language (SSE) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/records | List records with pagination and filtering |
| GET | /api/records/{id} | Get full record detail with structured output |
| POST | /api/records/batch-delete | Delete multiple records (max 100) |
| POST | /api/fusion/merge | Merge results from multiple models |
Enrichment, schema generation, and fusion operations use Server-Sent Events for real-time progress. Start a job, get a job_id, then connect to the SSE stream:
| Event | Description |
|---|---|
| model_started | Model processing begins |
| expertise_completed | One expertise domain finished (with partial results) |
| model_completed | Model finished with result, record_id, and cost |
| fusion_started / fusion_completed | Multi-model fusion lifecycle events |
| entity_started / entity_completed | Batch-specific per-entity events (include entity_index) |
| completed | Terminal event - close the connection |
| error | Job-level error occurred |
A complete workflow that lists schemas, starts enrichment, streams results, and retrieves the final record:
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 a batch enrichment with two models and stream the results:
# 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'| Status | Meaning | Example |
|---|---|---|
| 200 | Success | Request completed |
| 400 | Bad request | Invalid model key or missing field |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Insufficient role for this endpoint |
| 404 | Not found | Record, schema, or job not found |
| 500 | Server error | Internal failure |
Error responses include a detail field with a human-readable error message. SSE streams emit an error event type before the terminal completed event if something fails mid-stream.
Models are identified by composite keys in the format provider_name::model_name. Use GET /api/enrichment/options to list available models and their keys.
anthropic::claude-sonnet-4-5-20250514openai::gpt-4ogoogle::gemini-2.5-prodeepseek::deepseek-chatThe application includes interactive API documentation with request/response examples. Requires admin authentication to access: