Skip to main content

Delete Geo Location

Enterprise Only
This API is available exclusively in Countly Enterprise.

Endpoint

/i/geolocations/delete

Overview

Soft-deletes a geolocation by setting its deleted flag.

Authentication

  • Authentication methods:
    • API Key (parameter): api_key=YOUR_API_KEY
    • Auth Token (parameter): auth_token=YOUR_AUTH_TOKEN
    • Auth Token (header): countly-token: YOUR_AUTH_TOKEN

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)

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/Processing

  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.

Database Collections

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

Examples

Example: Delete a Geolocation

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

Ⓔ Enterprise

This feature is part of Countly Enterprise.

Get Access:

Already a Customer? Use support portal if you have any questions


Last Updated

2026-02-16