# EntryLuma CCTV API v1

CCTV detection runs in the camera integration or local CCTV Connector. EntryLuma receives events and can queue configured WhatsApp or email notifications. For a new installation, commission the camera and its rules in EntryLuma first. Verify the portal supports the documented operations.

## Connect a registered camera

1. Enable CCTV for the organisation and register the camera under its branch.
2. Use the camera-specific 64-character lowercase hexadecimal token in the X-Camera-Token header. Keep it private. Entry Device tokens are issued separately.
3. Send JSON by HTTPS POST to https://www.entryluma.com/api/v1/attendance/zones.php. The attendance path segment remains part of the endpoint.
4. Use the CCTV Connector to configure and sync detection, zone rules, and notification delivery. For a custom event sender, confirm with the operator that the camera has applied settings and enabled recipients.

## Submit a live alert or resolution

Use api_version 1 and operation live_event. Supply event_key as a stable 32-character lowercase hexadecimal ID unique to that camera event, kind as alert or resolution, and occurred_at as Unix epoch seconds. Use a separate event key for the resolution. At receipt, the timestamp may be up to one hour old or two minutes ahead.

A text-only alert body has this shape. Replace the illustrative ID and timestamp with current event values.

```json
{
  "api_version": 1,
  "operation": "live_event",
  "event_key": "0123456789abcdef0123456789abcdef",
  "kind": "alert",
  "occurred_at": 1794300000
}
```

An optional image field carries a raw base64-encoded JPEG (no data URL prefix, up to 700,000 encoded characters). Total request size may not exceed 720,000 bytes. Snapshot delivery also depends on portal storage and delivery settings.

HTTP 201 with accepted:true records a new event. HTTP 200 with duplicate:true recognises an existing key. Retry a transient failure with the same key and payload while the timestamp is still valid. A recorded event can trigger real messages. Use an authorised test camera and confirm delivery separately in the portal.

## Configuration and compatibility

Use operation configuration with api_version 1 to read whether the camera is enabled. A disabled camera can return HTTP 200 with enabled:false for this read and rejects live submissions with HTTP 403. The revision-based open and resolve operations remain available for existing episode integrations. Use live_event for the current camera notification workflow.
