All posts

From checks to incidents: how a monitor decides something happened

One flagged picture is not an event. How a monitor's schedule and its confirm and clear rules turn a stream of checks into incidents with a start, an end and one evidence picture.

By Oussama Messai Published 2 December 2026 5 min read Lire cet article en français
A warehouse aisle with a forklift and pallets standing on the floor between the racks

A single call to the API answers a single question about a single picture. Put that call in a loop and you have a problem you did not have before: the answers flicker. A forklift passes in front of the exit for four seconds, the check says “blocked”, the next one says “clear”, and your user has received two notifications about nothing.

The fix is not a better model. It is to stop treating a check as an event. The API does this for you with three objects: a camera, a monitor and an incident.1

The three objects

  • A camera is where pictures come from. Your code pushes them, a Camly Bridge on site reads the camera, or the camera makes its own for tests.
  • A monitor ties a camera to a saved agent, a schedule and incident rules. A camera can have up to five.
  • An incident is something that lasted: it has a start, an end and one evidence picture. A single flagged check is not an incident.

Creating a monitor

curl https://api.camly.ai/v1/monitors \
  -H "Authorization: Bearer $CAMLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Dock exit kept clear",
    "camera": "cam_123",
    "agent": "agt_123",
    "schedule": {
      "min_interval_seconds": 60,
      "max_interval_seconds": 900,
      "motion": true,
      "hours": { "days": [1, 2, 3, 4, 5], "timezone": "Europe/Paris",
                 "from": "07:00", "to": "19:00" }
    },
    "incident_rules": { "confirm_checks": 2, "clear_checks": 2,
                        "max_open_minutes": 1440 }
  }'

Two blocks do the work.

The schedule: when to look

SettingDefaultWhat it does
min_interval_seconds60Pictures that arrive sooner are skipped, and not charged
max_interval_seconds900How often the monitor wants a picture when all is calm
motiontrueWhether a picture sent because something moved counts
hoursalwaysOnly check inside these days and times; a window can run past midnight

The two intervals are the interesting part. A monitor does not look at a fixed pace. When nothing is happening it is content with a picture every max_interval_seconds. As soon as something is being confirmed, or an incident is open, it asks for the shortest interval. Every answer to a pushed picture carries next_frame_seconds, which tells the sender when to send the next one. A quiet scene costs little; a scene where something is going on gets attention.

The rules: when it counts

An incident opens after confirm_checks flagged checks in a row, two by default, and closes after clear_checks clear ones, two by default. That is the whole mechanism, and it is enough to remove the forklift that passes: one flagged check followed by a clear one opens nothing.

{
  "id": "inc_123",
  "object": "incident",
  "status": "closed",
  "started": "2026-11-06T09:30:12Z",
  "confirmed": "2026-11-06T09:31:14Z",
  "closed": "2026-11-06T09:48:02Z",
  "close_reason": "cleared",
  "description": "Two pallets stand inside the marked exit.",
  "checks": 7,
  "peak_confidence": 0.91,
  "evidence_url": "https://api.camly.ai/v1/incidents/inc_123/evidence"
}

started is the first flagged check and confirmed the moment the rules opened the incident. The difference between started and closed is a duration, and a duration is usually what the site wanted to know in the first place: not “the exit was blocked” but “the exit was blocked for eighteen minutes”. We made the case for that unit in an episode, not an alarm.

Three ways an incident ends

close_reason says which.

  • cleared: the scene went back to normal for clear_checks checks in a row.
  • max_duration: it stayed open longer than max_open_minutes (24 hours by default).
  • no_data: no check arrived for three times the longest interval.

The third one deserves a second look. A camera that goes silent must never pass for a calm scene. If the pictures stop while an incident is open, the incident does not quietly stay open for ever and does not quietly close as “cleared” either. It closes with a reason that says the monitor stopped seeing.

Choosing confirm and clear

Situationconfirm_checksWhy
A state that lasts (blocked exit, full bin)2 or 3Removes what merely passes
Something that must alert at once (smoke, a person on the floor)1The first flagged check opens the incident
A noisy scene (reflections, changing light)3 or moreTrades a slower alert for fewer false ones

clear_checks works the other way round: a higher value keeps one incident open through a brief clear moment instead of cutting it in two.

What is kept

A check’s picture is not stored. An incident keeps one evidence picture, the one that was checked, for 30 days by default (1 to 90, set per project), and you can delete it sooner. Every check a monitor made can be read back for 90 days with GET /v1/runs?monitor=mon_123, which is how you draw a level through the day or audit what a monitor saw.1

What a monitor will not run

A monitor sends one picture per check. Trackers and calibrated measures compare two pictures, so the API refuses them on a monitor with 422 agent_not_supported; run those as direct calls from your own code. Find looks at the past and is not used on a monitor either.

The price of state

A check made by a monitor costs €0.006 instead of €0.005 for a direct call, because the monitor also keeps state, opens incidents and keeps their evidence. A live camera with an active monitor also costs €2 a month.1 Skipped pictures are never charged.

Sources

  1. Camly API, all guides as plain text: Monitoring, Limits and prices. platform.camly.ai
  2. Camly API contract (OpenAPI). api.camly.ai