---
title: "Get devices for a geofence"
method: GET
path: "/geofence/v1/geofences/{geofence_id}/devices"
tags: ["geofence_Device State"]
---

# Get devices for a geofence

`GET /geofence/v1/geofences/{geofence_id}/devices`

## Request

- Base URL: `https://develop-api.esper.cloud/api`
- URL: `https://develop-api.esper.cloud/api/geofence/v1/geofences/{geofence_id}/devices`
- Auth: HTTP bearer

Returns a paginated list of devices and their current state relative to a specific geofence. Use it when you need the actual device records, not just aggregate counts.

Supports filtering by inside/outside status and by blueprint version ID, so you can drill into, for example, only the devices currently outside the boundary running a particular blueprint version.

**About Geofences**

A geofence is a virtual geographic boundary tied to device location tracking, and can be associated with blueprint-driven configuration so a device's blueprint version may factor into how it's managed inside vs. outside the fence. This endpoint exposes the per-device detail behind the aggregate device-summary statistics.

**Key Fields / Query Parameters**

- geofence_id — path parameter identifying the geofence
- inside/outside status — filters devices by whether they are currently within the geofence boundary
- blueprint version ID — filters devices by the blueprint version they're currently running

**Common Use Cases**

- Listing devices that have left a geofenced area for follow-up or remediation
- Cross-referencing which blueprint versions are running on devices inside vs. outside a boundary

## Path parameters

- `geofence_id` string, uuid, required

## Query parameters

- `offset` integer
- `limit` integer
- `inside` boolean
- `blueprint_id` string, uuid
- `blueprint_version_number` integer

## Headers

- `X-Esper-Tenant-Id` string, uuid, required
- `X-Caller-Id` string, required

## Response `200`

Device list retrieved successfully

- object
  - `content` object
    - `next` string, nullable
    - `previous` string, nullable
    - `results` GeofenceDeviceListingItem[]
      - `device_id` string, uuid, required: UUID of the device
      - `blueprint_id` string, uuid, required: UUID of the blueprint used by this device
      - `blueprint_version_number` integer, required: Blueprint version number used by this device
      - `inside` boolean, nullable: Whether the device is currently inside the geofence. Null means unknown state.
      - `state_changed_at` string, date-time, nullable: When the device's geofence state was last changed. Null means unknown time.
      - `latitude` number, double, nullable: Last known latitude for the device, rounded to 4 decimal places.
      - `longitude` number, double, nullable: Last known longitude for the device, rounded to 4 decimal places.
      - `location_updated_at` string, date-time, nullable: Timestamp when the device location was last updated.

## Other responses

- `400`: Invalid geofence ID, missing tenant ID, invalid query parameters, or missing pagination parameters
- `401`: Unauthorized
- `500`: Server error

---

[API](https://skmtc.dev/esper/apis/esper-api-reference.md) - [All operations](https://skmtc.dev/esper/apis/esper-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/esper/apis/esper-api-reference/revisions/fa7b9b652fb2?raw)
