LocalSDK

Nearby Devices

Device management and discovery

Nearby devices

Search for devices within a radius of a geographic point. Uses geohash-based indexing for efficient proximity search.

GET
/api/v1/devices/nearby

Authorization

BearerAuth
AuthorizationBearer <token>

API key obtained from the LocalSDK admin panel. Pass as: Authorization: Bearer <api_key>

In: header

Query Parameters

latitude*number

Latitude of the center point.

Range-90 <= value <= 90
longitude*number

Longitude of the center point.

Range-180 <= value <= 180
radius_miles?number

Search radius in miles.

Default5
Range0 <= value <= 50
max_age_hours?number

Maximum age of location in hours.

Default24
Range0 <= value
limit?integer

Number of results to return.

Default100
Range1 <= value <= 1000
offset?integer

Pagination offset.

Default0
Range0 <= value
min_accuracy?number

Minimum accuracy requirement in meters.

Range0 <= value

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://api.localsdk.com/api/v1/devices/nearby?latitude=-90&longitude=-180"
{
  "success": true,
  "app_id": "app_a1b2c3d4e5f6",
  "search_criteria": {
    "center": {
      "latitude": 33.4484,
      "longitude": -112.074
    },
    "radius_miles": 10,
    "max_age_hours": 24
  },
  "results": [
    {
      "device_id": "68e4382b39d914721f85e624",
      "distance_miles": 0.42,
      "bearing_degrees": 135,
      "location": {
        "app_id": "app_a1b2c3d4e5f6",
        "device_id": "68e4382b39d914721f85e624",
        "latitude": 33.445,
        "longitude": -112.07,
        "timestamp": 1709564400000,
        "horizontal_accuracy": 6.5,
        "vertical_accuracy": 3.2,
        "altitude": 331.2,
        "speed": 0,
        "bearing": 0,
        "type": "STATIONARY",
        "battery_level": 78,
        "battery_status": "Not Charging",
        "is_mock": false,
        "user_id": "user_123",
        "tz_offset": "-7",
        "network_status": true,
        "tracking_mode": "PRECISE",
        "location_permission": true
      }
    },
    {
      "device_id": "93h7615e62gc47054i18h957",
      "distance_miles": 3.17,
      "bearing_degrees": 270,
      "location": {
        "app_id": "app_a1b2c3d4e5f6",
        "device_id": "93h7615e62gc47054i18h957",
        "latitude": 33.452,
        "longitude": -112.12,
        "timestamp": 1709564200000,
        "horizontal_accuracy": 9.8,
        "vertical_accuracy": 4.5,
        "altitude": 328.5,
        "speed": 1.2,
        "bearing": 180,
        "type": "MOVING",
        "battery_level": 34,
        "battery_status": "Not Charging",
        "is_mock": false,
        "user_id": "user_789",
        "tz_offset": "-7",
        "network_status": true,
        "tracking_mode": "PRECISE",
        "location_permission": true
      }
    }
  ],
  "pagination": {
    "count": 2,
    "offset": 0,
    "limit": 100,
    "total_matches": 2,
    "has_more": false
  },
  "total_candidates": 18,
  "query_time_ms": 95
}

{
  "success": false,
  "message": "Invalid latitude. Must be between -90 and 90"
}

{
  "success": false,
  "error": "MISSING_API_KEY",
  "code": "AUTH_001",
  "message": "API key is required. Provide it in Authorization header as \"Bearer <api_key>\""
}

{
  "success": false,
  "error": "INSUFFICIENT_PERMISSIONS",
  "code": "AUTH_005",
  "message": "Permission 'read' is required for this endpoint"
}