Geofence API
Create, manage, and query virtual geographic boundaries. Check if a point is inside a geofence for delivery zones, restricted areas, and location-based alerts.
Try in Playground →Authentication
All geofence endpoints require your API token:
X-Authorization-Token: your_token_here
Endpoints
POSTCreate GeofenceGETContains (Point in Geofence)GETList GeofencesGETGeofence DetailsPOSTUpdate Geofence
POST
/v4/geofence/create.jsonCreate Geofence
Create a new virtual geographic boundary by providing a polygon geometry.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Optional | Optional name for the geofence |
| geometry | object | Required | GeoJSON Polygon with coordinates array |
Code Examples
curl -X POST "https://apihub.latlong.ai/v4/geofence/create.json" \
-H "X-Authorization-Token: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"coordinates": [
[
77.59,
12.97
],
[
77.6,
12.98
]
]
}'Response
JSON200 OK
{
"status": "success",
"geofence_id": "gf_abc123",
"message": "Geofence created successfully"
}GET
/v4/geofence/contains.jsonContains (Point in Geofence)
Check if a given latitude/longitude point falls inside any of your geofences.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| latitude | number | Required | Latitude of the point to check |
| longitude | number | Required | Longitude of the point to check |
| geofence_id | string | Optional | Check against a specific geofence (optional — checks all if omitted) |
Code Examples
curl "https://apihub.latlong.ai/v4/geofence/contains.json?latitude=VALUE&longitude=VALUE" \ -H "X-Authorization-Token: YOUR_TOKEN"
Response
JSON200 OK
{
"status": "success",
"code": 1001,
"data": {
"inside": true,
"geofence_id": "gf_abc123",
"geofence_name": "Office Zone"
}
}GET
/v4/geofence/list.jsonList Geofences
Retrieve a list of all geofences created under your account.
Code Examples
curl "https://apihub.latlong.ai/v4/geofence/list.json" \ -H "X-Authorization-Token: YOUR_TOKEN"
Response
JSON200 OK
{
"status": "success",
"code": 1001,
"data": [
{ "geofence_id": "gf_abc123", "name": "Office Zone", "created_at": "2025-01-15" },
{ "geofence_id": "gf_def456", "name": "Warehouse", "created_at": "2025-02-10" }
]
}GET
/v4/geofence/details.jsonGeofence Details
Get the full details and geometry of a specific geofence by its ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| geofence_id | string | Required | The ID of the geofence to retrieve |
Code Examples
curl "https://apihub.latlong.ai/v4/geofence/details.json?geofence_id=VALUE" \ -H "X-Authorization-Token: YOUR_TOKEN"
Response
JSON200 OK
{
"status": "success",
"code": 1001,
"data": {
"geofence_id": "gf_abc123",
"name": "Office Zone",
"geometry": {
"type": "Polygon",
"coordinates": [[[77.59,12.97],[77.60,12.97],[77.60,12.98],[77.59,12.98],[77.59,12.97]]]
},
"created_at": "2025-01-15"
}
}POST
/v4/geofence/update.jsonUpdate Geofence
Update the geometry or name of an existing geofence.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| geofence_id | string | Required | The ID of the geofence to update |
| name | string | Optional | New name for the geofence |
| geometry | object | Required | Updated GeoJSON Polygon coordinates |
Code Examples
curl -X POST "https://apihub.latlong.ai/v4/geofence/update.json" \
-H "X-Authorization-Token: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"coordinates": [
[
77.59,
12.97
],
[
77.6,
12.98
]
]
}'Response
JSON200 OK
{
"status": "success",
"message": "Geofence updated successfully"
}Ready to try it?
Draw polygons and test geofence APIs interactively.

