> ## 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 Staff Overtime Settings

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

Sets the **overtime pay settings** for one staff member. The first call creates the setting and later calls update it. Shared rules: see [Writing data](/conventions#writing-data). Needs Payroll on your plan.

* `salarybox_id` is required. All other fields are optional, but at least one must be sent: otherwise `400` with `{"non_field_errors": ["Send at least one setting to change."]}`. Only the settings sent change.
* `per_hour_amount_type`, `week_off_per_day_amount_type` and `public_holiday_per_day_amount_type` are `fixed` (the amount is money) or `multiplier` (the amount multiplies the staff member's rate).
* `per_hour_amount`, `week_off_per_day_amount` and `public_holiday_per_day_amount` are JSON numbers from 0 to 10000000 with up to 2 decimals.
* `hourly_grace_period_minutes` is **Overtime considered after** in the app, a whole number of minutes from 0 to 1439. `GET /payroll/config/overtime` returns it as `hourly_grace_period` in `HH:MM:SS`.
* Changing the setting makes SalaryBox recalculate that staff member's saved payroll, as in the app.

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

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a PayrollConfigOvertimeSetRequest.

- `salarybox_id` (string, required) — SalaryBox ID of an active staff member.
- `per_hour_amount_type` (enum, optional) — `fixed` means the amount is money; `multiplier` means it multiplies the staff member's rate.
  - Allowed values: `fixed`, `multiplier`
- `per_hour_amount` (double, optional) — Up to 2 decimals.
- `hourly_grace_period_minutes` (integer, optional) — Overtime considered after in the app, in whole minutes.
- `week_off_per_day_amount_type` (enum, optional)
  - Allowed values: `fixed`, `multiplier`
- `week_off_per_day_amount` (double, optional) — Up to 2 decimals.
- `public_holiday_per_day_amount_type` (enum, optional)
  - Allowed values: `fixed`, `multiplier`
- `public_holiday_per_day_amount` (double, optional) — Up to 2 decimals.

## Response

### 200

The settings were saved.

- `message` (string, optional)
- `status` (boolean, optional)
- `data` (PayrollConfigOvertimeSetResponseData, optional)

## Errors

### 400 Bad Request Error

Validation failed (unknown field, wrong type, value out of range, no setting sent) or the staff member is inactive.

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

### 404 Not Found Error

No eligible active staff member with this `salarybox_id` exists in your company.

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

## Types

### PayrollConfigOvertimeSetResponseData

- `salarybox_id` (string, optional)
- `config` (OvertimeConfig, optional) — A staff member's overtime pay settings. See the endpoint description for how payroll applies them.

### OvertimeConfig

A staff member's overtime pay settings. See the endpoint description for how payroll applies them.

- `per_hour_amount_type` (enum, required) — How `per_hour_amount` is read. `fixed` is money per overtime hour; `multiplier` is a multiple of the per-hour salary.
  - Allowed values: `fixed`, `multiplier`
- `per_hour_amount` (string, required) — Pay per payable overtime hour on normal days, as money or a multiplier, as a 2-decimal string.
- `hourly_grace_period` (string, required) — The app's Overtime considered after, as a duration, `HH:MM:SS`. A day's overtime hours are paid only if they are more than this; then all of them are paid. `"00:00:00"` means any overtime is paid.
- `week_off_per_day_amount_type` (enum, required) — How `week_off_per_day_amount` is read. `fixed` is money per day; `multiplier` is a multiple of the per-day salary.
  - Allowed values: `fixed`, `multiplier`
- `week_off_per_day_amount` (string, required) — Pay per overtime day for working on a week off, as money or a multiplier, as a 2-decimal string. For example `"1.50"` with `multiplier` pays one and a half days' salary.
- `public_holiday_per_day_amount_type` (enum, required) — How `public_holiday_per_day_amount` is read. `fixed` is money per day; `multiplier` is a multiple of the per-day salary.
  - Allowed values: `fixed`, `multiplier`
- `public_holiday_per_day_amount` (string, required) — Pay per overtime day for working on a public holiday, as money or a multiplier, as a 2-decimal string.

## Examples

**Request**

```json
{
  "salarybox_id": "SBX1234567",
  "per_hour_amount_type": "fixed",
  "per_hour_amount": 150,
  "hourly_grace_period_minutes": 30,
  "week_off_per_day_amount_type": "multiplier",
  "week_off_per_day_amount": 2
}
```

**Response**

```json
{
  "message": "Overtime settings saved successfully",
  "status": true,
  "data": {
    "salarybox_id": "SBX1234567",
    "config": {
      "per_hour_amount_type": "fixed",
      "per_hour_amount": "150.00",
      "hourly_grace_period": "00:30:00",
      "week_off_per_day_amount_type": "multiplier",
      "week_off_per_day_amount": "2.00",
      "public_holiday_per_day_amount_type": "fixed",
      "public_holiday_per_day_amount": "0.00"
    }
  }
}
```

**SDK Code**

```python Example
import requests

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

payload = {
    "salarybox_id": "SBX1234567",
    "per_hour_amount_type": "fixed",
    "per_hour_amount": 150,
    "hourly_grace_period_minutes": 30,
    "week_off_per_day_amount_type": "multiplier",
    "week_off_per_day_amount": 2
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/payroll/config/overtime';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"salarybox_id":"SBX1234567","per_hour_amount_type":"fixed","per_hour_amount":150,"hourly_grace_period_minutes":30,"week_off_per_day_amount_type":"multiplier","week_off_per_day_amount":2}'
};

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/config/overtime"

	payload := strings.NewReader("{\n  \"salarybox_id\": \"SBX1234567\",\n  \"per_hour_amount_type\": \"fixed\",\n  \"per_hour_amount\": 150,\n  \"hourly_grace_period_minutes\": 30,\n  \"week_off_per_day_amount_type\": \"multiplier\",\n  \"week_off_per_day_amount\": 2\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 Example
require 'uri'
require 'net/http'

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

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  \"salarybox_id\": \"SBX1234567\",\n  \"per_hour_amount_type\": \"fixed\",\n  \"per_hour_amount\": 150,\n  \"hourly_grace_period_minutes\": 30,\n  \"week_off_per_day_amount_type\": \"multiplier\",\n  \"week_off_per_day_amount\": 2\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.put("https://api.salaryboxapp.com/v2/customer/v1/payroll/config/overtime")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"salarybox_id\": \"SBX1234567\",\n  \"per_hour_amount_type\": \"fixed\",\n  \"per_hour_amount\": 150,\n  \"hourly_grace_period_minutes\": 30,\n  \"week_off_per_day_amount_type\": \"multiplier\",\n  \"week_off_per_day_amount\": 2\n}")
  .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/overtime', [
  'body' => '{
  "salarybox_id": "SBX1234567",
  "per_hour_amount_type": "fixed",
  "per_hour_amount": 150,
  "hourly_grace_period_minutes": 30,
  "week_off_per_day_amount_type": "multiplier",
  "week_off_per_day_amount": 2
}',
  '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/config/overtime");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"salarybox_id\": \"SBX1234567\",\n  \"per_hour_amount_type\": \"fixed\",\n  \"per_hour_amount\": 150,\n  \"hourly_grace_period_minutes\": 30,\n  \"week_off_per_day_amount_type\": \"multiplier\",\n  \"week_off_per_day_amount\": 2\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Example
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "salarybox_id": "SBX1234567",
  "per_hour_amount_type": "fixed",
  "per_hour_amount": 150,
  "hourly_grace_period_minutes": 30,
  "week_off_per_day_amount_type": "multiplier",
  "week_off_per_day_amount": 2
] 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/overtime")! 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()
```