title: Cluster Agent API version: 1.0 date: 2026-10-25 author: Core Team status: Active
Asynchronous face clustering agent that automatically groups similar faces into identities. Runs as a background job.
POST /api/v1/file/:file_uuid/cluster-agentAuth: Required Scope: file-level
Trigger asynchronous face clustering for a file. Returns immediately with a job ID. Clustering runs in the background.
| Parameter | Type | Description |
|---|---|---|
file_uuid |
string | File UUID (32-char hex) |
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
confirm |
boolean | Yes | false | Must be true to trigger clustering |
min_confidence |
float | No | 0.6 | Minimum face confidence to include |
algorithm |
string | No | "dbscan" | Clustering algorithm ("dbscan", "kmeans") |
curl -X POST "$API/api/v1/file/$FILE_UUID/cluster-agent" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"confirm": true, "min_confidence": 0.6}'
{
"success": true,
"job_id": "cluster_abc123",
"file_uuid": "3a6c1865...",
"status": "queued",
"message": "Cluster job queued for processing"
}
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on 202 |
job_id |
string | Job ID for status tracking |
file_uuid |
string | File UUID |
status |
string | Job status ("queued", "running", "completed", "failed") |
message |
string | Human-readable status |
| HTTP | When |
|---|---|
400 |
confirm not set to true |
404 |
File not found |
409 |
Job already running for this file |
401 |
Missing or invalid API key |
GET /api/v1/cluster-job/:job_idAuth: Required Scope: job-level
Get status of a cluster job. Returns progress, statistics, and results if completed.
| Parameter | Type | Description |
|---|---|---|
job_id |
string | Job ID returned from trigger endpoint |
curl -s "$API/api/v1/cluster-job/cluster_abc123" -H "X-API-Key: $KEY"
{
"job_id": "cluster_abc123",
"file_uuid": "3a6c1865...",
"status": "completed",
"progress": {
"total_faces": 1523,
"processed": 1523,
"percentage": 100
},
"result": {
"clusters_found": 12,
"identities_created": 8,
"identities_updated": 4
},
"started_at": "2026-10-25T10:00:00Z",
"completed_at": "2026-10-25T10:05:30Z"
}
| Field | Type | Description |
|---|---|---|
job_id |
string | Job ID |
file_uuid |
string | File UUID |
status |
string | "running", "completed", "failed", "cancelled" |
progress |
object | Progress information |
result |
object | Final results (if completed) |
error |
string | Error message (if failed) |
started_at |
string | ISO 8601 timestamp |
completed_at |
string | ISO 8601 timestamp (if completed) |
DELETE /api/v1/cluster-job/:job_idAuth: Required Scope: job-level
Cancel a running cluster job. Cannot cancel completed or failed jobs.
| Parameter | Type | Description |
|---|---|---|
job_id |
string | Job ID |
curl -X DELETE "$API/api/v1/cluster-job/cluster_abc123" -H "X-API-Key: $KEY"
{
"success": true,
"job_id": "cluster_abc123",
"status": "cancelled",
"message": "Job cancelled successfully"
}
DBSCAN Parameters:
- eps: 0.3 (distance threshold)
- min_samples: 5 (minimum cluster size)
Quality Metrics: - Intra-cluster similarity: Average pairwise similarity within cluster - Inter-cluster separation: Average distance to nearest cluster
# After processing, trigger clustering
curl -X POST "$API/api/v1/file/$FILE_UUID/cluster-agent" \
-H "X-API-Key: $KEY" \
-d '{"confirm": true}'
# Poll job status
curl -s "$API/api/v1/cluster-job/$JOB_ID" -H "X-API-Key: $KEY" | jq '.status'
# If clustering takes too long
curl -X DELETE "$API/api/v1/cluster-job/$JOB_ID" -H "X-API-Key: $KEY"
| File Size | Face Count | Processing Time |
|---|---|---|
| 10 min video | 500 faces | ~30 seconds |
| 30 min video | 1500 faces | ~2 minutes |
| 90 min video | 4500 faces | ~8 minutes |
Notes: - Processing time scales linearly with face count - Uses in-memory job registry (cleared on server restart) - Concurrent jobs are supported but resource-intensive
| Error | Cause | Solution |
|---|---|---|
400 Bad Request |
confirm not set |
Add "confirm": true to request body |
404 Not Found |
File not found | Verify file_uuid |
409 Conflict |
Job already running | Wait for current job to complete or cancel it |
500 Internal Error |
Clustering failed | Check server logs for details |
| Version | Date | Changes |
|---|---|---|
| 1.0 | 2026-10-25 | Initial documentation |