API server
pip install 'metacrafter[server]'
metacrafter server run --host 127.0.0.1 --port 10399
The server is a FastAPI application (metacrafter.interfaces.http_api). It loads the
rules and registry data once and serves every request from the same scan service as the
CLI and the Python API. The OpenAPI description is at /openapi.json and interactive docs
at /docs.
Set METACRAFTER_API_TOKEN to require Authorization: Bearer <token> on scan routes.
Routes
| Route | Purpose |
|---|---|
POST /v2/scan | Classify records; returns report version 3 |
POST /v2/classify | Classify columns given as samples; returns report version 3 |
POST /api/v1/scan_data | Pre-1.0 endpoint (JSON array body, options as query parameters) |
GET /health | Liveness |
GET /ready | 200 when rules and registry data are loaded, otherwise 503 |
POST /v2/scan
{
"records": [{"name": "John", "email": "john@example.com"}],
"options": {"limit": 1000, "confidence": 80, "contexts": "pii", "parse_dates": true}
}
POST /v2/classify
{
"columns": [
{"name": "contact_email", "values": ["a@example.com", "b@example.org"]},
{"name": "inn", "values": ["7707083893"]}
]
}
Options for both routes: limit, confidence, contexts, langs, fields,
parse_dates, stop_on_match, ignore_imprecise, except_empty, explain,
include_samples (default false: statistics in the response omit scanned values).