The Geofence API enables developers to define, update, and query geofencesโvirtual boundaries around geographic areas of interest. It supports:
This API is essential for location-based alerts, restricted zone monitoring, asset tracking, and smart mobility applications.
Authorization: X-Authorization-Token
(Get your token HERE)/v4/geofence/create
curl --location 'https://apihub.latlong.ai/v4/geofence/create.json' --data '{
"name":"geofence1",
"geojson":{
"coordinates":[
[
[
77.55750175149694,
13.052318591801537
],
[
77.50495769457018,
12.987745328784783
],
[
77.54197737104056,
12.9173355309442
],
[
77.65602185823303,
12.878339742302444
],
[
77.72528447872816,
12.92257330790521
],
[
77.7091630067157,
13.001126755861733
],
[
77.61721090709494,
13.061043416466177
],
[
77.55750175149694,
13.052318591801537
]
]
],
"type": "Polygon"
}
}'
{
"code": 1001,
"status": "success",
"data": {
"geofence_id": "57daa174-17b1-44d6-abd1-c97129840d5e",
"name": "geofence1"
}
}
/v4/geofence/update
curl --location 'https://apihub.latlong.ai/v4/geofence/update.json'
--data '{
"geofence_id": "57daa174-17b1-44d6-abd1-c97129840d5e",
"name": "geofence1",
"geojson":{
"coordinates": [
[
[
77.55750175149694,
13.052318591801537
],
[
77.50495769457018,
12.987745328784783
],
[
77.54197737104056,
12.9173355309442
],
[
77.65602185823303,
12.878339742302444
],
[
77.72528447872816,
12.92257330790521
],
[
77.7091630067157,
13.001126755861733
],
[
77.61721090709494,
13.061043416466177
],
[
77.55750175149694,
13.052318591801537
]
]
],
"type": "Polygon"
}
}โ
{
"code": 1001,
"status": "success",
"data": {
"geofence_id": "57daa174-17b1-44d6-abd1-c97129840d5e",
"updated_at": 1691389832,
"name": "geofence1"
}
}
/v4/geofence/contains
curl --location โhttps://apihub.latlong.ai/v4/geofence/contains.json?geofence_id=57daa174-17b1-44d6-abd1-c97129840d5e&lat=12.975976804797252&long=77.59630898987734&buffer_distance=200'
{
"code": 1001,
"status": "success",
"data": {
"contains": true,
"geofence_id": "57daa174-17b1-44d6-abd1-c97129840d5e",
"lat": 12.975976804797252,
"long": 77.59630898987734
}
}
Parameter | Type | Description |
---|---|---|
geofence_id | String | Unique identifier for the geofence |
coordinates | Array | Array of lat/lon points defining a polygon |
latitude | Float | Latitude of the point to be checked |
longitude | Float | Longitude of the point to be checked |
Alert when a delivery vehicle enters or exits a zone
Trigger actions when assets leave industrial boundaries
๏ธ Track whether wildlife or people remain inside protected zones
Geofencing attendance and access control systems
Status Code | Message | Description |
---|---|---|
400 | Missing required parameters | Missing or malformed request |
401 | Unauthorized | Invalid or missing API token |
404 | Not found | Geofence ID does not exist |
500 | Internal Server Error | Internal server issue |