Skip to main content
Version: 24.05

Delete Geo Location

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint​

/i/geolocations/delete

Overview​

Soft-deletes a geolocation by setting its deleted flag.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

  • Required permission: Delete on the geo feature
  • Additional rules:
    • Only global admins can delete global (non-app-specific) locations.
    • App admins can delete only locations in apps they administer.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApplication context for permission checks
gidStringYesGeolocation ID (24-char ObjectID)

Examples​

Example: Delete a Geolocation​

https://your-server.com/i/geolocations/delete?api_key=YOUR_API_KEY&app_id=609bd78d90d7a416d4dfb984&gid=62616692a9ddc55457bad406

Response​

Success Response​

{
"_id": "62616692a9ddc55457bad406",
"title": "Berlin Store",
"radius": 5,
"unit": "km",
"geo": {
"type": "Point",
"coordinates": [13.405, 52.52]
},
"app": "609bd78d90d7a416d4dfb984",
"address": "Berlin, Germany",
"deleted": true
}

Response Fields​

FieldTypeDescription
_idStringDeleted geolocation ID
titleStringLocation title
radiusNumberRadius value
unitStringUnit label
geoObjectLocation point
appStringApp ID (if app-specific)
addressStringStored address
deletedBooleanAlways true after successful deletion

Error Responses​

HTTP StatusResponse
400{"result":"Not enough args"}
404{"result":"Location not found"}
403{"result":"Only global admin can delete non-app-specific geolocations"}
403{"result":"Only admin of app can can delete geolocations"}

Behavior​

  1. Validates gid format and permissions.
  2. Loads the geolocation scoped to the request app.
  3. Marks the record as deleted (deleted: true).
  4. Returns the updated location object.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.geosEndpoint data source** - Finds and soft-deletes geolocation records