Point-in-polygon check. Geocode the address, then check if lat/lon falls inside your delivery territory.
Get your API key from fencemaker.app/dashboard/api-keys. Free tier: 1,000 checks/day.
Three options:
• Draw on map at fencemaker.app/dashboard/fences (click "New Fence", trace your delivery area)
• Import GeoJSON (upload existing boundary from Google My Maps, Felt, or any GIS tool)
• API creation: POST /api/v1/territories with GeoJSON for programmatic setup
Save the returned territory_id (UUID) — you'll compare against it in every /pip response.
GET /api/v1/pip?lat={lat}&lon={lon} — returns { matched: true/false, territory: { id, name, code } }.
Handle the boolean response server-side. Zone validation = business logic, not frontend-only.
// After geocoding the delivery address (Mapsi, Google, etc.)
const { lat, lon } = geocodedResult;
// Check if address falls inside your delivery territory
const res = await fetch(
`https://fencemaker.app/api/v1/pip?lat=${lat}&lon=${lon}`,
{ headers: { 'X-API-Key': 'YOUR_KEY' } }
);
const data = await res.json();
// matched: true means inside a territory — verify it's your delivery zone
const inside = data.matched && data.territory.id === deliveryTerritoryId;
if (!inside) {
return res.status(400).json({
error: 'Sorry, we don't deliver to this address yet'
});
}
// Proceed with order fulfillment
await createOrder(orderData);Always check on the backend, not frontend-only. Zone rules = business logic. Don't trust client-side validation for fulfillment decisions. The response field is 'matched' (boolean). If you operate multiple delivery zones, use ?multi=true and check data.territories for your territory_id instead.