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

# Mark Staff Attendance

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

Sets attendance for up to 50 entries in one request. Each entry is one staff member on one date, and a request can mix staff and dates. Shared rules: see [Writing data](/conventions#writing-data).

* All or nothing: if any entry is refused, nothing is saved. `errors.entries` lists the entries in request order, with `{}` for each one that was fine.
* `date` must be within the last 60 days in the staff member's time zone, not in the future, and not in a finalised payroll month.
* Each staff member and date pair can appear only once per request. A repeat returns `400`.
* An entry without `leave_type` clears any leave already recorded for that day, as the app does. `is_half_day_leave` needs `leave_type`.
* Saving recalculates the staff member's payroll for the affected cycle, as the app does.

Reference: https://docs.salarybox.in/api-reference/attendance/status-set

## Authentication

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

## Request

### Body (application/json)

This endpoint expects an AttendanceStatusSetRequest.

- `entries` (list of AttendanceStatusSetRequestEntriesItems, required) — The attendance to set, 1 to 50 entries. Each entry is one staff member on one date.

## Response

### 200

The attendance was saved.

- `message` (string, required)
- `status` (boolean, required)
- `data` (list of AttendanceStatusSetResponseDataItems, required)

## Errors

### 400 Bad Request Error

One or more entries were refused, so nothing was saved. `errors.entries` has one item per entry, in request order.

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

### 403 Forbidden Error

Your company has no active subscription.

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

### 409 Conflict Error

A payroll month was finalised between validation and saving (same per-entry error shape; nothing saved).

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

## Types

### AttendanceStatusSetRequestEntriesItems

- `salarybox_id` (string, required) — The staff member.
- `date` (date, required) — `YYYY-MM-DD`. Within the last 60 days, not in the future, not in a finalised payroll month.
- `status` (enum, required) — Attendance status.
  - Allowed values: `present`, `absent`, `half_day`, `double_present`
- `leave_type` (string, optional) — Exact leave type name as set up in SalaryBox. Leave out to clear any leave on that day.
- `is_half_day_leave` (boolean, optional) — Only together with `leave_type`.

### AttendanceStatusSetResponseDataItems

- `salarybox_id` (string, required)
- `date` (date, required)
- `status` (string, required)
- `leave_type` (string, required, nullable)
- `is_half_day_leave` (boolean, required)

## Examples

**Request**

```json
{
  "entries": [
    {
      "salarybox_id": "ABCDEFGHIJ",
      "date": "2026-10-29",
      "status": "present"
    },
    {
      "salarybox_id": "KLMNOPQRST",
      "date": "2026-10-29",
      "status": "absent",
      "leave_type": "Sick Leave"
    }
  ]
}
```

**Response**

```json
{
  "message": "Attendance saved successfully",
  "status": true,
  "data": [
    {
      "salarybox_id": "ABCDEFGHIJ",
      "date": "2026-10-29",
      "status": "present",
      "leave_type": null,
      "is_half_day_leave": false
    },
    {
      "salarybox_id": "KLMNOPQRST",
      "date": "2026-10-29",
      "status": "absent",
      "leave_type": "Sick Leave",
      "is_half_day_leave": false
    }
  ]
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/attendance/status"

payload = { "entries": [
        {
            "salarybox_id": "ABCDEFGHIJ",
            "date": "2026-10-29",
            "status": "present"
        },
        {
            "salarybox_id": "KLMNOPQRST",
            "date": "2026-10-29",
            "status": "absent",
            "leave_type": "Sick Leave"
        }
    ] }
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/attendance/status';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"entries":[{"salarybox_id":"ABCDEFGHIJ","date":"2026-10-29","status":"present"},{"salarybox_id":"KLMNOPQRST","date":"2026-10-29","status":"absent","leave_type":"Sick Leave"}]}'
};

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/attendance/status"

	payload := strings.NewReader("{\n  \"entries\": [\n    {\n      \"salarybox_id\": \"ABCDEFGHIJ\",\n      \"date\": \"2026-10-29\",\n      \"status\": \"present\"\n    },\n    {\n      \"salarybox_id\": \"KLMNOPQRST\",\n      \"date\": \"2026-10-29\",\n      \"status\": \"absent\",\n      \"leave_type\": \"Sick Leave\"\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/attendance/status")

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  \"entries\": [\n    {\n      \"salarybox_id\": \"ABCDEFGHIJ\",\n      \"date\": \"2026-10-29\",\n      \"status\": \"present\"\n    },\n    {\n      \"salarybox_id\": \"KLMNOPQRST\",\n      \"date\": \"2026-10-29\",\n      \"status\": \"absent\",\n      \"leave_type\": \"Sick Leave\"\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/attendance/status")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entries\": [\n    {\n      \"salarybox_id\": \"ABCDEFGHIJ\",\n      \"date\": \"2026-10-29\",\n      \"status\": \"present\"\n    },\n    {\n      \"salarybox_id\": \"KLMNOPQRST\",\n      \"date\": \"2026-10-29\",\n      \"status\": \"absent\",\n      \"leave_type\": \"Sick Leave\"\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/attendance/status', [
  'body' => '{
  "entries": [
    {
      "salarybox_id": "ABCDEFGHIJ",
      "date": "2026-10-29",
      "status": "present"
    },
    {
      "salarybox_id": "KLMNOPQRST",
      "date": "2026-10-29",
      "status": "absent",
      "leave_type": "Sick Leave"
    }
  ]
}',
  '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/attendance/status");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entries\": [\n    {\n      \"salarybox_id\": \"ABCDEFGHIJ\",\n      \"date\": \"2026-10-29\",\n      \"status\": \"present\"\n    },\n    {\n      \"salarybox_id\": \"KLMNOPQRST\",\n      \"date\": \"2026-10-29\",\n      \"status\": \"absent\",\n      \"leave_type\": \"Sick Leave\"\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 = ["entries": [
    [
      "salarybox_id": "ABCDEFGHIJ",
      "date": "2026-10-29",
      "status": "present"
    ],
    [
      "salarybox_id": "KLMNOPQRST",
      "date": "2026-10-29",
      "status": "absent",
      "leave_type": "Sick Leave"
    ]
  ]] as [String : Any]

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

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