fencemaker
HomePricingUse CasesMigrate from RadarLive DemoQuickstartIntegrate with Android/iOS NEWPrompts for AI NEWMCP NEWDocsOperations Portal
Fencemaker API

Idle time detection in zones

Dwell time tracking. Monitor how long devices linger inside restricted areas — use exit webhooks with dwell_seconds to surface violations.

1

Create Fencemaker account, get API key

Free tier: 1,000 location updates/day. Growth plan covers 35,000/day for commercial monitoring.

2

Define restricted zones with limits

Create territories for zones where dwell time matters:
• Loading zones (15-minute limit)
• No-parking zones (immediate violation)
• Security perimeters (10-minute threshold)
• Equipment rental sites (hourly billing)

Store territory_id → max_dwell_seconds mapping in your DB.

3

Configure webhook endpoint

At fencemaker.app/dashboard/webhooks, add your HTTPS endpoint.
Mobile app sends POST /api/v1/track location updates.
On exit, the "exited" webhook payload includes a dwell_seconds field.

4

Check dwell_seconds on "exited" event, log violations

Compare dwell_seconds against your threshold for that territory.
If exceeded: log violation, send alert, trigger penalty/fee calculation.

// Exit webhook includes dwell_seconds:
// POST https://yourapi.com/webhooks/geofence
// {
//   "event": "exited",
//   "device_id": "truck_42",
//   "territory_id": "uuid",
//   "territory_code": "LOAD-1",
//   "territory_name": "Loading Zone A",
//   "dwell_seconds": 1847,  // 30 minutes 47 seconds
//   "lat": 12.9716, "lon": 77.5946,
//   "timestamp": "2026-05-10T14:32:00Z"
// }

app.post('/webhooks/geofence', async (req, res) => {
  const { event, territory_id, device_id, dwell_seconds } = req.body;

  if (event === 'exited' && dwell_seconds) {
    // Threshold rules stored in your DB, keyed by territory_id
    const thresholds = {
      'uuid-loading-zone':   900,  // 15 minutes max
      'uuid-no-parking':     0,    // immediate violation
      'uuid-security-perim': 600  // 10 minutes max
    };

    const maxDwell = thresholds[territory_id];

    if (dwell_seconds > maxDwell) {
      await logViolation({
        device_id,
        zone: territory_id,
        dwell_seconds,
        threshold: maxDwell,
        overstay: dwell_seconds - maxDwell
      });

      await sendAlert(
        `Vehicle ${device_id} exceeded ${maxDwell}s limit in ${territory_id}`
      );

      const overstayMinutes = Math.ceil((dwell_seconds - maxDwell) / 60);
      const penalty = overstayMinutes * 500; // $5/minute
      await createCharge(device_id, penalty);
    }
  }

  res.sendStatus(200);
});

Watch out:

You're detecting violations on the "exited" webhook event, not while the device is still inside. If you need "alert after 15 minutes WHILE still inside," you'll need to poll the entry timestamp yourself or implement threshold-based monitoring. dwell_seconds is included automatically in every exit webhook — no extra API calls needed.