Skip to content

Events & Webhooks

Subscribe to real-time events from the OpenBiometrics engine. Register webhook URLs to receive HTTP POST notifications when faces are detected, watchlist matches occur, people cross lines, and more.

Event TypeDescription
face_detectedA face was detected in an image or video frame
face_matchedA detected face matched an enrolled identity
watchlist_alertA watchlist match exceeded the alert threshold
liveness_passedAn active liveness session completed successfully
liveness_failedAn active liveness session failed
document_scannedA document was scanned and processed
person_enteredA tracked person entered a monitored zone
person_exitedA tracked person exited a monitored zone
line_crossedA tracked person crossed a counting line
system_errorAn internal error occurred in a processing module
POST /api/v1/events/webhooks
FieldTypeRequiredDescription
urlstringYesHTTPS endpoint to receive events
event_typesstring[]YesEvent types to subscribe to
secretstringNoShared secret for HMAC-SHA256 signature
Terminal window
curl -X POST http://localhost:8000/api/v1/events/webhooks \
-d '{
"url": "https://example.com/webhooks/biometrics",
"event_types": ["face_matched", "watchlist_alert", "liveness_passed"],
"secret": "whsec_your_signing_secret"
}'
{
"id": "wh_a1b2c3d4e5f6",
"url": "https://example.com/webhooks/biometrics",
"event_types": ["face_matched", "watchlist_alert", "liveness_passed"],
"created_at": "2026-03-19T10:30:00+00:00"
}
DELETE /api/v1/events/webhooks/{webhook_id}
Terminal window
curl -X DELETE http://localhost:8000/api/v1/events/webhooks/wh_a1b2c3d4e5f6 \
{
"removed": "wh_a1b2c3d4e5f6"
}
GET /api/v1/events/webhooks
Terminal window
curl http://localhost:8000/api/v1/events/webhooks \
[
{
"id": "wh_a1b2c3d4e5f6",
"url": "https://example.com/webhooks/biometrics",
"event_types": ["face_matched", "watchlist_alert", "liveness_passed"],
"created_at": "2026-03-19T10:30:00+00:00"
}
]

Retrieve recent events from the in-memory event history.

GET /api/v1/events/recent
ParameterTypeRequiredDescription
limitintNoMax events to return (default: 100)
event_typestringNoFilter by event type
Terminal window
curl "http://localhost:8000/api/v1/events/recent?limit=10&event_type=face_matched" \
[
{
"id": "evt_9f8e7d6c-5b4a-3210-fedc-ba9876543210",
"type": "face_matched",
"timestamp": "2026-03-19T10:32:15+00:00",
"source": "face_pipeline",
"data": {
"identity_id": "abc-123",
"label": "Alice Smith",
"similarity": 0.91,
"watchlist": "default"
},
"camera_id": "lobby-cam-1"
}
]
FieldTypeDescription
idstringUnique event identifier (UUID)
typestringEvent type (see table above)
timestampstringISO 8601 UTC timestamp
sourcestringModule that produced the event
dataobjectEvent-specific payload
camera_idstring|nullCamera ID if event originated from a stream

When you provide a secret during registration, every webhook delivery includes an HMAC-SHA256 signature in the X-Signature-256 header. Use this to verify that events came from OpenBiometrics.

The signature is computed over the raw JSON request body:

HMAC-SHA256(secret, request_body)

Verifying in Python:

import hashlib
import hmac
def verify_webhook(payload: bytes, signature: str, secret: str) -> bool:
expected = hmac.new(
secret.encode(),
payload,
hashlib.sha256,
).hexdigest()
return hmac.compare_digest(f"sha256={expected}", signature)

Verifying in Node.js:

const crypto = require("crypto");
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
return signature === `sha256=${expected}`;
}

Each webhook POST contains the event as a JSON body:

{
"id": "evt_9f8e7d6c-5b4a-3210-fedc-ba9876543210",
"type": "watchlist_alert",
"timestamp": "2026-03-19T10:32:15+00:00",
"source": "face_pipeline",
"data": {
"identity_id": "abc-123",
"label": "Alice Smith",
"similarity": 0.93,
"watchlist": "vip"
},
"camera_id": "lobby-cam-1"
}

Headers:

HeaderDescription
Content-Typeapplication/json
X-Signature-256HMAC-SHA256 signature (if secret is set)
X-Event-TypeEvent type string
X-Event-IDUnique event ID
  • Always set a secret for production webhooks and verify signatures
  • Subscribe only to the event types you need to minimize traffic
  • Return 200 quickly from your webhook endpoint; process events asynchronously
  • Use the event_type filter on /recent to debug specific event flows
  • Monitor system_error events for early detection of issues