> ## 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"
> ```

# Create Company Payslips

POST https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init
Content-Type: application/json

Starts building one PDF with the payslips of every staff member whose payment (salary or advance) is saved for the month. Needs Payroll and Payroll and Compliance Reports on your plan. Send the month as `month` (`YYYY-MM`).

The PDF is built in the background. Poll Fetch Company Payslips Status with `report_id` every 10 seconds, then download `file_url`. The finished file also appears in the app under Reports > Downloads; no push notification is sent.

- Inactive staff, and staff whose payment is not saved, are left out. That is not an error.
- If nobody qualifies, `report_id` is `null` and nothing is started.
- If a run for the same month started by the same person is still in progress, no new run starts and you get its `report_id` again.

**Errors**
- `400` `"Invalid Data"` with `errors.month` for a bad month.
- `403` `"Payroll reports are not included in your plan. Contact us."`


Reference: https://docs.salarybox.in/api-reference/payroll/payslip-init-create

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a PayslipInitInput.

- `month` (string, required) — Month, `YYYY-MM`.

## Response

### 200

- `message` (string, required)
- `status` (boolean, required)
- `data` (PayslipInitResponseData, required)
- `rate_limit` (list of string, optional)

## Types

### PayslipInitResponseData

- `report_id` (integer, required, nullable) — Pass to Fetch Company Payslips Status. `null` when no staff qualify.
- `month` (string, required) — `YYYY-MM`.
- `status` (enum, required, nullable)
  - Allowed values: `pending`, `in_progress`
- `staff_count` (integer, required) — Staff whose payslips go into the PDF.
- `poll_after_seconds` (integer, required, nullable) — How often to poll Fetch Company Payslips Status. `null` when nothing was started.

## Examples

### Example

**Request**

```json
{
  "month": "string"
}
```

**Response**

```json
{
  "message": "Payslip generation started",
  "status": true,
  "data": {
    "report_id": 99812,
    "month": "2026-10",
    "status": "pending",
    "staff_count": 42,
    "poll_after_seconds": 10
  },
  "rate_limit": [
    "0/1 requests remaining per 2 seconds",
    "2/3 requests remaining per 10 minutes",
    "9/10 requests remaining per 1 day"
  ]
}
```

**SDK Code**

```python Example
import requests

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

payload = { "month": "string" }
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"month":"string"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("{\n  \"month\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Api-Key  <apiKey>")
	req.Header.Add("Content-Type", "application/json")

	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/payslip/init")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Api-Key  <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"month\": \"string\"\n}"

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.post("https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"month\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init', [
  'body' => '{
  "month": "string"
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"month\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Example
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["month": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

### NoStaffQualify

**Request**

```json
{
  "month": "string"
}
```

**Response**

```json
{
  "message": "No staff have a saved payment for this month, so there are no payslips to generate.",
  "status": true,
  "data": {
    "report_id": null,
    "month": "2026-10",
    "status": null,
    "staff_count": 0,
    "poll_after_seconds": null
  }
}
```

**SDK Code**

```python NoStaffQualify
import requests

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

payload = { "month": "string" }
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript NoStaffQualify
const url = 'https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"month":"string"}'
};

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

```go NoStaffQualify
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"month\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Api-Key  <apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Api-Key  <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"month\": \"string\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"month\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init', [
  'body' => '{
  "month": "string"
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp NoStaffQualify
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"month\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift NoStaffQualify
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["month": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.salaryboxapp.com/v2/customer/v1/payroll/payslip/init")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```