LocalSDK

Current Location

Retrieve latest device positions

Current location — single device

Retrieve the latest position for a single device.

GET
/api/v1/devices/{deviceId}/locations/current

Authorization

BearerAuth
AuthorizationBearer <token>

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

In: header

Path Parameters

deviceId*string

Unique device identifier.

Query Parameters

timezone?string

Timezone for timestamp conversion. Accepts:

  • IANA names: America/Phoenix, Europe/London, Asia/Tokyo
  • UTC offsets: +05:30, -07:00
  • Abbreviations: PST, EST, CST, MST, UTC, GMT

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.localsdk.com/api/v1/devices/68e4382b39d914721f85e624/locations/current?timezone=America%2FPhoenix"

{
  "success": true,
  "device_id": "68e4382b39d914721f85e624",
  "location": {
    "device_id": "68e4382b39d914721f85e624",
    "app_id": "app_a1b2c3d4e5f6",
    "timestamp": 1709564400000,
    "latitude": 33.4484,
    "longitude": -112.074,
    "horizontal_accuracy": 6.5,
    "vertical_accuracy": 3.2,
    "altitude": 331.2,
    "speed": 0,
    "bearing": 0,
    "type": "STATIONARY",
    "battery_level": 78,
    "battery_status": "Not Charging",
    "network_status": true,
    "location_permission": true,
    "is_mock": false,
    "tracking_mode": "PRECISE",
    "tz_offset": "-7",
    "user_id": "user_123",
    "id": "loc_9f8e7d6c5b4a"
  }
}

{
  "success": false,
  "message": "Invalid timezone: Invalid/Zone"
}

{
  "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"
}

{
  "success": false,
  "device_id": "68e4382b39d914721f85e624",
  "message": "Device not found or does not belong to your app"
}

Current location — all devices

Fetch the latest positions across all devices associated with your app.

GET
/api/v1/locations/current

Authorization

BearerAuth
AuthorizationBearer <token>

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

In: header

Query Parameters

limit?integer

Number of results to return.

Default100
Range1 <= value <= 1000
offset?integer

Pagination offset.

Default0
Range0 <= value
timestamp_after?integer

Filter locations after this Unix timestamp (milliseconds).

Formatint64
timestamp_before?integer

Filter locations before this Unix timestamp (milliseconds).

Formatint64
timezone?string

Timezone for timestamp conversion. Accepts:

  • IANA names: America/Phoenix, Europe/London, Asia/Tokyo
  • UTC offsets: +05:30, -07:00
  • Abbreviations: PST, EST, CST, MST, UTC, GMT

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://api.localsdk.com/api/v1/locations/current?timezone=America%2FPhoenix"
{
  "success": true,
  "app_id": "app_a1b2c3d4e5f6",
  "locations": [
    {
      "device_id": "68e4382b39d914721f85e624",
      "app_id": "app_a1b2c3d4e5f6",
      "timestamp": 1709564400000,
      "latitude": 33.4484,
      "longitude": -112.074,
      "horizontal_accuracy": 6.5,
      "vertical_accuracy": 3.2,
      "altitude": 331.2,
      "speed": 0,
      "bearing": 0,
      "type": "STATIONARY",
      "battery_level": 78,
      "battery_status": "Not Charging",
      "network_status": true,
      "location_permission": true,
      "is_mock": false,
      "tracking_mode": "PRECISE",
      "tz_offset": "-7",
      "user_id": "user_123"
    },
    {
      "device_id": "71f5493c40ea25832g96f735",
      "app_id": "app_a1b2c3d4e5f6",
      "timestamp": 1709564380000,
      "latitude": 40.7128,
      "longitude": -74.006,
      "horizontal_accuracy": 4.1,
      "vertical_accuracy": 2.8,
      "altitude": 10.8,
      "speed": 12.5,
      "bearing": 87,
      "type": "MOVING",
      "battery_level": 42,
      "battery_status": "Charging",
      "network_status": true,
      "location_permission": true,
      "is_mock": false,
      "tracking_mode": "PRECISE",
      "tz_offset": "-5",
      "user_id": "user_456"
    }
  ],
  "pagination": {
    "count": 2,
    "has_more": false,
    "total_count": 2,
    "offset": 0,
    "limit": 100
  }
}

{
  "success": false,
  "message": "Invalid timezone: Invalid/Zone"
}

{
  "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"
}