> ## 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 Payroll History

GET https://api.salaryboxapp.com/v2/customer/v1/payroll/history

Returns each staff member's saved payroll results month by month: net salary, amount paid, amount due and whether the month was finalized. Requires Payroll Pro. Includes inactive staff.

This endpoint never computes payroll. A month nobody has computed yet is listed with `is_computed: false` and `null` amounts. Where a month has both a finalized and a later computation, the finalized figures are shown, as in the app.

Every month from `from_month` to `to_month` (at most 12), oldest first.


Reference: https://docs.salarybox.in/api-reference/payroll/history-retrieve

## Authentication

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

## Request

### Query parameters

- `from_month` (string, required) — First month, `YYYY-MM`.
- `to_month` (string, required) — Last month, `YYYY-MM`. At most 11 months after `from_month`, and not in the future.
- `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 50.

## Response

### 200

The payroll history for the requested months.

- `message` (string, required)
- `status` (boolean, required)
- `data` (list of PayrollHistoryEmployee, required)
- `count` (integer, required)
- `prev` (string, required, nullable)
- `next` (string, required, nullable)

## Errors

### 400 Bad Request Error

A parameter is missing or invalid, the range is wrong, or it covers more than 12 months.

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

### 403 Forbidden Error

Your plan does not include payroll.

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

## Types

### PayrollHistoryEmployee

Identity fields shared by per-employee payroll responses.

- `months` (list of PayrollHistoryMonth, required) — One entry for every month in the requested range, oldest first.
- `salarybox_id` (string, optional) — SalaryBox ID of the staff member. Not null.
- `employee_id` (string, optional) — The employee ID your company assigned. Not null, may be empty.
- `name` (string, optional) — Full name of the staff member. Not null.
- `branches` (list of string, optional) — Names of the branches the staff member belongs to. Empty list if none.
- `departments` (list of string, optional) — Names of the departments the staff member belongs to. Empty list if none.

### PayrollHistoryMonth

One month of saved payroll results for a staff member. When `is_computed` is false, every other field except `month` is null.

- `month` (string, required) — The payroll month in `YYYY-MM` format. Not null.
- `is_computed` (boolean, required) — Whether SalaryBox has computed and saved payroll for this month. Not null.
- `is_finalized` (boolean, optional) — True when the month's payroll was frozen and the amounts will not change any more. Always false when the month is not computed.
- `net_salary` (string, optional, nullable) — Salary payable for the month after deductions, as a 2-decimal string. Null when not computed.
- `advance_paid` (string, optional, nullable) — Advances given in the month, as a 2-decimal string. Null when not computed.
- `total_paid` (string, optional, nullable) — Salary payments plus advances recorded for the month, as a 2-decimal string. Null when not computed.
- `remaining_balance` (string, optional, nullable) — Net salary minus total paid, as a 2-decimal string. Positive means the amount is still owed. Null when not computed.
- `computed_till` (date, optional, nullable) — The last day the computation covered. For the current month this is up to that day, not the month end. Null when not computed.
- `computed_on` (datetime, optional, nullable) — When the computation was done, in IST (`+05:30`). Null when not computed.

## Examples

**Response**

```json
{
  "message": "Success",
  "status": true,
  "data": [
    {
      "months": [
        {
          "month": "2026-09",
          "is_computed": true,
          "is_finalized": true,
          "net_salary": "48250.00",
          "advance_paid": "5000.00",
          "total_paid": "48250.00",
          "remaining_balance": "0.00",
          "computed_till": "2026-09-30",
          "computed_on": "2026-10-01T10:42:18+05:30"
        },
        {
          "month": "2026-10",
          "is_computed": true,
          "is_finalized": false,
          "net_salary": "47900.00",
          "advance_paid": "0.00",
          "total_paid": "20000.00",
          "remaining_balance": "27900.00",
          "computed_till": "2026-10-29",
          "computed_on": "2026-10-29T09:15:03+05:30"
        }
      ],
      "salarybox_id": "SBK7Q2M9TX",
      "employee_id": "EMP-0042",
      "name": "Aarav Sharma",
      "branches": [
        "Mumbai HQ"
      ],
      "departments": [
        "Engineering"
      ]
    },
    {
      "months": [
        {
          "month": "2026-09",
          "is_computed": false,
          "is_finalized": false,
          "net_salary": null,
          "advance_paid": null,
          "total_paid": null,
          "remaining_balance": null,
          "computed_till": null,
          "computed_on": null
        },
        {
          "month": "2026-10",
          "is_computed": false,
          "is_finalized": false,
          "net_salary": null,
          "advance_paid": null,
          "total_paid": null,
          "remaining_balance": null,
          "computed_till": null,
          "computed_on": null
        }
      ],
      "salarybox_id": "SBK3H8D1LP",
      "employee_id": "EMP-0057",
      "name": "Priya Nair",
      "branches": [
        "Bengaluru"
      ],
      "departments": [
        "Sales"
      ]
    }
  ],
  "count": 2,
  "prev": null,
  "next": null
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/payroll/history"

querystring = {"from_month":"2026-08","to_month":"2026-10"}

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

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

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/payroll/history?from_month=2026-08&to_month=2026-10';
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/payroll/history?from_month=2026-08&to_month=2026-10"

	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/payroll/history?from_month=2026-08&to_month=2026-10")

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/payroll/history?from_month=2026-08&to_month=2026-10")
  .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/payroll/history?from_month=2026-08&to_month=2026-10', [
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
  ],
]);

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

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/payroll/history?from_month=2026-08&to_month=2026-10");
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/payroll/history?from_month=2026-08&to_month=2026-10")! 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()
```