> ## 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 Punch

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

Adds a manual punch for a staff member. Shared rules: see [Writing data](/conventions#writing-data).

- `date` is the attendance date the punch counts towards: usually the timestamp's local date, or the day before for a night shift's punch-out.
- `timestamp` is ISO 8601 with a UTC offset. It cannot be in the future and must fall on `date` or the next day in the staff member's time zone.
- `date` must be within the last 60 days and not in a payroll month that is finalised.
- The time is stored in the staff member's attendance time zone, converted from the offset you send. The mode is always manual; no location or photo is recorded.
- `BREAK_START` and `BREAK_END` need break tracking on the plan.
- After a timeout or failure, check List Punches before sending it again.


Reference: https://docs.salarybox.in/api-reference/attendance/time-entry-create

## Authentication

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

## Request

### Body (application/json)

This endpoint expects an AttendanceTimeEntryCreateRequest.

- `salarybox_id` (string, required) — The staff member.
- `type` (enum, required) — Punch type. Break types need break tracking on the plan.
  - Allowed values: `IN`, `OUT`, `BREAK_START`, `BREAK_END`
- `date` (date, required) — `YYYY-MM-DD` attendance date the punch counts towards (the day before for a night shift's punch-out).
- `timestamp` (string, required) — ISO 8601 with a UTC offset, e.g. `2026-10-30T09:05:00+05:30`. Not in the future.

## Response

### 201

The punch was added.

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

## Errors

### 400 Bad Request Error

Validation failed.

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

### 403 Forbidden Error

The plan lacks break tracking.

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

### AttendanceTimeEntryCreateResponseData

- `salarybox_id` (string, required)
- `date` (date, required)
- `type` (string, required)
- `time` (string, required) — Punch time in the staff member's local time zone.

## Examples

**Request**

```json
{
  "salarybox_id": "ABCDEFGHIJ",
  "type": "IN",
  "date": "2026-10-30",
  "timestamp": "2026-10-30T09:05:00+05:30"
}
```

**Response**

```json
{
  "message": "Punch added successfully",
  "status": true,
  "data": {
    "salarybox_id": "ABCDEFGHIJ",
    "date": "2026-10-30",
    "type": "IN",
    "time": "2026-10-30T09:05:00+05:30"
  }
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/attendance/time-entry"

payload = {
    "salarybox_id": "ABCDEFGHIJ",
    "type": "IN",
    "date": "2026-10-30",
    "timestamp": "2026-10-30T09:05:00+05:30"
}
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/time-entry';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"salarybox_id":"ABCDEFGHIJ","type":"IN","date":"2026-10-30","timestamp":"2026-10-30T09:05:00+05:30"}'
};

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/time-entry"

	payload := strings.NewReader("{\n  \"salarybox_id\": \"ABCDEFGHIJ\",\n  \"type\": \"IN\",\n  \"date\": \"2026-10-30\",\n  \"timestamp\": \"2026-10-30T09:05:00+05:30\"\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/time-entry")

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\": \"ABCDEFGHIJ\",\n  \"type\": \"IN\",\n  \"date\": \"2026-10-30\",\n  \"timestamp\": \"2026-10-30T09:05:00+05:30\"\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/time-entry")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"salarybox_id\": \"ABCDEFGHIJ\",\n  \"type\": \"IN\",\n  \"date\": \"2026-10-30\",\n  \"timestamp\": \"2026-10-30T09:05:00+05:30\"\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/time-entry', [
  'body' => '{
  "salarybox_id": "ABCDEFGHIJ",
  "type": "IN",
  "date": "2026-10-30",
  "timestamp": "2026-10-30T09:05:00+05:30"
}',
  '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/time-entry");
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\": \"ABCDEFGHIJ\",\n  \"type\": \"IN\",\n  \"date\": \"2026-10-30\",\n  \"timestamp\": \"2026-10-30T09:05:00+05:30\"\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": "ABCDEFGHIJ",
  "type": "IN",
  "date": "2026-10-30",
  "timestamp": "2026-10-30T09:05:00+05:30"
] as [String : Any]

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

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