---
title: "Gets geofences associated with a device"
method: GET
path: "/device-associations/v2/{trackingId}/geofences"
tags: ["Device Associations"]
deprecated: true
---

# Gets geofences associated with a device

`GET /device-associations/v2/{trackingId}/geofences`

> **Deprecated.**

Gets all geofences associated with the device with `trackingId`.

## Path parameters

- `trackingId` string, required — This is a unique ID associated with the device data in HERE Tracking. For physical devices the `trackingId` gets assigned to a device when the device is claimed by a user, and for virtual devices it is an external device ID along with the device project `appId`.

## Query parameters

- `pageToken` string
- `count` integer
- `appId` string

## Headers

- `X-Request-Id` string, uuid

## Response `200`

Response body contains an array of geofence objects, `count` specifies the number of returned geofences,
and `pageToken` indicates the next available page in the matching result set.

If no geofences are found, an object with empty data array is returned.
Response content type can be either JSON or protobuf depending on the 'Content-Type' request header.

- object — Response body contains an array of geofence objects. `count` indicates the number of returned geofences, and `pageToken` indicates the next available page in the matching result set. If no geofences are found, an object with empty data array is returned.
  - `count` integer — The number of items in the response.
  - `pageToken` string — A token that can be used to retrieve the next page of the response.
  - `data` object[]
    - `geofence` union, required
      - object
        - `definition` object, required — An object that defines the area of a circular geofence
          - `center` object, required — The coordinates of the center point of the circle.
            - `lat` number, required — Latitude in WGS-84 format, decimal representation ranging from -90 to 90.
            - `lng` number, required — Longitude in WGS-84 format, decimal representation ranging from -180 to 180.
          - `floor` object — The building associated with the geofence
            - `id` string, required — The building ID
            - `level` number — The floor of the geofence in integer format
            - `name` string, required — The building name
          - `radius` number, required — The radius of the circle in meters.
        - `description` string — A description of the area that the geofence encloses and the purpose of the geofence.
        - `name` string — A human-readable name of the geofence.
        - `type` 'circle', required — The geofence type.
      - object
        - `definition` object, required — An object that defines the area of a polygonal geofence.
          - `floor` object — The building associated with the geofence
            - `id` string, required — The building ID
            - `level` number — The floor of the geofence in integer format
            - `name` string, required — The building name
          - `points` object[], required — An array of points that define the polygon. A minimum of three and a maximum of ten points is required.
            - `lat` number, required — Latitude in WGS-84 format, decimal representation ranging from -90 to 90.
            - `lng` number, required — Longitude in WGS-84 format, decimal representation ranging from -180 to 180.
        - `description` string — A description of the area that the geofence encloses and the purpose of the geofence.
        - `name` string — A human-readable name of the geofence.
        - `type` 'polygon', required — The geofence type.
      - object
        - `definition` object — An object that defines the area of a POI geofence.
          - `floor` object — The building associated with the geofence
            - `id` string, required — The building ID
            - `level` number — The floor of the geofence in integer format
            - `name` string, required — The building name
          - `location` object — Details of the geofence location
            - `address` string — Address
            - `country` string — Country
            - `position` object — Coordinates for visualization purposes
              - …
            - `room` string — The room ID
        - `description` string — A description of the area that the geofence encloses and the purpose of the geofence.
        - `name` string — A human-readable name of the geofence.
        - `trainingStatus` object, required
          - `metadata` object
            - `coordinate` object — Training data position
              - …
            - `timestamp` integer — Training data timestamp
            - `trackingId` string — This is a unique ID associated with the device data in HERE Tracking. For physical devices the `trackingId` gets assigned to a device when the device is claimed by a user, and for virtual devices it is an external device ID along with the device project `appId`.
            - `usedWlanApCount` number, required — The number of WLAN access point used in training
          - `trained` boolean, required — True if the POI geofence is trained
        - `type` 'poi', required — The geofence type.
    - `id` string, uuid, required — Geofence ID

## Other responses

- `400` — Bad request The request object is in an incorrect format or has values that are invalid or out of range. If available, further error details are provided in the response body.
- `401` — Unauthorized The request did not provide correct authentication details
- `403` — Forbidden The account does not have the correct privileges
- `404` — TrackingId not found.

---

[API](https://skmtc.net/here/apis/tracking.md) · [All operations](https://skmtc.net/here/apis/tracking/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/here/tracking/versions/efa162f7023c/schema)
