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

Route compliance monitoring

Exit webhook detection. Track vehicles along approved corridors — get instant alerts when they deviate from the route.

1

Create Fencemaker account, get API key

Free tier: 1,000 location updates/day. For commercial fleet tracking, Growth plan covers 35,000/day.

2

Define approved transit corridors

Create corridor territories (buffered routes):
• Draw corridor: At fencemaker.app/dashboard/fences, trace the approved highway/route with buffer zones
• Import from routing: Export route from Google Maps/Mapbox as GeoJSON, buffer it (PostGIS ST_Buffer or turf.js), upload
• API creation: POST /api/v1/territories with GeoJSON for bulk setup

For high-value shipments, create one territory per route segment for granular tracking.

3

Configure exit webhook

At fencemaker.app/dashboard/webhooks, add your endpoint.
Vehicle tracking app sends POST /api/v1/track updates every 30–60 seconds.
When vehicle exits the corridor territory, you receive an "exited" webhook immediately.

4

Handle deviation alerts

On "exited" event: log the violation, alert dispatch, notify customer, trigger re-routing.
Store territory_id → route_name mapping so you know which corridor was violated.

// Webhook receives "exited" event when truck leaves approved corridor:
// POST https://yourapi.com/webhooks/geofence
// {
//   "event": "exited",
//   "territory_id": "uuid",
//   "territory_code": "CORRIDOR-1",
//   "territory_name": "Highway 95 Corridor",
//   "device_id": "truck_42",
//   "timestamp": "2026-05-10T14:32:00Z",
//   "lat": 12.9716, "lon": 77.5946
// }

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

  if (event === 'exited') {
    // Vehicle left approved corridor
    const shipment = await findActiveShipment(device_id);

    // Log the violation with location
    await logEvent({
      type: 'route_deviation',
      shipment_id: shipment.id,
      corridor: territory_id,
      location: { lat, lon },
      timestamp
    });

    // Alert dispatch immediately
    await sendSlackAlert(
      `🚨 Truck ${device_id} deviated from approved route (${territory_name})`
    );

    // Optional: trigger customer notification
    if (shipment.high_value) {
      await notifyCustomer(shipment.customer_id,
        'Your shipment route has been updated'
      );
    }
  }

  res.sendStatus(200);
});

Watch out:

Corridor territories need buffer zones — a vehicle on the exact route centerline will trigger false exits due to GPS drift (±5–15m accuracy). Buffer your corridors by at least 50–100 meters. For highways, 200m works well. Test with real vehicle data before deploying to production.