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

# Update Payroll Settings

PUT https://api.salaryboxapp.com/v2/customer/v1/payroll/config
Content-Type: application/json

Changes your company's Attendance Cycle, as the app's Salary Settings do. Needs Payroll on your plan. Shared rules: see [Writing data](/conventions#writing-data).

- The body is closed: an unknown field is refused with `400`. Counts toward your write budget.
- `attendance_cycle_starts_on_day` is required, 1-28. `1` makes the cycle the calendar month; 2-28 starts each cycle on that day, so `26` makes 26 October to 25 November the November cycle.
- Payroll worked out after the change uses the new cycle. The response has the settings after the change, the same as Fetch Payroll Settings.
- To change salary calculation days, Include Weekoffs or Include Holidays, use Update Company Settings.


Reference: https://docs.salarybox.in/api-reference/payroll/config-update

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a PayrollConfigUpdateRequest.

- `attendance_cycle_starts_on_day` (integer, required) — `1` is the calendar month; 2-28 starts each cycle on that day.

## Response

### 200

The settings were saved. `data` has the settings after the change.

- `message` (string, required)
- `status` (boolean, required)
- `data` (PayrollConfig, required)

## Errors

### 400 Bad Request Error

Validation failed. Nothing was saved.

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

### 403 Forbidden Error

The requester is not an Admin, or your plan does not include payroll.

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

## Types

### PayrollConfig

- `attendance_cycle_starts_on_day` (integer, required) — Attendance Cycle: the day of the month each payroll month's attendance starts on. `1` is the calendar month. `26` makes 26 October to 25 November count as November.

## Examples

### Example

**Response**

```json
{
  "message": "Payroll settings saved successfully",
  "status": true,
  "data": {
    "attendance_cycle_starts_on_day": 26
  }
}
```

**SDK Code**

```python Example
import requests

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

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

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

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/payroll/config';
const options = {method: 'PUT', 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/config"

	req, _ := http.NewRequest("PUT", 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/config")

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

request = Net::HTTP::Put.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.put("https://api.salaryboxapp.com/v2/customer/v1/payroll/config")
  .header("Authorization", "Api-Key  <apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/payroll/config");
var request = new RestRequest(Method.PUT);
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/config")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```

### Start the attendance cycle on the 26th

**Request**

```json
{
  "attendance_cycle_starts_on_day": 26
}
```

**Response**

```json
{
  "message": "Payroll settings saved successfully",
  "status": true,
  "data": {
    "attendance_cycle_starts_on_day": 26
  }
}
```

**SDK Code**

```python Start the attendance cycle on the 26th
import requests

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

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

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

print(response.json())
```

```javascript Start the attendance cycle on the 26th
const url = 'https://api.salaryboxapp.com/v2/customer/v1/payroll/config';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"attendance_cycle_starts_on_day":26}'
};

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

```go Start the attendance cycle on the 26th
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"attendance_cycle_starts_on_day\": 26\n}")

	req, _ := http.NewRequest("PUT", 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 Start the attendance cycle on the 26th
require 'uri'
require 'net/http'

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

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

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

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

```java Start the attendance cycle on the 26th
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Start the attendance cycle on the 26th
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Start the attendance cycle on the 26th
using RestSharp;

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

```swift Start the attendance cycle on the 26th
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.salaryboxapp.com/v2/customer/v1/payroll/config")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```