Dashboard API
All dashboard API endpoints require HTTP Basic authentication.
Base path: /dashboard/api/
Metrics
GET /dashboard/api/metrics
Traffic and challenge summary.
Response 200:
{ "total_challenges": 12483, "total_items": 2500, "solve_rate_pct": 87.3, "recent_sessions": 42}Config
GET /dashboard/api/config
Read runtime config.
Response 200:
{ "risk_threshold": 0.5, "consensus_threshold": 0.6, "proxy_timeout": 30.0, "challenge_token_ttl": 300, "log_level": "INFO"}POST /dashboard/api/config
Update runtime config. All fields optional — only provided fields are updated.
Request body:
{"risk_threshold": 0.7}Response 200: Updated config object.
Datasets
GET /dashboard/api/item-datasets
List all datasets.
Response 200: JSON array of dataset objects.
[ { "id": "00000000-...", "name": "ImageNet Cats", "modality": "image", "item_count": 2500, "created_at": "2024-01-01T00:00:00Z" }]POST /dashboard/api/item-datasets
Create a dataset.
Request body:
{"name": "My Dataset", "modality": "image"}Response 201: Created dataset object (includes id).
GET /dashboard/api/item-datasets/{id}
Get a single dataset.
DELETE /dashboard/api/item-datasets/{id}
Delete a dataset and all its items and labels.
Response 204: No body.
GET /dashboard/api/item-datasets/{id}/labeled/export
Stream labels as CSV, JSON, or JSONL.
Query parameters:
| Parameter | Type | Description |
|---|---|---|
fmt | string | csv, json, or jsonl |
Response 200: Streaming response with appropriate Content-Type.
API Keys
GET /dashboard/api/apikeys
List all API keys.
Response 200: JSON array. Does not include the raw key — only prefix.
POST /dashboard/api/apikeys
Create an API key.
Request body:
{"label": "production", "datasets": ["UUID"], "sample_rate": 1.0}Response 201:
{ "id": "00000000-...", "label": "production", "key_prefix": "hg_ab", "raw_key": "hg_abcdef1234567890", "datasets": [], "sample_rate": 1.0}raw_key is returned only at creation. It cannot be retrieved again.
DELETE /dashboard/api/apikeys/{id}
Revoke an API key. Takes effect immediately.
Response 204: No body.
Proxy Rules
GET /dashboard/api/proxy-rules
List proxy rules.
Response 200: JSON array of rule objects.
[ { "id": "00000000-...", "pattern": "/health", "match_type": "exact", "priority": 100, "enabled": true }]POST /dashboard/api/proxy-rules
Create a proxy rule.
Request body:
{"pattern": "/health", "match_type": "exact", "priority": 100}PATCH /dashboard/api/proxy-rules/{id}
Update a rule (partial update).
DELETE /dashboard/api/proxy-rules/{id}
Delete a rule.
ML
GET /dashboard/api/ml/status
Check ML model status.
Response 200:
{ "model_ready": true, "sessions_with_features": 3241, "last_trained": "2024-01-01T10:00:00Z"}POST /dashboard/api/ml/train
Trigger a training run. Returns immediately; training is async.
Response 200:
{"status": "training_started"}