> ## 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 to Biometric Device

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

Adds 1 to 50 staff to a biometric device, as Add Staff to Device does in the app. Shared rules: see [Writing data](/conventions#writing-data).

For each staff member this gives them a biometric user id if they have none, pushes them to the device and turns on biometric attendance for them.

- Staff are sent to the device one by one, so a 50-staff request can take a while.
- Once the request is valid it always returns `200`; `result` says what happened to each staff member. If any entry is invalid, nothing is added and you get `400`.
- `added`: done. Staff already on the device can be sent again; they come back as `added` (pushed again).
- `failed`: the device did not accept them, for example because it is offline. Retry later; retrying is safe.
- `manual_add_needed`: this device model can't take staff from SalaryBox. Add the person on the device by hand using `biometric_employee_id`.
- `not_attempted`: this staff member wasn't reached in this request. Nothing was changed for them. Send them again in a new request.
- Tip: for big lists, or when devices are slow, send smaller batches.
- Removing staff from a device is not available through the API; use the SalaryBox app.
- Older plans without an active subscription get `403` "No active plan. Purchase a plan to add staff to the biometric device."


Reference: https://docs.salarybox.in/api-reference/attendance/biometric-staff-create

## Authentication

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

## Request

### Query parameters

- `serial_number` (string, required) — The device's `serial_number` from List Biometric Devices.

### Body (application/json)

This endpoint expects an AttendanceBiometricStaffCreateRequest.

- `staff` (list of AttendanceBiometricStaffCreateRequestStaffItems, required) — Staff to add (1 to 50, no duplicates).

## Response

### 200

The request was processed. Check `result` for each staff member.

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

## Errors

### 400 Bad Request Error

The request was refused, so nothing was added. For entry problems `errors.staff` has one item per entry, in request order, with `{}` for those that were fine.

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

### 403 Forbidden Error

The company has no active plan.

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

### 404 Not Found Error

No biometric device with this serial number in your company (an unknown serial, or another company's device).

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

## Types

### AttendanceBiometricStaffCreateRequestStaffItems

- `salarybox_id` (string, required) — The staff member.

### AttendanceBiometricStaffCreateResponseData

- `serial_number` (string, required)
- `entries` (list of AttendanceBiometricStaffCreateResponseDataEntriesItems, required)

### AttendanceBiometricStaffCreateResponseDataEntriesItems

- `salarybox_id` (string, required)
- `name` (string, required)
- `biometric_employee_id` (string, required) — The user id the staff member has on the device.
- `result` (enum, required) — `added`: done. `failed`: the device did not accept them; retry later, it is safe. `manual_add_needed`: this device model can't take staff from SalaryBox; add the person on the device by hand. `not_attempted`: they weren't reached in this request; nothing was changed, send them again in a new request.
  - Allowed values: `added`, `failed`, `manual_add_needed`, `not_attempted`

## Examples

**Request**

```json
{
  "staff": [
    {
      "salarybox_id": "SB1234"
    },
    {
      "salarybox_id": "SB1235"
    }
  ]
}
```

**Response**

```json
{
  "message": "Staff processed for the biometric device",
  "status": true,
  "data": {
    "serial_number": "CQZ7224460123",
    "entries": [
      {
        "salarybox_id": "SB1234",
        "name": "Ravi Kumar",
        "biometric_employee_id": "100245",
        "result": "added"
      },
      {
        "salarybox_id": "SB1235",
        "name": "Asha Rao",
        "biometric_employee_id": "100246",
        "result": "failed"
      }
    ]
  }
}
```

**SDK Code**

```python Example
import requests

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

querystring = {"serial_number":"serial_number"}

payload = { "staff": [{ "salarybox_id": "SB1234" }, { "salarybox_id": "SB1235" }] }
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/attendance/biometric/staff?serial_number=serial_number';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"staff":[{"salarybox_id":"SB1234"},{"salarybox_id":"SB1235"}]}'
};

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/biometric/staff?serial_number=serial_number"

	payload := strings.NewReader("{\n  \"staff\": [\n    {\n      \"salarybox_id\": \"SB1234\"\n    },\n    {\n      \"salarybox_id\": \"SB1235\"\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/biometric/staff?serial_number=serial_number")

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  \"staff\": [\n    {\n      \"salarybox_id\": \"SB1234\"\n    },\n    {\n      \"salarybox_id\": \"SB1235\"\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/biometric/staff?serial_number=serial_number")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"staff\": [\n    {\n      \"salarybox_id\": \"SB1234\"\n    },\n    {\n      \"salarybox_id\": \"SB1235\"\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/biometric/staff?serial_number=serial_number', [
  'body' => '{
  "staff": [
    {
      "salarybox_id": "SB1234"
    },
    {
      "salarybox_id": "SB1235"
    }
  ]
}',
  '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/biometric/staff?serial_number=serial_number");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"staff\": [\n    {\n      \"salarybox_id\": \"SB1234\"\n    },\n    {\n      \"salarybox_id\": \"SB1235\"\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 = ["staff": [["salarybox_id": "SB1234"], ["salarybox_id": "SB1235"]]] as [String : Any]

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

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