Quick Start

Get from zero to your first geofence check in 5 minutes.

1

Get Your API Key

Go to API Keys and create a new key. The full key is shown once — copy it immediately.

gfnsr_live_aBcDeFgHiJkLmNoPqRsT...
2

Your First PiP Call

Check which territory a coordinate belongs to:

curl -X GET "https://fencemaker.app/api/v1/pip?lat=12.9716&lon=77.5946" \
  -H "X-API-Key: YOUR_API_KEY"
Response
{
  "matched": true,
  "territory": { "name": "South Bengaluru", "code": "ZONE-A", "agent_id": "R-001" },
  "response_ms": 8
}
3

Register a Device (for webhooks)

If you want real-time entry/exit alerts:

curl -X POST https://fencemaker.app/api/v1/devices \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"device_id": "RIDER-042", "label": "Rahul's bike"}'
4

Send a GPS Ping

Forward device location to evaluate geofences:

curl -X POST https://fencemaker.app/api/v1/track \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"device_id": "RIDER-042", "lat": 12.9716, "lon": 77.5946}'
Response (if device entered a territory)
{
  "events": [{ "type": "entered", "territory_code": "ZONE-A", "webhook_fired": true }],
  "response_ms": 12
}
5

Test Your Webhook

Simulate an event without a real device:

curl -X POST https://fencemaker.app/api/v1/events/simulate \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"territory_id": "UUID", "device_id": "TEST-01", "event_type": "entered"}'
💡 Batch: Use POST /api/v1/pip/batch to check up to 1,000 points in one request.

Code Examples

Python

import requests

API_KEY = "gfnsr_live_..."
BASE = "https://fencemaker.app"

# Single PiP check
r = requests.get(f"{BASE}/api/v1/pip", params={"lat": 12.97, "lon": 77.59},
    headers={"X-API-Key": API_KEY})
print(r.json())

# Track a device
r = requests.post(f"{BASE}/api/v1/track",
    json={"device_id": "RIDER-042", "lat": 12.97, "lon": 77.59},
    headers={"X-API-Key": API_KEY, "Content-Type": "application/json"})
print(r.json()["events"])

Node.js

const API_KEY = "gfnsr_live_...";
const BASE = "https://fencemaker.app";

// PiP check
const res = await fetch(`${BASE}/api/v1/pip?lat=12.97&lon=77.59`, {
  headers: { "X-API-Key": API_KEY }
});
console.log(await res.json());

// Track
const t = await fetch(`${BASE}/api/v1/track`, {
  method: "POST",
  headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ device_id: "RIDER-042", lat: 12.97, lon: 77.59 })
});
console.log((await t.json()).events);