> ## Client identification
>
> Requests to this API should include a `Client-Platform` header alongside
> `Authorization`, identifying the application, tool, or model making the
> request. This is used for integration support and analytics.
>
> Use your model or tool name, for example `claude-code` or `chatgpt`.
>
> Example:
>
> ```bash
> curl https://api.salaryboxapp.com/... \
>   -H "Authorization: Api-Key <api-key>" \
>   -H "Client-Platform: claude-code"
> ```

# List Latest Staff Locations

GET https://api.salaryboxapp.com/v2/customer/v1/location/latest

Returns each tracked staff member's last known position, as on the live map in the app. Requires the Location Tracking add-on.

Uses each person's most recent approved tracking session. Staff never tracked are not listed. `is_tracking_active` says whether the session is still running; if not, `stopped_by` says why.


Reference: https://docs.salarybox.in/api-reference/location/latest-retrieve

## Authentication

- `Authorization` header (required) (prefixed with ` Api-Key   `) — Format: "Api-Key \{api-key}"

## Request

### Query parameters

- `salarybox_ids` (list of string, optional) — Repeatable. Limits the result to these staff members, for example `salarybox_ids=SBK7Q2M9TX&salarybox_ids=SBK3H8D1LP`.
- `page` (integer, optional) — Page number, starting at 1.
- `page_size` (integer, optional) — Results per page. Default and maximum 500.

## Response

### 200

The latest known position of each tracked staff member.

- `data` (list of LocationLatestItem, required)
- `message` (string, optional)
- `status` (boolean, optional)
- `count` (integer, optional) — Total number of results across all pages.
- `prev` (string, optional, nullable) — URL of the previous page, or null.
- `next` (string, optional, nullable) — URL of the next page, or null.

## Errors

### 403 Forbidden Error

The Location Tracking add-on is not enabled.

- `message` (string, required)
- `status` (boolean, required)
- `errors` (map from string to any, optional, nullable)

## Types

### LocationLatestItem

- `salarybox_id` (string, required) — SalaryBox ID of the staff member.
- `name` (string, required) — Full name.
- `latitude` (string, required) — Latitude of the last known position, 6 decimals.
- `longitude` (string, required) — Longitude of the last known position, 6 decimals.
- `address` (string, required, nullable) — Street address of that position. Null if never reported.
- `location_time` (datetime, required) — When that position was recorded.
- `is_tracking_active` (boolean, required) — True while the tracking session is still running.
- `tracking_started_at` (datetime, required, nullable) — When the tracking session started.
- `tracking_ended_at` (datetime, required, nullable) — When the session ended. Null while it is running.
- `stopped_by` (enum, required) — Why tracking ended; null while it is still running. `EXPIRED` the requested duration ran out. `GPS_OFF` GPS was turned off. `PERMISSION_REVOKED` location permission was removed on the phone. `TIME_OUT` the session timed out. `BATTERY_LOW` the phone's battery was low. `CHANGED_TIME` the phone's clock was changed. `TURN_OFF_ADMIN` an admin stopped it. `TURN_OFF_EMPLOYEE` the staff member stopped it.
  - Allowed values: `EXPIRED`, `GPS_OFF`, `PERMISSION_REVOKED`, `TIME_OUT`, `BATTERY_LOW`, `CHANGED_TIME`, `TURN_OFF_ADMIN`, `TURN_OFF_EMPLOYEE`

## Examples

**Response**

```json
{
  "data": [
    {
      "salarybox_id": "SBK7Q2M9TX",
      "name": "Aarav Sharma",
      "latitude": "12.971599",
      "longitude": "77.594566",
      "address": "MG Road, Bengaluru, Karnataka 560001",
      "location_time": "2026-10-29T11:42:10+05:30",
      "is_tracking_active": true,
      "tracking_started_at": "2026-10-29T09:00:00+05:30",
      "tracking_ended_at": null,
      "stopped_by": null
    },
    {
      "salarybox_id": "SBK3H8D1LP",
      "name": "Priya Nair",
      "latitude": "19.076090",
      "longitude": "72.877426",
      "address": null,
      "location_time": "2026-10-28T17:55:42+05:30",
      "is_tracking_active": false,
      "tracking_started_at": "2026-10-28T10:00:00+05:30",
      "tracking_ended_at": "2026-10-28T18:00:00+05:30",
      "stopped_by": "EXPIRED"
    }
  ],
  "message": "Success",
  "status": true,
  "count": 2,
  "prev": null,
  "next": null
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/location/latest"

headers = {"Authorization": "Api-Key  <apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/location/latest';
const options = {method: 'GET', headers: {Authorization: 'Api-Key  <apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.salaryboxapp.com/v2/customer/v1/location/latest"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Api-Key  <apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example
require 'uri'
require 'net/http'

url = URI("https://api.salaryboxapp.com/v2/customer/v1/location/latest")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Api-Key  <apiKey>'

response = http.request(request)
puts response.read_body
```

```java Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.salaryboxapp.com/v2/customer/v1/location/latest")
  .header("Authorization", "Api-Key  <apiKey>")
  .asString();
```

```php Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.salaryboxapp.com/v2/customer/v1/location/latest', [
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/location/latest");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Example
import Foundation

let headers = ["Authorization": "Api-Key  <apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.salaryboxapp.com/v2/customer/v1/location/latest")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```