Geofences
Geofences are virtual boundaries you define in Pointeron — they allow you to create geographic zones and receive alerts when assets enter or exit them. On this page, we'll dive into the different geofence endpoints you can use to manage geofences programmatically. We'll look at how to query, create, update, and delete geofences.
The geofence model
The geofence model contains all the information about your geofences, including the name, description, boundary coordinates, and which assets are being monitored.
Properties
- Name
id- Type
- string
- Description
Unique identifier for the geofence.
- Name
name- Type
- string
- Description
The name for the geofence.
- Name
description- Type
- string
- Description
The description for the geofence.
- Name
type- Type
- string
- Description
The geofence type (circle or polygon).
- Name
coordinates- Type
- array
- Description
The boundary coordinates for the geofence.
- Name
radius- Type
- float
- Description
The radius in meters (for circle geofences).
- Name
assets- Type
- array
- Description
An array of asset objects that are monitored by this geofence.
- Name
created_at- Type
- timestamp
- Description
Timestamp of when the geofence was created.
- Name
archived_at- Type
- timestamp
- Description
Timestamp of when the geofence was archived.
List all geofences
This endpoint allows you to retrieve a paginated list of all your geofences. By default, a maximum of ten geofences are shown per page.
Optional attributes
- Name
limit- Type
- integer
- Description
Limit the number of geofences returned.
- Name
archived- Type
- boolean
- Description
Only show geofences that are archived when set to
true.
Request
curl -G https://api.pointeron.com/v1/geofences \
-H "Authorization: Bearer {token}" \
-d limit=10
Response
{
"has_more": false,
"data": [
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Warehouse Zone",
"description": "Main distribution warehouse.",
"type": "circle",
"coordinates": [{"lat": 46.0569, "lng": 14.5058}],
"radius": 500.0,
"assets": [
{
"name": "Fleet Truck 01"
// ...
},
{
"name": "Fleet Truck 02"
// ...
}
],
"created_at": 692233200,
"archived_at": null
},
{
"id": "hSIhXBhNe8X1d8Et"
// ...
}
]
}
Create a geofence
This endpoint allows you to create a new geofence in your Pointeron organization.
Required attributes
- Name
name- Type
- string
- Description
The name for the geofence.
- Name
type- Type
- string
- Description
The geofence type (circle or polygon).
- Name
coordinates- Type
- array
- Description
The boundary coordinates for the geofence.
Optional attributes
- Name
description- Type
- string
- Description
The description for the geofence.
- Name
radius- Type
- float
- Description
The radius in meters (for circle geofences).
- Name
assets- Type
- array
- Description
An array of asset IDs to monitor with this geofence.
Request
curl https://api.pointeron.com/v1/geofences \
-H "Authorization: Bearer {token}" \
-d name="Warehouse Zone"
Response
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Warehouse Zone",
"description": null,
"type": "circle",
"coordinates": [],
"radius": null,
"assets": [],
"created_at": 692233200,
"archived_at": null
}
Retrieve a geofence
This endpoint allows you to retrieve a geofence by providing the geofence id. Refer to the list at the top of this page to see which properties are included with geofence objects.
Request
curl https://api.pointeron.com/v1/geofences/l7cGNIBKZiNJ6wqF \
-H "Authorization: Bearer {token}"
Response
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Warehouse Zone",
"description": "Main distribution warehouse.",
"type": "circle",
"coordinates": [{"lat": 46.0569, "lng": 14.5058}],
"radius": 500.0,
"assets": [
{
"name": "Fleet Truck 01"
// ...
},
{
"name": "Fleet Truck 02"
// ...
}
],
"created_at": 692233200,
"archived_at": null
}
Update a geofence
This endpoint allows you to perform an update on a geofence. Examples of updates are changing the name, description, coordinates, or adding and removing monitored assets.
Optional attributes
- Name
name- Type
- string
- Description
The new name for the geofence.
- Name
description- Type
- string
- Description
The new description for the geofence.
- Name
coordinates- Type
- array
- Description
The new boundary coordinates for the geofence.
- Name
radius- Type
- float
- Description
The new radius in meters (for circle geofences).
- Name
assets- Type
- array
- Description
An array of asset IDs to monitor with this geofence.
- Name
archived_at- Type
- timestamp
- Description
Timestamp of when the geofence was archived.
Request
curl -X PUT https://api.pointeron.com/v1/geofences/l7cGNIBKZiNJ6wqF \
-H "Authorization: Bearer {token}" \
-d description="Primary distribution hub."
Response
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Warehouse Zone",
"description": "Primary distribution hub.",
"type": "circle",
"coordinates": [{"lat": 46.0569, "lng": 14.5058}],
"radius": 500.0,
"assets": [
{
"name": "Fleet Truck 01"
// ...
},
{
"name": "Fleet Truck 02"
// ...
}
],
"created_at": 692233200,
"archived_at": null
}
Delete a geofence
This endpoint allows you to delete geofences. Note: This will permanently delete the geofence and all associated alerts — archive it instead if you want to be able to restore it later.
Request
curl -X DELETE https://api.pointeron.com/v1/geofences/l7cGNIBKZiNJ6wqF \
-H "Authorization: Bearer {token}"