> For the complete documentation index, see [llms.txt](https://docs.globalalerting.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.globalalerting.com/web-api/geofences.md).

# Geofences

## GET /V2/{tenantVarCode}/geofences

> Returns all geofences assigned to the tenant

```json
{"openapi":"3.0.4","info":{"title":"GAP REST API Documentation V2","version":"v2"},"tags":[{"name":"Geofences"}],"paths":{"/V2/{tenantVarCode}/geofences":{"get":{"tags":["Geofences"],"summary":"Returns all geofences assigned to the tenant","parameters":[{"name":"tenantVarCode","in":"path","description":"Tenant Var Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}},"application/json;IEEE754Compatible=false":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}},"application/json;IEEE754Compatible=true":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}},"application/xml":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}},"text/plain":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}},"application/octet-stream":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}},"text/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}},"text/xml":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}},"text/csv":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Geofence"}}}}}}}}},"components":{"schemas":{"Geofence":{"type":"object","properties":{"GeofenceId":{"type":"string","description":"A string that uniquely identifies the geofence","nullable":true},"Name":{"type":"string","description":"A string with geofence name","nullable":true},"FenceWidth":{"type":"integer","description":"A whole number containing fence width in meters. Required for Polyline geofence","format":"int32","nullable":true},"MinZoom":{"type":"integer","description":"Minimum zoom level when geofence is shown","format":"int32"},"MaxZoom":{"type":"integer","description":"Maximum zoom level when geofence is shown","format":"int32"},"CircleRadius":{"type":"integer","description":"A floating point value for radius of circle geofence in meters. Required for Circular geofence","format":"int32","nullable":true},"CircleCentre":{"$ref":"#/components/schemas/LatLon"},"PolygonPositions":{"type":"array","items":{"type":"array","items":{"$ref":"#/components/schemas/LatLon"}},"description":"Array of LatLon objects specifying polygon points where LatLon contains property Lat for latitude (between -90 and +90) and property Lon for longitude (between -180 and +180). Required for Polygon geofence","nullable":true},"PolylinePositions":{"type":"array","items":{"$ref":"#/components/schemas/LatLon"},"description":"Array of LatLon objects specifying polyline points where LatLon contains property Lat for latitude (between -90 and +90) and property Lon for longitude (between -180 and +180). Required for Polyline geofence","nullable":true},"Properties":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"A dictionary with additional geofence properties","nullable":true},"GeofenceType":{"type":"string","description":"Type of geofence object. Valid values are: \"circle\", \"polygon\", \"polyline\"","nullable":true},"Timestamp":{"type":"string","description":"Timestamp (UTC) indicating version of record being returned","format":"date-time","nullable":true},"AppliesToSubtenants":{"type":"boolean","description":"Makes geofence applicable to sub-tenants"}},"additionalProperties":false},"LatLon":{"type":"object","properties":{"Lat":{"type":"number","format":"double"},"Lon":{"type":"number","format":"double"}},"additionalProperties":false}}}}
```

## POST /V2/{tenantVarCode}/geofences

> Creates tenant geofence

```json
{"openapi":"3.0.4","info":{"title":"GAP REST API Documentation V2","version":"v2"},"tags":[{"name":"Geofences"}],"paths":{"/V2/{tenantVarCode}/geofences":{"post":{"tags":["Geofences"],"summary":"Creates tenant geofence","parameters":[{"name":"tenantVarCode","in":"path","description":"Tenant code","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Geofence","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/json;IEEE754Compatible=false":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/json;IEEE754Compatible=true":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/plain":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/xml":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/*+xml":{"schema":{"$ref":"#/components/schemas/Geofence"}}}},"responses":{"200":{"description":"OK"}}}}},"components":{"schemas":{"Geofence":{"type":"object","properties":{"GeofenceId":{"type":"string","description":"A string that uniquely identifies the geofence","nullable":true},"Name":{"type":"string","description":"A string with geofence name","nullable":true},"FenceWidth":{"type":"integer","description":"A whole number containing fence width in meters. Required for Polyline geofence","format":"int32","nullable":true},"MinZoom":{"type":"integer","description":"Minimum zoom level when geofence is shown","format":"int32"},"MaxZoom":{"type":"integer","description":"Maximum zoom level when geofence is shown","format":"int32"},"CircleRadius":{"type":"integer","description":"A floating point value for radius of circle geofence in meters. Required for Circular geofence","format":"int32","nullable":true},"CircleCentre":{"$ref":"#/components/schemas/LatLon"},"PolygonPositions":{"type":"array","items":{"type":"array","items":{"$ref":"#/components/schemas/LatLon"}},"description":"Array of LatLon objects specifying polygon points where LatLon contains property Lat for latitude (between -90 and +90) and property Lon for longitude (between -180 and +180). Required for Polygon geofence","nullable":true},"PolylinePositions":{"type":"array","items":{"$ref":"#/components/schemas/LatLon"},"description":"Array of LatLon objects specifying polyline points where LatLon contains property Lat for latitude (between -90 and +90) and property Lon for longitude (between -180 and +180). Required for Polyline geofence","nullable":true},"Properties":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"A dictionary with additional geofence properties","nullable":true},"GeofenceType":{"type":"string","description":"Type of geofence object. Valid values are: \"circle\", \"polygon\", \"polyline\"","nullable":true},"Timestamp":{"type":"string","description":"Timestamp (UTC) indicating version of record being returned","format":"date-time","nullable":true},"AppliesToSubtenants":{"type":"boolean","description":"Makes geofence applicable to sub-tenants"}},"additionalProperties":false},"LatLon":{"type":"object","properties":{"Lat":{"type":"number","format":"double"},"Lon":{"type":"number","format":"double"}},"additionalProperties":false}}}}
```

## GET /V2/{tenantVarCode}/geofences/{geofenceId}

> Returns a specific geofence assigned to the tenant

```json
{"openapi":"3.0.4","info":{"title":"GAP REST API Documentation V2","version":"v2"},"tags":[{"name":"Geofences"}],"paths":{"/V2/{tenantVarCode}/geofences/{geofenceId}":{"get":{"tags":["Geofences"],"summary":"Returns a specific geofence assigned to the tenant","operationId":"GetGeofence","parameters":[{"name":"tenantVarCode","in":"path","description":"Tenant Var Code","required":true,"schema":{"type":"string"}},{"name":"geofenceId","in":"path","description":"Geofence Id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/json;IEEE754Compatible=false":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/json;IEEE754Compatible=true":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/plain":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/octet-stream":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/xml":{"schema":{"$ref":"#/components/schemas/Geofence"}}}}}}}},"components":{"schemas":{"Geofence":{"type":"object","properties":{"GeofenceId":{"type":"string","description":"A string that uniquely identifies the geofence","nullable":true},"Name":{"type":"string","description":"A string with geofence name","nullable":true},"FenceWidth":{"type":"integer","description":"A whole number containing fence width in meters. Required for Polyline geofence","format":"int32","nullable":true},"MinZoom":{"type":"integer","description":"Minimum zoom level when geofence is shown","format":"int32"},"MaxZoom":{"type":"integer","description":"Maximum zoom level when geofence is shown","format":"int32"},"CircleRadius":{"type":"integer","description":"A floating point value for radius of circle geofence in meters. Required for Circular geofence","format":"int32","nullable":true},"CircleCentre":{"$ref":"#/components/schemas/LatLon"},"PolygonPositions":{"type":"array","items":{"type":"array","items":{"$ref":"#/components/schemas/LatLon"}},"description":"Array of LatLon objects specifying polygon points where LatLon contains property Lat for latitude (between -90 and +90) and property Lon for longitude (between -180 and +180). Required for Polygon geofence","nullable":true},"PolylinePositions":{"type":"array","items":{"$ref":"#/components/schemas/LatLon"},"description":"Array of LatLon objects specifying polyline points where LatLon contains property Lat for latitude (between -90 and +90) and property Lon for longitude (between -180 and +180). Required for Polyline geofence","nullable":true},"Properties":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"A dictionary with additional geofence properties","nullable":true},"GeofenceType":{"type":"string","description":"Type of geofence object. Valid values are: \"circle\", \"polygon\", \"polyline\"","nullable":true},"Timestamp":{"type":"string","description":"Timestamp (UTC) indicating version of record being returned","format":"date-time","nullable":true},"AppliesToSubtenants":{"type":"boolean","description":"Makes geofence applicable to sub-tenants"}},"additionalProperties":false},"LatLon":{"type":"object","properties":{"Lat":{"type":"number","format":"double"},"Lon":{"type":"number","format":"double"}},"additionalProperties":false}}}}
```

## PUT /V2/{tenantVarCode}/geofences/{geofenceId}

> Updates tenant geofence

```json
{"openapi":"3.0.4","info":{"title":"GAP REST API Documentation V2","version":"v2"},"tags":[{"name":"Geofences"}],"paths":{"/V2/{tenantVarCode}/geofences/{geofenceId}":{"put":{"tags":["Geofences"],"summary":"Updates tenant geofence","parameters":[{"name":"tenantVarCode","in":"path","description":"Tenant code","required":true,"schema":{"type":"string"}},{"name":"geofenceId","in":"path","description":"Geofence Id","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Geofence","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/json;IEEE754Compatible=false":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/json;IEEE754Compatible=true":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/plain":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/Geofence"}},"text/xml":{"schema":{"$ref":"#/components/schemas/Geofence"}},"application/*+xml":{"schema":{"$ref":"#/components/schemas/Geofence"}}}},"responses":{"200":{"description":"OK"}}}}},"components":{"schemas":{"Geofence":{"type":"object","properties":{"GeofenceId":{"type":"string","description":"A string that uniquely identifies the geofence","nullable":true},"Name":{"type":"string","description":"A string with geofence name","nullable":true},"FenceWidth":{"type":"integer","description":"A whole number containing fence width in meters. Required for Polyline geofence","format":"int32","nullable":true},"MinZoom":{"type":"integer","description":"Minimum zoom level when geofence is shown","format":"int32"},"MaxZoom":{"type":"integer","description":"Maximum zoom level when geofence is shown","format":"int32"},"CircleRadius":{"type":"integer","description":"A floating point value for radius of circle geofence in meters. Required for Circular geofence","format":"int32","nullable":true},"CircleCentre":{"$ref":"#/components/schemas/LatLon"},"PolygonPositions":{"type":"array","items":{"type":"array","items":{"$ref":"#/components/schemas/LatLon"}},"description":"Array of LatLon objects specifying polygon points where LatLon contains property Lat for latitude (between -90 and +90) and property Lon for longitude (between -180 and +180). Required for Polygon geofence","nullable":true},"PolylinePositions":{"type":"array","items":{"$ref":"#/components/schemas/LatLon"},"description":"Array of LatLon objects specifying polyline points where LatLon contains property Lat for latitude (between -90 and +90) and property Lon for longitude (between -180 and +180). Required for Polyline geofence","nullable":true},"Properties":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"A dictionary with additional geofence properties","nullable":true},"GeofenceType":{"type":"string","description":"Type of geofence object. Valid values are: \"circle\", \"polygon\", \"polyline\"","nullable":true},"Timestamp":{"type":"string","description":"Timestamp (UTC) indicating version of record being returned","format":"date-time","nullable":true},"AppliesToSubtenants":{"type":"boolean","description":"Makes geofence applicable to sub-tenants"}},"additionalProperties":false},"LatLon":{"type":"object","properties":{"Lat":{"type":"number","format":"double"},"Lon":{"type":"number","format":"double"}},"additionalProperties":false}}}}
```

## DELETE /V2/{tenantVarCode}/geofences/{geofenceId}

> Deletes tenant geofence

```json
{"openapi":"3.0.4","info":{"title":"GAP REST API Documentation V2","version":"v2"},"tags":[{"name":"Geofences"}],"paths":{"/V2/{tenantVarCode}/geofences/{geofenceId}":{"delete":{"tags":["Geofences"],"summary":"Deletes tenant geofence","parameters":[{"name":"tenantVarCode","in":"path","description":"Tenant code","required":true,"schema":{"type":"string"}},{"name":"geofenceId","in":"path","description":"Geofence Id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}}}}
```
