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

# Add Staff Overtime

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

Sets the overtime paid to a staff member on each listed date. A date that already has an entry is overwritten. Shared rules: see [Writing data](/conventions#writing-data). Needs Payroll on your plan.

- `salarybox_id` is required.
- `entries` is required, 1-31 items, each date at most once: `400` on `entries`, "2026-11-04 is listed twice."
- Each entry has `date` (`YYYY-MM-DD`), `ot_type` (`HOUR` or `DAY`), `paid_for` (a number from 0.01 to 24 with up to 2 decimals: hours or days of overtime) and `rate` (a number from 0.01 to 10000000 with up to 2 decimals: per hour or per day).
- The amount is worked out as `rate` x `paid_for`, at most 10000000: otherwise `400` on `paid_for`, "Rate times paid_for cannot exceed 10000000."
- A date in the future, or in a finalised payroll month, is rejected with `400` on `entries`.
- No notification is sent.
- `GET /payroll/overtime` works out each day's amount from the staff member's current overtime rate, so send the rate from `GET /payroll/config/overtime`, or the figure shown may differ.


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

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a PayrollOvertimeSetRequest.

- `salarybox_id` (string, required) — SalaryBox ID of an active staff member.
- `entries` (list of PayrollOvertimeSetEntryInput, required) — Overtime to set, each date at most once.

## Response

### 200

The overtime was saved.

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

## Errors

### 400 Bad Request Error

Validation failed, a date is listed twice, in the future or in a finalised payroll month, rate times `paid_for` is too large, 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

### PayrollOvertimeSetEntryInput

- `date` (date, required) — `YYYY-MM-DD`. Not in the future and not in a finalised payroll month.
- `ot_type` (enum, required) — `HOUR`: overtime hours on a normal working day (Extra Hours Pay in the app). `DAY`: working a week off or public holiday (Week Off Pay or Public Holiday Pay).
  - Allowed values: `HOUR`, `DAY`
- `paid_for` (double, required) — Pay For in the app's overtime history, the hours (`HOUR`) or days (`DAY`) of overtime paid. Up to 2 decimals.
- `rate` (double, required) — Per hour or per day. Up to 2 decimals.

### PayrollOvertimeSetResponseData

- `salarybox_id` (string, optional)
- `entries` (list of PayrollOvertimeSetEntry, optional)

### PayrollOvertimeSetEntry

- `date` (date, optional)
- `ot_type` (enum, optional) — `HOUR`: overtime hours on a normal working day (Extra Hours Pay in the app). `DAY`: working a week off or public holiday (Week Off Pay or Public Holiday Pay).
  - Allowed values: `HOUR`, `DAY`
- `paid_for` (double, optional)
- `rate` (double, optional)
- `amount` (double, optional) — `rate` x `paid_for`.

## Examples

**Request**

```json
{
  "salarybox_id": "SBX1234567",
  "entries": [
    {
      "date": "2026-11-03",
      "ot_type": "HOUR",
      "paid_for": 2,
      "rate": 150
    }
  ]
}
```

**Response**

```json
{
  "message": "Overtime saved successfully",
  "status": true,
  "data": {
    "salarybox_id": "SBX1234567",
    "entries": [
      {
        "date": "2026-11-03",
        "ot_type": "HOUR",
        "paid_for": 2,
        "rate": 150,
        "amount": 300
      }
    ]
  }
}
```

**SDK Code**

```python Example
import requests

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

payload = {
    "salarybox_id": "SBX1234567",
    "entries": [
        {
            "date": "2026-11-03",
            "ot_type": "HOUR",
            "paid_for": 2,
            "rate": 150
        }
    ]
}
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/overtime';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"salarybox_id":"SBX1234567","entries":[{"date":"2026-11-03","ot_type":"HOUR","paid_for":2,"rate":150}]}'
};

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

	payload := strings.NewReader("{\n  \"salarybox_id\": \"SBX1234567\",\n  \"entries\": [\n    {\n      \"date\": \"2026-11-03\",\n      \"ot_type\": \"HOUR\",\n      \"paid_for\": 2,\n      \"rate\": 150\n    }\n  ]\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/overtime")

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  \"salarybox_id\": \"SBX1234567\",\n  \"entries\": [\n    {\n      \"date\": \"2026-11-03\",\n      \"ot_type\": \"HOUR\",\n      \"paid_for\": 2,\n      \"rate\": 150\n    }\n  ]\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/overtime")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"salarybox_id\": \"SBX1234567\",\n  \"entries\": [\n    {\n      \"date\": \"2026-11-03\",\n      \"ot_type\": \"HOUR\",\n      \"paid_for\": 2,\n      \"rate\": 150\n    }\n  ]\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/overtime', [
  'body' => '{
  "salarybox_id": "SBX1234567",
  "entries": [
    {
      "date": "2026-11-03",
      "ot_type": "HOUR",
      "paid_for": 2,
      "rate": 150
    }
  ]
}',
  '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/overtime");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"salarybox_id\": \"SBX1234567\",\n  \"entries\": [\n    {\n      \"date\": \"2026-11-03\",\n      \"ot_type\": \"HOUR\",\n      \"paid_for\": 2,\n      \"rate\": 150\n    }\n  ]\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",
  "entries": [
    [
      "date": "2026-11-03",
      "ot_type": "HOUR",
      "paid_for": 2,
      "rate": 150
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.salaryboxapp.com/v2/customer/v1/payroll/overtime")! 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()
```