geofence_Geofences

Create a new geofence

Changed on

Creates a new geofence for the tenant, defined by its geographic boundary and the device actions to trigger when a device crosses it.

Submit the geofence's geometry (location and radius) along with the desired device actions; on success, returns the created geofence instance.

About Geofences

A geofence is a virtual geographic boundary that triggers device actions — such as locking down or sounding an alert — when a managed device enters or leaves the defined area. Geofences can also be associated with blueprints so that location determines which configuration is applied to a device.

Key Fields / Query Parameters

  • geometry (location and radius) — defines the physical boundary of the geofence
  • device actions — the actions (e.g., lock down, beep) applied to devices crossing the boundary

Common Use Cases

  • Setting up a new location-based restriction, such as locking down devices that leave a warehouse or job site
  • Defining a boundary that later gets tied to blueprint-based configuration changes
post/geofence/v1/geofences

Request

  • Base URL
    https://develop-api.esper.cloud/api
  • URL
    https://develop-api.esper.cloud/api/geofence/v1/geofences
  • Auth
    HTTP bearer

Request body

namestring required

Name of the geofence

descriptionstring

Optional description of the geofence

actionsstring[]

Actions to trigger when geofence conditions are met. Empty array means no actions.

Example request

{
  "name": "Geofence 1",
  "description": "A geofence that is either polygonal or circular.",
  "actions": [
    "lockdown",
    "beep"
  ],
  "geometry": {
    "type": "polygon",
    "coordinates": [
      {
        "latitude": 41.8902,
        "longitude": 12.4924
      },
      {
        "latitude": 41.8903,
        "longitude": 12.4925
      },
      {
        "latitude": 41.8904,
        "longitude": 12.4926
      }
    ]
  }
}

Response

Geofence created successfully

Example response

{
  "content": {
    "id": "11111111-1111-1111-1111-111111111111",
    "name": "Warehouse Perimeter",
    "description": "A polygon-shaped geofence",
    "actions": [
      "lockdown",
      "beep"
    ],
    "geometry": {
      "type": "polygon",
      "coordinates": [
        {
          "latitude": 41.8902,
          "longitude": 12.4924
        },
        {
          "latitude": 41.8903,
          "longitude": 12.4925
        },
        {
          "latitude": 41.8904,
          "longitude": 12.4926
        }
      ]
    },
    "created_at": "2024-06-24T14:00:00Z",
    "updated_at": "2024-06-24T15:00:00Z"
  }
}

Changes

    • warning

      deleted the header request parameter X-Caller-Id

    • warning

      deleted the header request parameter X-Esper-Tenant-Id