---
title: "Updates a single geofence"
method: PUT
path: "/geofences/v2/{geofenceId}"
tags: ["Geofences"]
---

# Updates a single geofence

`PUT /geofences/v2/{geofenceId}`

Updates the geofence `type`, `name`, `description` or `definition` property. 
The old geofence will be replaced by the new one, and hence the full set of the 
geofence properties must be provided in the request body. 
`POI` geofence type cannot be changed to `circle` or `polygon` and vice versa.

If the update was successful, the response will contain the updated geofence details.

## Request body

- union
  - 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
          - `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.
        - `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.
    - `type` 'poi', required — The geofence type.

## Response `200`

Successful

The geofence definition was updated.

- object — Response body contains a single geofence 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
            - `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.
          - `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.
      - `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` — Geofence ID 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)
