document_type: "api_reference" service: "MOMENTRY_CORE" title: "Momentry Core API 端點總覽" date: "2026-05-17" version: "V1.4" status: "active" owner: "M5" created_by: "OpenCode"
| 項目 | 內容 |
|---|---|
| 目標讀者 | developer |
| 預備知識 | 需有 API Key |
| Environment | URL | Purpose |
|---|---|---|
| Playground (Dev) | http://localhost:3003 |
Development and testing |
| Production | http://localhost:3002 |
Production deployment |
| External (M5) | https://m5api.momentry.ddns.net |
Remote access |
All examples in this documentation use these environment variables:
API="http://localhost:3003"
KEY="your-api-key-here"
All endpoints under /api/v1/* require authentication.
The following endpoints are public (no auth needed):
GET /healthPOST /api/v1/auth/loginPOST /api/v1/auth/logoutThe system supports three authentication methods, checked in priority order by the middleware:
Middleware priority:
1. Session Cookie (Portal/browser)
2. JWT Bearer (API clients: n8n, CLI)
3. API Key Header (legacy compatibility)
4. API Key Query Param (?api_key=)
| Mode | Transport | Expiry | Scope | Best for |
|---|---|---|---|---|
| Session Cookie | Cookie: session_id=<uuid> |
24h | per-browser session | Portal (browser) |
| JWT | Authorization: Bearer <token> |
1h | per-login token | API clients (n8n, CLI, scripts) |
| API Key | X-API-Key: <key> |
90d | fixed key for automation | Legacy scripts, WordPress |
Default accounts & API keys:
| Username | Password | API Key | Role |
|---|---|---|---|
admin |
admin |
— | admin |
demo |
demo |
muser_demo_key_32chars_abcdef1234567890 |
user |
The demo API key is set via MOMENTRY_DEMO_API_KEY env var and can be used in place of JWT for marcom integrations:
# Using API key instead of JWT
curl -s "$API/api/v1/files/scan" -H "X-API-Key: muser_demo_key_32chars_abcdef1234567890"
# Login as admin
curl -s -X POST "$API/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "admin"}'
# Login as demo user
curl -s -X POST "$API/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{"username": "demo", "password": "demo"}'
{
"success": true,
"jwt": "eyJhbGciOiJIUzI1NiIs...",
"api_key": "muser_...",
"user": {
"username": "admin",
"role": "admin"
},
"expires_at": "2026-05-18T13:00:00Z"
}
| Field | Type | Description |
|---|---|---|
jwt |
string | JWT access token. Use as Authorization: Bearer <jwt>. Expires in 1 hour. |
api_key |
string | Legacy API key. Use as X-API-Key: <key>. Good for 90 days. |
user.username |
string | Username |
user.role |
string | Role: admin, user, or readonly |
expires_at |
string | ISO8601 timestamp of JWT expiration |
The login endpoint also sets a Set-Cookie header for browser-based clients:
Set-Cookie: session_id=<uuid>; Path=/api; HttpOnly; SameSite=Strict; Max-Age=86400
{
"success": false,
"message": "Invalid username or password"
}
JWT is preferred for API clients (n8n, CLI scripts, WordPress). It is validated by the middleware without a database lookup (stateless).
# Login and capture JWT
JWT=$(curl -s -X POST "$API/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin"}' | python3 -c "import json,sys;print(json.load(sys.stdin)['jwt'])")
# Use JWT for all subsequent requests
curl -H "Authorization: Bearer $JWT" "$API/api/v1/files/scan"
curl -H "Authorization: Bearer $JWT" "$API/api/v1/resource/tmdb"
JWT is short-lived (1 hour). When it expires, request a new one via login.
Browser-based clients (Portal) get a session cookie automatically after login. The browser sends the cookie with every request—no manual header needed.
# Login captures the session cookie from Set-Cookie header
curl -v -X POST "$API/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin"}' 2>&1 | grep "Set-Cookie"
# Browser automatically sends: Cookie: session_id=<uuid>
# No manual header needed for subsequent requests
The session cookie is HttpOnly (not accessible from JavaScript) and SameSite=Strict (protected against CSRF).
curl -H "X-API-Key: $KEY" "$API/api/v1/files/scan"
# Also accepted via Bearer header (non-JWT format) or query parameter:
curl -H "Authorization: Bearer $KEY" "$API/api/v1/files/scan"
curl "$API/api/v1/files/scan?api_key=$KEY"
API keys are validated via SHA256 hash lookup in the database. They are long-lived (90 days) and intended for automation.
momentry api-key create "My API Key" --key-type user
# Logout using the session cookie (browser)
curl -X POST "$API/api/v1/auth/logout" \
-H "Cookie: session_id=<uuid>"
| Auth mode | Effect |
|---|---|
| Session Cookie | Session deleted from database. Same cookie returns 401 on subsequent requests. |
| JWT | JWT remains valid until expiry. (JWT is stateless — logout adds JWT to a blacklist only if API key mode is used.) |
| API Key | API key remains valid. (Legacy keys are shared across sessions — revoking would break other clients.) |
# 1. Login
SESSION_ID=$(curl -s -D - -X POST "$API/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin"}' | grep "Set-Cookie" | sed 's/.*session_id=\([^;]*\).*/\1/')
# 2. Use session (works)
curl -s -o /dev/null -w "HTTP %{http_code}\n" "$API/api/v1/resource/tmdb" \
-H "Cookie: session_id=$SESSION_ID"
# → HTTP 200
# 3. Logout
curl -s -X POST "$API/api/v1/auth/logout" \
-H "Cookie: session_id=$SESSION_ID"
# → {"success": true}
# 4. Use session again (rejected)
curl -s -o /dev/null -w "HTTP %{http_code}\n" "$API/api/v1/resource/tmdb" \
-H "Cookie: session_id=$SESSION_ID"
# → HTTP 401
Login Request
│
▼
┌──────────────────┐
│ 1. Check users │ ← users table (argon2 password verify)
│ table │
└──────┬───────────┘
│
┌───┴───┐
│ match │
└───┬───┘
│
▼
┌──────────────────┐
│ 2. Create JWT │ ← 1h expiry, signed with JWT_SECRET
├──────────────────┤
│ 3. Create │ ← 24h expiry, stored in sessions table
│ session │
├──────────────────┤
│ 4. Set-Cookie │ ← HttpOnly, SameSite=Strict, Path=/api
├──────────────────┤
│ 5. Return │ ← JWT + api_key + user info to client
└──────────────────┘
Protected Request
│
▼
┌──────────────────────┐
│ Middleware checks: │
│ │
│ 1. Cookie session? │ → DB lookup session → get api_key → verify
│ │
│ 2. JWT Bearer? │ → verify JWT signature → decode claims
│ │
│ 3. X-API-Key? │ → SHA256 hash → DB lookup → verify
│ │
│ 4. ?api_key=? │ → same as #3
│ │
│ 5. None → 401 │
└──────────────────────┘
| HTTP | When |
|---|---|
401 |
Missing or invalid authentication |
401 |
Session expired or logged out |
401 |
JWT expired |
401 |
API key revoked or inactive |
POST /api/v1/resource/tmdb/check — test authentication + TMDb API connectivityGET /health/detailed — view auth status (integrations section)GET /healthAuth: Public Scope: system-level
Returns basic server health status — used by load balancers and monitoring.
curl "$API/health" | jq '{status, version}'
{
"status": "ok",
"version": "1.0.0",
"build_git_hash": "3a6c1865",
"build_timestamp": "2026-05-16T13:38:15Z",
"uptime_ms": 3015
}
| Field | Type | Description |
|---|---|---|
status |
string | ok or degraded |
version |
string | Semver version |
build_git_hash |
string | Git commit hash |
build_timestamp |
string | Binary build time |
uptime_ms |
integer | Milliseconds since server start |
GET /health/detailedAuth: Required Scope: system-level
Returns full system health including each service status, resource utilization, pipeline readiness, schema migration status, identity file sync status, and external integrations.
Requires authentication (JWT, session cookie, or API key). The basic
/healthendpoint remains public for load balancer checks.
curl "$API/health/detailed" | jq '{status, services, resources: {cpu: .resources.cpu_used_percent, memory: .resources.memory_used_percent}}'
{
"status": "ok",
"version": "1.0.0",
"services": {
"postgres": {"status": "ok", "latency_ms": 3},
"redis": {"status": "ok", "latency_ms": 1},
"qdrant": {"status": "ok", "latency_ms": 5}
},
"resources": {
"cpu_used_percent": 12.5,
"memory_available_mb": 32768,
"memory_used_percent": 31.7
},
"pipeline": {
"scripts_ready": true,
"scripts_count": 345,
"processors": {
"asr": true,
"yolo": true,
"face": true,
"pose": true,
"ocr": true,
"cut": true,
"scene": true,
"asrx": true,
"visual_chunk": true
},
"models_ready": true,
"models_count": 42,
"scripts_integrity": {"matched": 332, "total": 345, "ok": false},
"ffmpeg": true
},
"schema": {
"table_exists": true,
"applied": [{"filename": "migrate_add_users_table.sql"}],
"required": [],
"ok": true
},
"identities": {
"directory_exists": true,
"files_count": 3481,
"index_ok": true,
"db_count": 3481,
"synced": true
},
"integrations": {
"tmdb": {
"api_key_configured": false,
"enabled": false,
"api_reachable": null
}
}
}
| Field | Type | Description |
|---|---|---|
status |
string | ok if all essential services healthy |
services |
object | Per-service status (postgres, redis, qdrant) |
services.*.status |
string | ok, error, or degraded |
services.*.latency_ms |
int | Response time in milliseconds |
resources |
object | CPU, memory usage |
pipeline.scripts_ready |
boolean | Scripts directory accessible |
pipeline.scripts_count |
int | Number of Python processor scripts |
pipeline.processors |
object | Per-processor availability |
pipeline.models_ready |
boolean | Models directory accessible |
pipeline.scripts_integrity |
object | SHA256 checksum verification results |
schema.ok |
boolean | All required migrations applied |
identities.synced |
boolean | Identity file count matches DB count |
integrations.tmdb |
object | TMDB API key config and reachability |
| Condition | status |
|---|---|
| All services ok | ok |
| Any service error | degraded |
| Postgres or Redis error | degraded (server still responds) |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/v1/stats/ingest |
No | Ingest pipeline statistics |
| GET | /api/v1/stats/sftpgo |
No | SFTPGo service status |
| GET | /api/v1/stats/inference |
No | Inference service (LLM) health |
curl "$API/api/v1/stats/ingest"
POST /api/v1/files/registerAuth: Required Scope: file-level
Register a video file for processing. Returns the file's metadata and UUID.
New in v0.1.2: Registration now automatically triggers the processing pipeline — no need to call POST /api/v1/file/:uuid/process separately. The system will:
1. Register the file and run ffprobe
2. Auto-run offline TMDb probe (reads local identity files, no API calls)
3. Create a monitor job for the worker
4. Worker starts all 10 processors (Cut → ASR → ASRX → YOLO → OCR → Face → Pose → VisualChunk → Story → 5W1H)
If the file already exists (same content hash), returns the existing record with already_exists: true.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file_path |
string | Yes | — | Path to video file on disk |
pattern |
string | No | — | Regex pattern for batch register (requires file_path to be a directory) |
user_id |
integer | No | — | User ID to associate with registration |
content_hash |
string | No | — | Pre-computed SHA-256 hash (skips computation) |
# Register a single file
curl -s -X POST "$API/api/v1/files/register" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"file_path": "/path/to/video.mp4"}'
# Batch register files matching a pattern in a directory
curl -s -X POST "$API/api/v1/files/register" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"file_path": "/path/to/dir", "pattern": ".*\\.mp4$"}'
{
"success": true,
"file_uuid": "3a6c1865...",
"file_name": "video.mp4",
"file_path": "/path/to/video.mp4",
"file_type": "video",
"duration": 120.5,
"width": 1920,
"height": 1080,
"fps": 24.0,
"total_frames": 2892,
"already_exists": false,
"message": "File registered successfully"
}
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on 200 |
file_uuid |
string | 32-char hex UUID of the registered file |
file_name |
string | File name (auto-renamed if name conflict) |
file_path |
string | Canonical path on disk |
file_type |
string | "video", "audio", or "unknown" |
duration |
float | Duration in seconds |
width |
integer | Video width in pixels |
height |
integer | Video height in pixels |
fps |
float | Frames per second |
total_frames |
integer | Total frame count |
already_exists |
boolean | True if same content was already registered |
message |
string | Human-readable status |
| HTTP | When |
|---|---|
401 |
Missing or invalid API key |
400 |
Invalid request body |
404 |
File path does not exist |
GET /api/v1/files/scanAuth: Required Scope: file-level
Scan the filesystem directory and list all media files, showing which are registered, processing, or unregistered.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
page |
integer | No | 1 | Page number (1-based) |
page_size |
integer | No | all | Items per page (alias: limit) |
limit |
integer | No | all | Max items (alias for page_size) |
pattern |
string | No | — | Regex filter on file name (e.g., .*\\.mp4$) |
sort_by |
string | No | name |
Sort field: name, size, modified, status |
sort_order |
string | No | asc |
Sort direction: asc or desc |
# Full scan
curl -s "$API/api/v1/files/scan" -H "X-API-Key: $KEY" | jq '{total, registered_count, unregistered_count}'
# Paginated (page 1, 5 per page)
curl -s "$API/api/v1/files/scan?page=1&page_size=5" -H "X-API-Key: $KEY" | jq '{page, total_pages, files: [.files[].file_name]}'
# Regex filter: only mp4 files
curl -s "$API/api/v1/files/scan?pattern=.*\\.mp4$" -H "X-API-Key: $KEY" | jq '{filtered_total, files: [.files[].file_name]}'
# Sort by file size (largest first)
curl -s "$API/api/v1/files/scan?sort_by=size&sort_order=desc&page_size=5" -H "X-API-Key: $KEY" | jq '[.files[] | {file_name, file_size}]'
# Sort by modified time (most recent first)
curl -s "$API/api/v1/files/scan?sort_by=modified&sort_order=desc&page_size=5" -H "X-API-Key: $KEY" | jq '[.files[] | {file_name, modified_time}]'
# Sort by status
curl -s "$API/api/v1/files/scan?sort_by=status&page_size=5" -H "X-API-Key: $KEY" | jq '[.files[] | {file_name, status}]'
{
"files": [
{
"file_name": "video.mp4",
"file_size": 12345678,
"is_registered": true,
"file_uuid": "3a6c1865...",
"status": "completed",
"registration_time": "2026-05-16T12:00:00Z",
"job_id": 42
}
],
"total": 107,
"filtered_total": 80,
"page": 1,
"page_size": 20,
"total_pages": 4,
"registered_count": 26,
"unregistered_count": 81
}
| Field | Type | Description |
|---|---|---|
files |
array | Array of file info objects (paginated) |
files[].file_name |
string | File name |
files[].relative_path |
string | Path relative to scan root |
files[].file_path |
string | Absolute path on disk |
files[].file_size |
integer | File size in bytes |
files[].modified_time |
string | Last modified timestamp (ISO8601) |
files[].is_registered |
boolean | Whether file is registered in DB |
files[].file_uuid |
string | 32-char hex UUID (only if registered) |
files[].status |
string | "completed", "processing", "registered", "unregistered", or null |
files[].registration_time |
string | DB registration timestamp (only if registered) |
files[].job_id |
integer | Processing job ID (only if a job exists) |
total |
integer | Total files found on disk (unfiltered) |
filtered_total |
integer | Files matching regex filter |
page |
integer | Current page number |
page_size |
integer | Items per page |
total_pages |
integer | Total pages |
registered_count |
integer | Files registered in DB |
unregistered_count |
integer | Files not yet registered |
| Feature | Behavior |
|---|---|
| Regex | Case-insensitive ((?i) prefix auto-applied). Applied to file_name. |
| Sort order | Default (sort_by=name): registered files first, then alphabetically. sort_by=status: alphabetical by status string. |
| Pagination | page_size and limit are aliases. Default: show all results. |
| Processing order | pattern regex filter → sort_by/sort_order → page/page_size slice. |
GET /api/v1/files/lookupAuth: Required Scope: file-level
Search registered files by file name. Performs a case-insensitive LIKE search on the file name column. Returns basic info about matching files.
| Field | Type | Required | Description |
|---|---|---|---|
file_name |
string | Yes | File name to search for (partial matches supported) |
# Look up a specific file
curl -s "$API/api/v1/files/lookup?file_name=video.mp4" \
-H "X-API-Key: $KEY"
# Partial name search
curl -s "$API/api/v1/files/lookup?file_name=charade" \
-H "X-API-Key: $KEY" | jq '.matches[].file_name'
{
"file_name": "video.mp4",
"exists": true,
"matches": [
{
"file_uuid": "a03485a40b2df2d3",
"file_name": "video.mp4",
"file_type": "video",
"status": "completed"
}
],
"next_name": "video (2).mp4"
}
| Field | Type | Description |
|---|---|---|
file_name |
string | Searched name |
exists |
boolean | Exact name match exists |
matches |
array | Array of matching registered files |
matches[].file_uuid |
string | 32-char hex UUID |
matches[].file_name |
string | Registered file name |
matches[].file_type |
string | "video", "audio", or null |
matches[].status |
string | Registration/processing status |
next_name |
string | Suggested name for avoiding conflicts |
POST /api/v1/unregisterAuth: Required Scope: file-level
Delete a registered file from the system. Supports single file by UUID, or batch by directory + regex pattern.
| Removed (default) | Not removed |
|---|---|
| Database records (videos, chunks, embeddings, processor_results, pre_chunks) | The original source video file on disk |
Processor output JSON files ({uuid}.*.json) — unless delete_output_files: false |
Temp/working directories |
| In-memory cache entries | |
| MongoDB cached lists |
⚠️ Database deletion is irreversible. To keep output files, set
"delete_output_files": false.
At least one mode must be specified: either file_uuid alone, or file_path + pattern together.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file_uuid |
string | * | — | Single file UUID to delete |
file_path |
string | * | — | Directory path (for batch delete) |
pattern |
string | * | — | Regex pattern (requires file_path) |
delete_output_files |
boolean | No | true |
If true, also delete processor output JSON files ({uuid}.*.json). Set to false to keep them. |
# Delete a single file by UUID (default: also deletes output JSON files)
curl -s -X POST "$API/api/v1/unregister" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"file_uuid": "'"$FILE_UUID"'"}'
# Keep output JSON files, only delete DB records
curl -s -X POST "$API/api/v1/unregister" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"file_uuid": "'"$FILE_UUID"'", "delete_output_files": false}'
# Batch delete all mp4 files in a directory
curl -s -X POST "$API/api/v1/unregister" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"file_path": "/path/to/dir", "pattern": ".*\\.mp4$"}'
{
"success": true,
"file_uuid": "a03485a40b2df2d3",
"message": "Video unregistered successfully"
}
| Field | Type | Description |
|---|---|---|
success |
boolean | True if deletion succeeded |
file_uuid |
string | UUID of the deleted file (single mode) |
message |
string | Human-readable status |
| HTTP | When |
|---|---|
400 |
Neither file_uuid nor file_path+pattern provided |
404 |
File UUID not found |
401 |
Missing or invalid API key |
POST /api/v1/file/:file_uuid/processAuth: Required Scope: file-level
Trigger the processing pipeline for a registered file. Creates a monitor job that the worker picks up and processes sequentially. Returns immediately with the job info—processing runs asynchronously in the background.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
processors |
string[] | No | all | Specific processors to run: ["asr","cut","yolo","ocr","face","pose","asrx","visual_chunk"] |
rules |
string[] | No | all | Rule names to apply (currently unused) |
# Run all processors
curl -s -X POST "$API/api/v1/file/$FILE_UUID/process" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" -d '{}'
# Run specific processors only
curl -s -X POST "$API/api/v1/file/$FILE_UUID/process" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"processors": ["asr", "face", "yolo"]}'
{
"success": true,
"job_id": 42,
"file_uuid": "3a6c1865...",
"status": "processing",
"pids": [12345, 12346],
"message": "Processing triggered for video.mp4"
}
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on 200 |
job_id |
integer | Monitor job ID (for job tracking) |
file_uuid |
string | 32-char hex UUID of the file |
status |
string | "processing" |
pids |
integer[] | Process IDs of started processors |
message |
string | Human-readable status |
| HTTP | When |
|---|---|
404 |
File UUID not found |
401 |
Missing or invalid API key |
GET /api/v1/file/:file_uuid/probeAuth: Required Scope: file-level
Get ffprobe metadata for a registered file. Returns video/audio stream info, codec details, duration, resolution, and frame rate.
curl -s "$API/api/v1/file/$FILE_UUID/probe" -H "X-API-Key: $KEY"
{
"file_uuid": "3a6c1865...",
"file_name": "video.mp4",
"file_size": 794863677,
"duration": 120.5,
"width": 1920,
"height": 1080,
"fps": 24.0,
"total_frames": 2892,
"cached": true,
"format": {
"filename": "/path/to/video.mp4",
"format_name": "mov,mp4,m4a,3gp",
"duration": "120.5",
"size": "12345678",
"bit_rate": "819200"
},
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_type": "video",
"width": 1920,
"height": 1080,
"r_frame_rate": "24/1",
"duration": "120.5"
}
]
}
| Field | Type | Description |
|---|---|---|
file_uuid |
string | 32-char hex UUID |
file_name |
string | File name |
file_size |
integer | File size in bytes (from filesystem) |
duration |
float | Duration in seconds |
width |
integer | Video width in pixels |
height |
integer | Video height in pixels |
fps |
float | Frames per second |
total_frames |
integer | Estimated total frames |
cached |
boolean | True if result was from cached probe JSON |
format |
object | Container format info (ffprobe format section) |
streams |
array | Array of stream info objects |
GET /api/v1/progress/:file_uuidAuth: Required Scope: file-level
Get real-time processing progress for a file. Queries Redis for per-processor status and the database for file metadata. Also includes system resource stats.
curl -s "$API/api/v1/progress/$FILE_UUID" -H "X-API-Key: $KEY" | jq '{overall_progress, processors: [.processors[] | {processor_type, status}]}'
{
"file_uuid": "3a6c1865...",
"overall_progress": 71,
"cpu_percent": 45.2,
"gpu_percent": 30.1,
"memory_percent": 62.4,
"processors": [
{"processor_type": "asr", "status": "complete", "progress": 100},
{"processor_type": "yolo", "status": "running", "progress": 65},
{"processor_type": "face", "status": "pending", "progress": 0}
]
}
| Field | Type | Description |
|---|---|---|
file_uuid |
string | 32-char hex UUID |
overall_progress |
integer | Overall progress percentage (0–100) |
processors |
array | Per-processor status list |
processors[].processor_type |
string | Processor name (asr, cut, yolo, etc.) |
processors[].status |
string | "pending", "running", "complete", or "failed" |
processors[].progress |
integer | Per-processor progress (0–100) |
cpu_percent |
float | Current CPU usage |
gpu_percent |
float | Current GPU utilization |
memory_percent |
float | Current memory usage |
GET /api/v1/jobsAuth: Required Scope: system-level
List all processing jobs (monitor jobs) in the system. Shows job status, which file each job is processing, and current processor info.
curl -s "$API/api/v1/jobs" -H "X-API-Key: $KEY" | jq '{count, jobs: [.jobs[] | {uuid, status}]}'
{
"jobs": [
{
"id": 42,
"uuid": "3a6c1865...",
"status": "running",
"current_processor": "yolo",
"created_at": "2026-05-16T12:00:00Z",
"started_at": "2026-05-16T12:01:00Z"
}
],
"count": 15,
"page": 1,
"page_size": 20
}
| Field | Type | Description |
|---|---|---|
jobs |
array | Array of job info objects |
jobs[].id |
integer | Job ID |
jobs[].uuid |
string | File UUID being processed |
jobs[].status |
string | "pending", "running", "completed", "failed" |
jobs[].current_processor |
string | Currently active processor, or null |
count |
integer | Total job count |
page |
integer | Current page number |
page_size |
integer | Jobs per page |
POST /api/v1/searchAuth: Required Scope: file-level
Semantic/vector search across indexed video chunks. Returns matching chunks with scores.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | Yes | — | Search text |
file_uuid |
string | No | — | Restrict search to a specific file |
limit |
integer | No | 10 | Max results |
page |
integer | No | 1 | Page number (1-based) |
page_size |
integer | No | limit |
Items per page (alias: page_size) |
mode |
string | No | smart |
Search mode: "vector" or "smart" |
# Search across all files
curl -s -X POST "$API/api/v1/search" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"query": "charade", "limit": 5}'
# Search within a specific file
curl -s -X POST "$API/api/v1/search" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"query": "charade", "file_uuid": "'"$FILE_UUID"'"}'
# Paginated search
curl -s -X POST "$API/api/v1/search" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"query": "charade", "page": 1, "page_size": 3}'
{
"results": [
{
"uuid": "3a6c1865...",
"chunk_id": "sentence_0012",
"chunk_type": "sentence",
"start_time": 48.8,
"end_time": 55.4,
"text": "charade is a classic film...",
"score": 0.92
}
],
"query": "charade",
"total": 15,
"page": 1,
"page_size": 3
}
> Results are deduplicated by `chunk_id` (highest score wins) before pagination.
| Field | Type | Description |
|-------|------|-------------|
| `results` | array | Array of matched chunks (deduplicated) |
| `results[].uuid` | string | File UUID |
| `results[].chunk_id` | string | Chunk identifier |
| `results[].chunk_type` | string | `"sentence"`, `"cut"`, `"trace"`, `"visual"` |
| `results[].start_time` | float | Start time in seconds |
| `results[].end_time` | float | End time in seconds |
| `results[].text` | string | Chunk text content |
| `results[].score` | float | Similarity score (0.0–1.0) |
| `query` | string | Original search query |
| `total` | integer | Total matching results |
| `page` | integer | Current page number |
| `page_size` | integer | Items per page |
#### Error Responses
| HTTP | When |
|------|------|
| `401` | Missing or invalid API key |
---
### `POST /api/v1/search/hybrid`
**Auth**: Required
**Scope**: file-level
Hybrid search combining vector similarity score and BM25 text score into a combined score.
#### Request Parameters
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `query` | string | Yes | — | Search text |
| `file_uuid` | string | No | — | Restrict search to a specific file |
| `limit` | integer | No | 10 | Max results |
| `page` | integer | No | 1 | Page number (1-based) |
| `page_size` | integer | No | `limit` | Items per page |
| `vector_weight` | float | No | 0.5 | Weight for vector score (0.0–1.0) |
| `bm25_weight` | float | No | 0.5 | Weight for BM25 score (0.0–1.0) |
#### Response
```json
{
"results": [
{
"uuid": "3a6c1865...",
"chunk_id": "sentence_0012",
"chunk_type": "sentence",
"start_time": 48.8,
"end_time": 55.4,
"text": "charade is a classic film...",
"vector_score": 0.85,
"bm25_score": 0.72,
"combined_score": 0.79
}
],
"query": "charade"
}
| Field | Type | Description |
|---|---|---|
results[].vector_score |
float | Vector similarity score |
results[].bm25_score |
float | BM25 text score |
results[].combined_score |
float | Weighted combination of both scores |
POST /api/v1/search/bm25Auth: Required Scope: file-level
BM25 full-text keyword search. Good for exact term matching. Returns results with BM25 score only.
Same as standard search: query, file_uuid, limit.
Returns the same structure as standard search, with score representing the BM25 relevance score.
N8N-format search endpoints. Response format is optimized for n8n workflow consumption.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/n8n/search |
N8N-format vector search |
| POST | /api/v1/n8n/search/bm25 |
N8N-format BM25 search |
| POST | /api/v1/n8n/search/hybrid |
N8N-format hybrid search |
| POST | /api/v1/n8n/search/smart |
N8N-format smart search |
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | Yes | — | Search text |
file_uuid |
string | No | — | Restrict to specific file |
types |
string[] | No | ["chunk"] |
Search types: chunk, frame, person |
filters |
object | No | — | Filter criteria (confidence, object class, speaker, etc.) |
page |
integer | No | 1 | Page number |
page_size |
integer | No | 20 | Items per page |
time_range |
float[2] | No | — | Time range [start, end] in seconds |
curl -s -X POST "$API/api/v1/n8n/search" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"query": "charade", "limit": 5}'
{
"query": "charade",
"results": [
{
"type": "chunk",
"chunk_id": "sentence_0012",
"chunk_type": "sentence",
"file_uuid": "3a6c1865...",
"start_time": 48.8,
"end_time": 55.4,
"text": "charade is a classic film...",
"score": 0.92
}
],
"total": 15,
"page": 1,
"page_size": 20,
"took_ms": 42
}
| Field | Type | Description |
|---|---|---|
results |
array | Array of search results |
results[].type |
string | Result type: "chunk", "frame", or "person" |
results[].chunk_id |
string | Chunk identifier |
results[].chunk_type |
string | Chunk type |
results[].file_uuid |
string | File UUID |
results[].start_time |
float | Start time in seconds |
results[].end_time |
float | End time in seconds |
results[].text |
string | Content text |
results[].score |
float | Relevance score |
total |
integer | Total matching results |
page |
integer | Current page |
page_size |
integer | Items per page |
took_ms |
integer | Query execution time in milliseconds |
Two paths for searching identities by text.
GET /api/v1/search/identity_textSearch chunk text content and return associated identities (if any).
Auth: Required Scope: file-level
| Field | Type | Required | Description |
|---|---|---|---|
file_uuid |
string | Yes | File UUID to search within |
q |
string | Yes | Text search query |
limit |
integer | No | Max results (default 50) |
page |
integer | No | 1 |
page_size |
integer | No | limit |
curl -s "$API/api/v1/search/identity_text?file_uuid=$FILE_UUID&q=charade&page=1&page_size=5" \
-H "X-API-Key: $KEY"
{
"success": true,
"total": 0,
"page": 1,
"page_size": 5,
"limit": 50,
"results": []
}
Each result (IdentityTextHit):
{
"file_uuid": "3a6c1865...",
"chunk_id": "sentence_0012",
"start_time": 48.8,
"end_time": 55.4,
"text_content": "charade is a classic film...",
"identity_id": 42,
"identity_name": "Cary Grant",
"identity_source": "tmdb",
"trace_id": 10
}
| Field | Type | Description |
|---|---|---|
file_uuid |
string | File UUID |
chunk_id |
string | Chunk identifier |
start_time |
float | Start time in seconds |
end_time |
float | End time in seconds |
text_content |
string | Chunk text content |
identity_id |
integer | Identity ID (null if no identity matched) |
identity_name |
string | Identity name (null if no identity matched) |
identity_source |
string | Identity origin. .json = established from identity.json files on disk (unified format for all sources). tmdb = from .json via TMDb enrichment probe, then matched against faces. auto = pipeline face matching result; only stranger identities are auto-created. user_defined = manual. merged = merged identities. |
trace_id |
integer | Face trace ID (null if no trace matched) |
POST /api/v1/identities/searchSearch identity names and return associated face detection text.
Auth: Required Scope: identity-level
| Field | Type | Required | Description |
|---|---|---|---|
q |
string | Yes | Identity name search |
file_uuid |
string | No | Restrict to specific file |
limit |
integer | No | Max results (default 50) |
curl -s -X POST "$API/api/v1/identities/search" \
-H "X-API-Key: $KEY" \
-d '{"q": "Cary Grant"}'
Search video frames by visual content (object detection results).
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/search/visual |
Search visual chunks by criteria (object classes, density) |
| POST | /api/v1/search/visual/class |
Search by specific object class |
| POST | /api/v1/search/visual/density |
Search by spatial density range |
| POST | /api/v1/search/visual/stats |
Get visual detection statistics |
| POST | /api/v1/search/visual/combination |
Search by object class combination |
| Field | Type | Required | Description |
|---|---|---|---|
file_uuid |
string | Yes | File UUID |
criteria.required_classes |
string[] | No | Required object classes (e.g., ["person", "car"]) |
criteria.min_confidence |
float | No | Minimum confidence threshold |
criteria.min_spatial_density |
float | No | Minimum spatial density |
criteria.max_spatial_density |
float | No | Maximum spatial density |
curl -s -X POST "$API/api/v1/search/visual" \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{"file_uuid": "'"$FILE_UUID"'", "criteria": {"required_classes": ["person", "car"]}}'
{
"chunks": [
{
"file_uuid": "3a6c1865...",
"chunk_id": "visual_001",
"chunk_type": "visual",
"detections": [
{"class": "person", "confidence": 0.95, "bbox": [100, 200, 150, 350]}
],
"start_time": 120.5,
"end_time": 125.3
}
],
"total": 42
}
| Field | Type | Description |
|---|---|---|
chunks |
array | Array of matching visual chunks |
chunks[].file_uuid |
string | File UUID |
chunks[].chunk_id |
string | Chunk identifier |
chunks[].detections |
array | Object detections in this chunk |
total |
integer | Total matching chunks |
GET /api/v1/identitiesAuth: Required Scope: identity-level
List all registered identities with pagination.
curl -s "$API/api/v1/identities?page=1&page_size=20" -H "X-API-Key: $KEY" | jq '{count, identities: [.identities[] | {name}]}'
GET /api/v1/identity/:identity_uuidAuth: Required Scope: identity-level
Get detailed information for a specific identity, including metadata and TMDb references.
curl -s "$API/api/v1/identity/$IDENTITY_UUID" -H "X-API-Key: $KEY"
{
"success": true,
"uuid": "a9a901056d6b46ff92da0c3c1a57dff4",
"name": "Cary Grant",
"identity_type": "people",
"source": "tmdb",
"status": "confirmed",
"tmdb_id": 112,
"tmdb_profile": "https://image.tmdb.org/t/p/w185/abc.jpg",
"metadata": {},
"reference_data": {},
"created_at": "2026-05-16T12:00:00Z",
"updated_at": null
}
| Field | Type | Description |
|---|---|---|
uuid |
string | 32-char hex identity UUID |
name |
string | Identity name |
identity_type |
string | "people" or null |
source |
string | .json, auto, tmdb, user_defined, or merged |
status |
string | "confirmed", "pending", or "inactive" |
tmdb_id |
integer | TMDb person ID (only if source = tmdb) |
tmdb_profile |
string | TMDb profile image URL |
metadata |
object | Metadata JSON (tmdb_character, cast_order, etc.) |
created_at |
string | Creation timestamp |
DELETE /api/v1/identity/:identity_uuidAuth: Required Scope: identity-level
Delete an identity permanently.
GET /api/v1/identity/:identity_uuid/filesAuth: Required Scope: identity-level
Get all files where this identity appears. Returns per-file summary including face count, confidence, and appearance time range.
curl -s "$API/api/v1/identity/$IDENTITY_UUID/files" -H "X-API-Key: $KEY"
GET /api/v1/identity/:identity_uuid/facesAuth: Required Scope: identity-level
Get all face detection records associated with this identity.
curl -s "$API/api/v1/identity/$IDENTITY_UUID/faces" -H "X-API-Key: $KEY"
| Field | Type | Description |
|---|---|---|
file_uuid |
string | File UUID where face was detected |
frame_number |
integer | Frame number of detection |
face_id |
string | Face ID (format: face_{frame_number}) |
confidence |
float | Detection confidence |
GET /api/v1/identity/:identity_uuid/chunksAuth: Required Scope: identity-level
Get all text chunks (sentences) spoken while this identity's face was on screen. Useful for finding what a person said.
curl -s "$API/api/v1/identity/$IDENTITY_UUID/chunks" -H "X-API-Key: $KEY"
| Field | Type | Description |
|---|---|---|
file_uuid |
string | File UUID |
chunk_id |
string | Sentence chunk identifier |
start_time |
float | Start time in seconds |
end_time |
float | End time in seconds |
text |
string | Spoken text content |
POST /api/v1/identity/:identity_uuid/bindAuth: Required Scope: identity-level
Bind a face detection to an identity. Associates the face trace with the identity for future search and recognition.
| Field | Type | Required | Description |
|---|---|---|---|
file_uuid |
string | Yes | File UUID where face is detected |
face_id |
string | Yes | Face ID (format: {frame}_{idx}) |
curl -s -X POST "$API/api/v1/identity/$IDENTITY_UUID/bind" \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{"file_uuid": "'"$FILE_UUID"'", "face_id": "1_5"}'
POST /api/v1/identity/:identity_uuid/unbindAuth: Required Scope: identity-level
Unbind a face detection from an identity. Removes the identity association from the face record.
GET /api/v1/identities/searchAuth: Required Scope: identity-level
Search identities by name (ILIKE search). Returns matching identity records.
curl -s "$API/api/v1/identities/search?q=Cary" -H "X-API-Key: $KEY"
| Field | Type | Description |
|---|---|---|
name |
string | Identity name |
source |
string | Identity source |
tmdb_id |
integer | TMDb ID (if source = tmdb) |
file_uuid |
string | Associated file UUID |
POST /api/v1/identity/uploadAuth: Required Scope: identity-level
Upload an identity.json file to create or update an identity. Accepts the same format as the identity.json files stored on disk.
If an identity with the same name already exists, it will be updated with the new values.
The request body is an IdentityFile object:
| Field | Type | Required | Description |
|---|---|---|---|
identity_uuid |
string | Yes | 32-char hex UUID (hyphens allowed, will be stripped) |
name |
string | Yes | Identity display name |
identity_type |
string | No | "people" or null |
source |
string | No | .json, auto, tmdb, user_defined, or merged |
status |
string | No | "confirmed", "pending", or "inactive" |
tmdb_id |
integer | No | TMDb person ID |
tmdb_profile |
string | No | TMDb profile image URL |
metadata |
object | No | Arbitrary metadata JSON |
file_bindings |
array | No | Array of { file_uuid, trace_ids, face_count } (informational) |
curl -s -X POST "$API/api/v1/identity/upload" \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{
"version": 1,
"identity_uuid": "a9a901056d6b46ff92da0c3c1a57dff4",
"name": "Cary Grant",
"identity_type": "people",
"source": ".json",
"status": "confirmed",
"metadata": {},
"file_bindings": []
}'
{
"success": true,
"identity_uuid": "a9a901056d6b46ff92da0c3c1a57dff4",
"name": "Cary Grant",
"message": "Identity uploaded successfully"
}
POST /api/v1/identity/:identity_uuid/profile-imageAuth: Required Scope: identity-level
Upload a profile image (JPEG or PNG) for an identity. The image is saved to {output}/identities/{uuid}/profile.{ext}.
Uses multipart/form-data with field name image.
curl -s -X POST "$API/api/v1/identity/$IDENTITY_UUID/profile-image" \
-H "X-API-Key: $KEY" \
-F "image=@/path/to/photo.jpg"
{
"success": true,
"identity_uuid": "a9a901056d6b46ff92da0c3c1a57dff4",
"path": "/path/to/output/identities/.../profile.jpg",
"message": "Profile image saved: profile.jpg"
}
| HTTP | When |
|---|---|
400 |
Missing image field or unsupported format |
404 |
Identity not found |
415 |
Unsupported image type (use JPEG or PNG) |
GET /api/v1/identity/:identity_uuid/profile-imageAuth: Required Scope: identity-level
Retrieve the profile image for an identity. Returns the raw image data with appropriate Content-Type header.
curl -s "$API/api/v1/identity/$IDENTITY_UUID/profile-image" \
-H "X-API-Key: $KEY" -o profile.jpg
| Response Header | Value |
|---|---|
content-type |
image/jpeg or image/png |
GET /api/v1/signals/unboundAuth: Required Scope: identity-level
List unbound face signals — face detections that have not yet been assigned to any identity.
curl -s "$API/api/v1/signals/unbound" -H "X-API-Key: $KEY"
POST /api/v1/agents/identity/analyzeAuth: Required Scope: file-level
Run identity matching on a processed file: matches face detection traces against known identities (TMDb, .json, auto) and creates bindings. Optionally uses LLM for enhanced analysis.
Requires the file's face processor to have completed. Will return an error if face traces are not available.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file_uuid |
string | Yes | — | File UUID to analyze |
use_llm |
boolean | No | false |
Enable LLM-assisted identity analysis |
model |
string | No | — | LLM model name (e.g., "gemma4") |
auto_merge_threshold |
float | No | — | Confidence threshold (0.0–1.0) for auto-merging |
# Basic analysis
curl -s -X POST "$API/api/v1/agents/identity/analyze" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"file_uuid": "'"$FILE_UUID"'"}'
# With LLM enhancement
curl -s -X POST "$API/api/v1/agents/identity/analyze" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"file_uuid": "'"$FILE_UUID"'", "use_llm": true, "model": "gemma4"}'
{
"success": true,
"file_uuid": "3a6c1865...",
"identities": [
{
"identity_id": "a9a901056d6b46ff92da0c3c1a57dff4",
"person_ids": ["trace_10", "trace_23"],
"confidence": 0.87,
"matched": true,
"name": "Cary Grant",
"source": "tmdb",
"stranger": false
}
],
"processing_status": {
"phase": "COMPLETED",
"progress": 100
}
}
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on 200 |
file_uuid |
string | Analyzed file UUID |
identities |
array | Array of matched identity results |
identities[].identity_id |
string | 32-char identity UUID |
identities[].person_ids |
string[] | Matched trace/person IDs |
identities[].confidence |
float | Matching confidence (0.0–1.0) |
identities[].matched |
boolean | Whether this identity was matched to a known entity |
identities[].name |
string | Identity display name |
identities[].source |
string | Identity source (.json, auto, tmdb, etc.) |
identities[].stranger |
boolean | Whether this is an unmatched stranger trace |
processing_status |
object | Identity agent processing progress |
| HTTP | When |
|---|---|
400 |
File UUID not provided or invalid |
404 |
File not found or face processor not completed |
500 |
Analysis failed (LLM error, DB error) |
POST /api/v1/agents/identity/suggestAuth: Required Scope: identity-level
Suggest identity merges based on face embedding similarity analysis. Returns pairs of identities that are similar enough to potentially be the same person.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file_uuid |
string | Yes | — | File UUID to analyze for merge suggestions |
auto_merge_threshold |
float | No | — | Confidence threshold for auto-suggest |
curl -s -X POST "$API/api/v1/agents/identity/suggest" \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{"file_uuid": "'"$FILE_UUID"'"}'
GET /api/v1/agents/identity/statusAuth: Required Scope: system-level
Get the identity agent processing status for a file. Shows current phase and progress.
curl -s "$API/api/v1/agents/identity/status?file_uuid=$FILE_UUID" \
-H "X-API-Key: $KEY"
POST /api/v1/agents/suggest/mergeAuth: Required Scope: identity-level
Execute a suggested identity merge. Combines two identities into one, consolidating their face bindings.
| Field | Type | Required | Description |
|---|---|---|---|
source_uuid |
string | Yes | Identity UUID to merge FROM (will be removed) |
target_uuid |
string | Yes | Identity UUID to merge INTO (will be kept) |
curl -s -X POST "$API/api/v1/agents/suggest/merge" \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{"source_uuid": "uuid_to_discard", "target_uuid": "uuid_to_keep"}'
POST /api/v1/agents/suggest/clusteringAuth: Required Scope: identity-level
Suggest face clustering results. Analyzes all face embeddings in a file and groups similar faces into candidate identity clusters.
curl -s -X POST "$API/api/v1/agents/suggest/clustering" \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{"file_uuid": "'"$FILE_UUID"'"}'
⚠️ External resource: TMDb requires internet access, violating Momentry's local-only principle. All core processing (ASR, YOLO, Face, OCR, Pose, embeddings) runs fully offline. TMDb enrichment is optional and gated behind
TMDB_API_KEY+MOMENTRY_TMDB_PROBE_ENABLED.
TMDb enrichment is an optional identity enrichment step that can be run after Pipeline face detection completes. The workflow is:
{file_uuid}.tmdb.jsonsource='tmdb') + save identity.json + download profile image to {OUTPUT}/identities/{uuid}/profile.jpgMOMENTRY_TMDB_PROBE_ENABLED=truePOST /api/v1/agents/tmdb/prefetchAuth: Required Scope: file-level
Fetch TMDb cast data for a registered file and cache it locally. This is the only step requiring internet access.
| Field | Type | Required | Description |
|---|---|---|---|
file_uuid |
string | Yes | File UUID to enrich |
curl -s -X POST "$API/api/v1/agents/tmdb/prefetch" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"file_uuid": "'"$FILE_UUID"'"}'
{"success": true, "file_uuid": "...", "cache_path": "/output/...tmdb.json"}
POST /api/v1/file/:file_uuid/tmdb-probeAuth: Required Scope: file-level
Read local TMDb cache and create/update identities. Requires prefetch to have been run first.
curl -s -X POST "$API/api/v1/file/$FILE_UUID/tmdb-probe" \
-H "X-API-Key: $KEY" | jq '{identities_created, movie_title}'
{"success": true, "identities_created": 15, "movie_title": "Charade"}
{"success": false, "message": "No TMDb cache found. Run tmdb-prefetch first."}
GET /api/v1/resource/tmdbAuth: Required Scope: system-level
View TMDb resource status including configuration, identity counts, and cache file count.
curl -s "$API/api/v1/resource/tmdb" -H "X-API-Key: $KEY" \
| jq '{identities_seeded, cache_files}'
POST /api/v1/resource/tmdb/checkAuth: Required Scope: system-level
Ping the TMDb API to verify connectivity and measure latency.
curl -s -X POST "$API/api/v1/resource/tmdb/check" \
-H "X-API-Key: $KEY" | jq '.status'
{
"api_key_configured": true,
"enabled": false,
"api_reachable": true,
"api_latency_ms": 120
}
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/v1/stats/ingest |
No | Ingest statistics |
| GET | /api/v1/stats/sftpgo |
No | SFTPGo service status |
| GET | /api/v1/stats/inference |
No | Inference service health |
POST /api/v1/config/cacheAuth: Required Scope: system-level
Toggle the Redis cache on or off.
| Field | Type | Required | Description |
|---|---|---|---|
enabled |
boolean | Yes | true to enable, false to disable |
curl -s -X POST "$API/api/v1/config/cache" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"enabled": false}'
The following routes are defined in source code but are NOT currently mounted in the router:
| Endpoint | Source file |
|---|---|
/api/v1/search/universal |
universal_search.rs |
/api/v1/search/frames |
universal_search.rs |
/api/v1/search/persons |
universal_search.rs |
/api/v1/who |
who.rs |
/api/v1/who/candidates |
who.rs |
Agent endpoints provide AI-powered capabilities including translation, identity analysis, and 5W1H extraction.
Translate text between languages using Gemma4 (llama.cpp, port 8082).
{
"text": "Hello, welcome to Momentry Core.",
"target_language": "Traditional Chinese",
"source_language": "English"
}
| Field | Type | Required | Description |
|---|---|---|---|
text |
string | ✅ | Text to translate |
target_language |
string | ✅ | Target language name (e.g. "Traditional Chinese", "Japanese") |
source_language |
string | ❌ | Source language (default: "auto") |
{
"success": true,
"translated_text": "您好,歡迎使用 Momentry Core。",
"source_language_detected": "English",
"model_used": "google_gemma-4-26B-A4B-it-Q5_K_M.gguf"
}
| Source | Target | Quality |
|---|---|---|
| English | Traditional Chinese | ✅ |
| English | Japanese | ✅ |
| Chinese | English | ✅ |
| English | French | ✅ |
| Chinese | Japanese | ✅ |
localhost:8082/v1/chat/completions (OpenAI-compatible)| Status | Condition |
|---|---|
| 500 | LLM unreachable or response parse failure |
| 401 | Missing/invalid auth |
Get status of the identity agent pipeline.
{
"status": "idle",
"last_analysis": "2026-05-17T12:00:00Z",
"identities_processed": 27
}
Run face clustering to suggest new identity groupings.
{
"file_uuid": "3abeee81d94597629ed8cb943f182e94"
}
Merge two identities into one.
{
"from_uuid": "...",
"into_uuid": "..."
}
Extract 5W1H (Who, What, When, Where, Why, How) from video chunk text.
{
"chunk_id": "chunk_42",
"file_uuid": "3abeee81d94597629ed8cb943f182e94"
}
{
"success": true,
"5w1h": {
"who": ["Cary Grant"],
"what": ["discussing plans"],
"when": ["1963"],
"where": ["Paris"],
"why": ["vacation"],
"how": ["in person"]
}
}
Batch analyze multiple chunks for 5W1h extraction.
{
"file_uuid": "3abeee81d94597629ed8cb943f182e94",
"chunk_ids": ["chunk_1", "chunk_2", "chunk_3"]
}
Get status of the 5W1H agent pipeline.