> ## 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 Late Arriving Fines

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

Changes the late arriving fines of a payroll month that is already saved. Payroll then uses the new total. Shared rules: see [Writing data](/conventions#writing-data). Needs Payroll on your plan.

- The body and rules for `entries` are the same as `POST /payroll/late-fine`.
- Every day you leave out is saved exactly as it stands now, with the same amount.
- How saved totals behave when attendance changes: see Fetch Single Staff Late Arriving Fines.
- A month with nothing saved gives `404` under `month`: "No late arriving fines are saved for this month; save them with POST."
- Repeating the same request sets the same values.


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

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a PayrollLateFineSaveRequest.

- `salarybox_id` (string, required) — SalaryBox ID of the staff member.
- `month` (string, required) — Payroll month, `YYYY-MM`. Must have ended and not be finalised.
- `entries` (list of PayrollLateFineSaveRequestEntriesItems, required) — The days to change, each date at most once.

## Response

### 200

The month's late arriving fines were updated. `data` is the month after the save.

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

## Errors

### 400 Bad Request Error

Validation failed, the month has not ended or is finalised, a date has no fine counted, a daily fine has a `deduct_for` other than 0 or 1, or setup is missing (fine settings, salary structure or payroll settings).

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

### 403 Forbidden Error

Your plan does not include payroll, or you cannot act on this staff member.

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

### 404 Not Found Error

No eligible staff member with this `salarybox_id` exists in your company, or the month has nothing saved.

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

## Types

### PayrollLateFineSaveRequestEntriesItems

- `date` (date, required) — `YYYY-MM-DD`. Must be a day listed in `days` by the Get endpoint.
- `deduct_for` (double, required) — On an `hourly` fine, hours fined (up to 2 decimals). On a `daily` fine, `1` (fined) or `0` (not fined). Must be a JSON number.

### PayrollLateFineMonth

- `salarybox_id` (string, optional)
- `month` (string, optional)
- `attendance_from_date` (date, optional)
- `attendance_to_date` (date, optional)
- `fine_type` (enum, optional)
  - Allowed values: `hourly`, `daily`
- `is_saved` (boolean, optional) — Whether an admin has saved this month. `false` means these are the computed values.
- `total_fine` (string, optional)
- `days` (list of PayrollLateFineDay, optional) — Sorted by date. May be empty.

### PayrollLateFineDay

- `date` (date, optional)
- `late_by_hours` (string, optional) — Hours the staff member was late that day. 2 decimals.
- `waive_off_applied` (boolean, optional) — The day is inside the staff member's waive-off days (computed amount 0).
- `deduct_for` (string, optional) — Hours fined (`hourly`) or `1.00` / `0.00` (`daily`). 2 decimals.
- `rate` (string, optional)
- `amount` (string, optional)

## Examples

**Request**

```json
{
  "salarybox_id": "SBX1234567",
  "month": "2026-10",
  "entries": [
    {
      "date": "2026-10-03",
      "deduct_for": 1.5
    }
  ]
}
```

**Response**

```json
{
  "message": "Late arriving fines saved successfully",
  "status": true,
  "data": {
    "salarybox_id": "SBX1234567",
    "month": "2026-10",
    "attendance_from_date": "2026-10-01",
    "attendance_to_date": "2026-10-31",
    "fine_type": "hourly",
    "is_saved": true,
    "total_fine": "150.00",
    "days": [
      {
        "date": "2026-10-03",
        "late_by_hours": "1.75",
        "waive_off_applied": false,
        "deduct_for": "1.50",
        "rate": "100.00",
        "amount": "150.00"
      }
    ]
  }
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/payroll/late-fine"

payload = {
    "salarybox_id": "SBX1234567",
    "month": "2026-10",
    "entries": [
        {
            "date": "2026-10-03",
            "deduct_for": 1.5
        }
    ]
}
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/late-fine';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"salarybox_id":"SBX1234567","month":"2026-10","entries":[{"date":"2026-10-03","deduct_for":1.5}]}'
};

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/late-fine"

	payload := strings.NewReader("{\n  \"salarybox_id\": \"SBX1234567\",\n  \"month\": \"2026-10\",\n  \"entries\": [\n    {\n      \"date\": \"2026-10-03\",\n      \"deduct_for\": 1.5\n    }\n  ]\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/late-fine")

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  \"month\": \"2026-10\",\n  \"entries\": [\n    {\n      \"date\": \"2026-10-03\",\n      \"deduct_for\": 1.5\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.put("https://api.salaryboxapp.com/v2/customer/v1/payroll/late-fine")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"salarybox_id\": \"SBX1234567\",\n  \"month\": \"2026-10\",\n  \"entries\": [\n    {\n      \"date\": \"2026-10-03\",\n      \"deduct_for\": 1.5\n    }\n  ]\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/late-fine', [
  'body' => '{
  "salarybox_id": "SBX1234567",
  "month": "2026-10",
  "entries": [
    {
      "date": "2026-10-03",
      "deduct_for": 1.5
    }
  ]
}',
  '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/late-fine");
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  \"month\": \"2026-10\",\n  \"entries\": [\n    {\n      \"date\": \"2026-10-03\",\n      \"deduct_for\": 1.5\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",
  "month": "2026-10",
  "entries": [
    [
      "date": "2026-10-03",
      "deduct_for": 1.5
    ]
  ]
] as [String : Any]

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

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