> ## 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 CRM Trips

GET https://api.salaryboxapp.com/v2/customer/v1/crm/trips

Returns each staff member's total distance and number of trips logged in Field Force CRM, for up to 31 days. Individual trips are not returned; use List CRM Trip Timeline. Requires the Field Force CRM add-on.

One row per staff member, active or inactive, ordered by `salarybox_id`; staff with nothing in the range are still listed. A trip counts on the day it was started, even if it stopped later. `total_distance_km` is a 2-decimal string.


Reference: https://docs.salarybox.in/api-reference/crm/trips-retrieve

## Authentication

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

## Request

### Query parameters

- `start_date` (date, required) — First day, `YYYY-MM-DD`.
- `end_date` (date, required) — Last day, `YYYY-MM-DD`. The range can cover at most 31 days.
- `salarybox_ids` (list of string, optional) — Repeatable, at most 10. Limits the result to these staff members.
- `page` (integer, optional) — Page number, starting at 1.
- `page_size` (integer, optional, default: 25) — Results per page. Default and maximum 25.

## Response

### 200

One summary row per staff member.

- `data` (list of CrmEmployeeTrips, required) — One row per staff member on this page.
- `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.
- `rate_limit` (list of string, optional) — What is left in each rate-limit window, for example `29/30 requests remaining per 5 minutes`.

## Errors

### 400 Bad Request Error

A date is missing or malformed, `end_date` is before `start_date`, the range is longer than 31 days, or more than 10 `salarybox_ids` were given.

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

### 403 Forbidden Error

The Field Force CRM add-on is not enabled.

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

### 429 Too Many Requests Error

A rate limit was exceeded (1 request per 2 seconds, 30 per 5 minutes, 100 per hour, or the shared 5000 per day). The response says how many seconds to wait.

- `any`

## Types

### CrmEmployeeTrips

One staff member with the total distance and number of trips started in the date range (List CRM Trips). There is no `trips` list; see `CrmEmployeeTripTimeline`.

- `salarybox_id` (string, required) — SalaryBox ID of the staff member.
- `employee_name` (string, required) — Full name of the staff member.
- `total_distance_km` (string, required) — Sum of the distance of the trips started in the range, in kilometres, with 2 decimals. `"0.00"` if none.
- `number_of_trips` (integer, required) — Number of trips started in the range. 0 if none.

## Examples

**Response**

```json
{
  "data": [
    {
      "salarybox_id": "SBK7Q2M9TX",
      "employee_name": "Aarav Sharma",
      "total_distance_km": "142.60",
      "number_of_trips": 9
    },
    {
      "salarybox_id": "SBK3H8D1LP",
      "employee_name": "Priya Nair",
      "total_distance_km": "0.00",
      "number_of_trips": 0
    }
  ],
  "message": "Success",
  "status": true,
  "count": 2,
  "prev": null,
  "next": null,
  "rate_limit": [
    "0/1 requests remaining per 2 seconds",
    "29/30 requests remaining per 5 minutes",
    "99/100 requests remaining per 1 hour"
  ]
}
```

**SDK Code**

```python Distance and number of trips per staff member
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/crm/trips"

querystring = {"end_date":"2026-10-31","start_date":"2026-10-01"}

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

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

print(response.json())
```

```javascript Distance and number of trips per staff member
const url = 'https://api.salaryboxapp.com/v2/customer/v1/crm/trips?end_date=2026-10-31&start_date=2026-10-01';
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 Distance and number of trips per staff member
package main

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

func main() {

	url := "https://api.salaryboxapp.com/v2/customer/v1/crm/trips?end_date=2026-10-31&start_date=2026-10-01"

	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 Distance and number of trips per staff member
require 'uri'
require 'net/http'

url = URI("https://api.salaryboxapp.com/v2/customer/v1/crm/trips?end_date=2026-10-31&start_date=2026-10-01")

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 Distance and number of trips per staff member
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.salaryboxapp.com/v2/customer/v1/crm/trips?end_date=2026-10-31&start_date=2026-10-01")
  .header("Authorization", "Api-Key  <apiKey>")
  .asString();
```

```php Distance and number of trips per staff member
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.salaryboxapp.com/v2/customer/v1/crm/trips?end_date=2026-10-31&start_date=2026-10-01', [
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
  ],
]);

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

```csharp Distance and number of trips per staff member
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/crm/trips?end_date=2026-10-31&start_date=2026-10-01");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Distance and number of trips per staff member
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.salaryboxapp.com/v2/customer/v1/crm/trips?end_date=2026-10-31&start_date=2026-10-01")! 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()
```