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

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

Adds a new staff member to your company. Shared rules: see [Writing Data](/writing-data).

- Only `name` and `phone_number` are required.
- If `branch_names` is left out, the staff member joins the company's main branch (its oldest branch, the one created at signup). If the company has no branch at all, `branch_names` returns `400`.
- `department_names` is optional; empty or left out means no department.
- If Auto employee ID is on, leave `employee_id` out (sending it returns `400`). Otherwise it must be unique in the company, ignoring upper/lower case.
- A phone number already used in the company is rejected. Non-Indian numbers are not allowed on an Indian (INR) plan.
- `notify_staff: true` sends the WhatsApp app invite (live environment only; default `false`).
- `bank_details_confirmed: true` needs the account number and IFSC code.
- When the plan's staff limit is reached the request fails with `400`.
- The old `usage`, `branch_name` and `department_name` keys are rejected.

**Custom role needs:** `staff_details:edit`, plus `bank_account:edit` if any bank field or `bank_details_confirmed` is sent. It can only add staff to its own branches and departments.


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

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a StaffCreateRequest.

- `name` (string, required) — 2–150 characters: letters, spaces or dots; must start with a letter. Extra spaces around it are trimmed.
- `phone_number` (string, required) — Digits only, up to 15; must not already be used in the company. With `dial_code` `91`: 10 digits starting with 6, 7, 8 or 9. Other codes: 4-15 digits valid for that country (not allowed on an Indian (INR) plan).
- `dial_code` (string, optional) — Country dial code without `+`, for example `91` (the default). Must be a known country code.
- `branch_names` (list of string, optional) — Exact branch names from List Branches (not empty, no repeats). If left out, the staff member joins the main branch.
- `department_names` (list of string, optional) — Exact department names from List Departments (no repeats). Leave out or send `[]` for none.
- `employee_id` (string, optional) — Unique in the company, ignoring upper/lower case. Leave out if Auto employee ID is on.
- `job_title` (string, optional) — Up to 150 characters.
- `joining_date` (date, optional) — `YYYY-MM-DD`, between 1950-01-01 and one year from today.
- `date_of_birth` (date, optional) — `YYYY-MM-DD`; the staff member must be 16 to 100 years old.
- `email` (string, optional) — Official email address.
- `personal_email` (string, optional) — Personal email address.
- `current_address` (string, optional)
- `permanent_address` (string, optional) — Up to 500 characters.
- `gender` (enum, optional)
  - Allowed values: `Male`, `Female`, `Others`
- `blood_group` (enum, optional)
  - Allowed values: `A+`, `A-`, `B+`, `B-`, `AB+`, `AB-`, `O+`, `O-`
- `employee_type` (enum, optional)
  - Allowed values: `Full Time`, `Permanent`, `Part Time`, `Consultant`, `Temporary`, `Probation`, `Intern`, `Contract`
- `marital_status` (enum, optional)
  - Allowed values: `Married`, `Unmarried`
- `pan` (string, optional) — Format `ABCDE1234F` (upper-cased for you).
- `aadhaar` (string, optional) — 12 digits, starting with 2-9.
- `uan` (string, optional) — 12 digits, starting with 1-9.
- `pf_number` (string, optional) — Standard PF number, for example `MHBAN00000640000000125` (upper-cased for you).
- `esi_number` (string, optional) — Exactly 10 digits.
- `driving_license` (string, optional) — 2 letters then 13 digits, for example `MH1420110012345` (upper-cased for you).
- `voter_id` (string, optional) — 3 letters then 7 digits, for example `ABC1234567` (upper-cased for you).
- `bank_name` (string, optional) — Custom-role keys need `bank_account:edit` to send any bank field.
- `bank_account_number` (string, optional) — 8 to 18 digits.
- `ifsc_code` (string, optional) — Format `HDFC0001234` (upper-cased for you).
- `account_holder_name` (string, optional)
- `bank_details_confirmed` (boolean, optional) — `true` confirms the bank details as the API key's user; needs the account number and IFSC code.
- `custom_fields` (map from string to string, optional) — Custom field name (exact, from List Custom Fields) mapped to a text value of 1-200 characters, for example `{"Blood Donor": "Yes"}`. Must not be empty.
- `notify_staff` (boolean, optional, default: false) — `true` sends the WhatsApp app invite (live environment only). Default `false`.

## Response

### 201

The staff member was created.

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

## Errors

### 400 Bad Request Error

Validation failed, or the plan's staff limit has been reached.

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

### 403 Forbidden Error

The key owner may not make this change: they no longer have access, or (Custom role) lack the permission or scope.

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

### 500 Internal Server Error

The staff engine failed. Nothing was saved; safe to retry.

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

## Types

### StaffCreateResponseData

- `salarybox_id` (string, required) — SalaryBox ID of the new staff member.
- `is_active` (boolean, required)
- `created_on` (datetime, required)

## Examples

### Example

**Response**

```json
{
  "message": "Staff added successfully",
  "status": true,
  "data": {
    "salarybox_id": "ABCDEFGHIJ",
    "is_active": true,
    "created_on": "2026-10-30T10:15:00.123456Z"
  }
}
```

**SDK Code**

```python Example
import requests

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

headers = {"Authorization": "Api-Key  <apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/staff/';
const options = {method: 'POST', headers: {Authorization: 'Api-Key  <apiKey>'}};

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"
	"net/http"
	"io"
)

func main() {

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

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Api-Key  <apiKey>")

	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/staff/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Api-Key  <apiKey>'

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/staff/")
  .header("Authorization", "Api-Key  <apiKey>")
  .asString();
```

```php Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.salaryboxapp.com/v2/customer/v1/staff/', [
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/staff/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Example
import Foundation

let headers = ["Authorization": "Api-Key  <apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.salaryboxapp.com/v2/customer/v1/staff/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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

### Only the required fields (joins the main branch)

**Request**

```json
{
  "name": "Priya Sharma",
  "phone_number": "9876543210"
}
```

**Response**

```json
{
  "message": "Staff added successfully",
  "status": true,
  "data": {
    "salarybox_id": "ABCDEFGHIJ",
    "is_active": true,
    "created_on": "2026-10-30T10:15:00.123456Z"
  }
}
```

**SDK Code**

```python Only the required fields (joins the main branch)
import requests

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

payload = {
    "name": "Priya Sharma",
    "phone_number": "9876543210"
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Only the required fields (joins the main branch)
const url = 'https://api.salaryboxapp.com/v2/customer/v1/staff/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Priya Sharma","phone_number":"9876543210"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Only the required fields (joins the main branch)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("{\n  \"name\": \"Priya Sharma\",\n  \"phone_number\": \"9876543210\"\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 Only the required fields (joins the main branch)
require 'uri'
require 'net/http'

url = URI("https://api.salaryboxapp.com/v2/customer/v1/staff/")

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  \"name\": \"Priya Sharma\",\n  \"phone_number\": \"9876543210\"\n}"

response = http.request(request)
puts response.read_body
```

```java Only the required fields (joins the main branch)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.salaryboxapp.com/v2/customer/v1/staff/")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Priya Sharma\",\n  \"phone_number\": \"9876543210\"\n}")
  .asString();
```

```php Only the required fields (joins the main branch)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.salaryboxapp.com/v2/customer/v1/staff/', [
  'body' => '{
  "name": "Priya Sharma",
  "phone_number": "9876543210"
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Only the required fields (joins the main branch)
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/staff/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Priya Sharma\",\n  \"phone_number\": \"9876543210\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Only the required fields (joins the main branch)
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Priya Sharma",
  "phone_number": "9876543210"
] as [String : Any]

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

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

### Typical request

**Request**

```json
{
  "name": "Priya Sharma",
  "phone_number": "9876543210",
  "branch_names": [
    "Gurgaon HQ"
  ],
  "department_names": [
    "Tech"
  ],
  "job_title": "Software Engineer",
  "joining_date": "2026-11-01",
  "email": "priya@acme.com",
  "employee_type": "Full Time"
}
```

**Response**

```json
{
  "message": "Staff added successfully",
  "status": true,
  "data": {
    "salarybox_id": "ABCDEFGHIJ",
    "is_active": true,
    "created_on": "2026-10-30T10:15:00.123456Z"
  }
}
```

**SDK Code**

```python Typical request
import requests

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

payload = {
    "name": "Priya Sharma",
    "phone_number": "9876543210",
    "branch_names": ["Gurgaon HQ"],
    "department_names": ["Tech"],
    "job_title": "Software Engineer",
    "joining_date": "2026-11-01",
    "email": "priya@acme.com",
    "employee_type": "Full Time"
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Typical request
const url = 'https://api.salaryboxapp.com/v2/customer/v1/staff/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Priya Sharma","phone_number":"9876543210","branch_names":["Gurgaon HQ"],"department_names":["Tech"],"job_title":"Software Engineer","joining_date":"2026-11-01","email":"priya@acme.com","employee_type":"Full Time"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Typical request
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("{\n  \"name\": \"Priya Sharma\",\n  \"phone_number\": \"9876543210\",\n  \"branch_names\": [\n    \"Gurgaon HQ\"\n  ],\n  \"department_names\": [\n    \"Tech\"\n  ],\n  \"job_title\": \"Software Engineer\",\n  \"joining_date\": \"2026-11-01\",\n  \"email\": \"priya@acme.com\",\n  \"employee_type\": \"Full Time\"\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 Typical request
require 'uri'
require 'net/http'

url = URI("https://api.salaryboxapp.com/v2/customer/v1/staff/")

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  \"name\": \"Priya Sharma\",\n  \"phone_number\": \"9876543210\",\n  \"branch_names\": [\n    \"Gurgaon HQ\"\n  ],\n  \"department_names\": [\n    \"Tech\"\n  ],\n  \"job_title\": \"Software Engineer\",\n  \"joining_date\": \"2026-11-01\",\n  \"email\": \"priya@acme.com\",\n  \"employee_type\": \"Full Time\"\n}"

response = http.request(request)
puts response.read_body
```

```java Typical request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.salaryboxapp.com/v2/customer/v1/staff/")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Priya Sharma\",\n  \"phone_number\": \"9876543210\",\n  \"branch_names\": [\n    \"Gurgaon HQ\"\n  ],\n  \"department_names\": [\n    \"Tech\"\n  ],\n  \"job_title\": \"Software Engineer\",\n  \"joining_date\": \"2026-11-01\",\n  \"email\": \"priya@acme.com\",\n  \"employee_type\": \"Full Time\"\n}")
  .asString();
```

```php Typical request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.salaryboxapp.com/v2/customer/v1/staff/', [
  'body' => '{
  "name": "Priya Sharma",
  "phone_number": "9876543210",
  "branch_names": [
    "Gurgaon HQ"
  ],
  "department_names": [
    "Tech"
  ],
  "job_title": "Software Engineer",
  "joining_date": "2026-11-01",
  "email": "priya@acme.com",
  "employee_type": "Full Time"
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Typical request
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/staff/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Priya Sharma\",\n  \"phone_number\": \"9876543210\",\n  \"branch_names\": [\n    \"Gurgaon HQ\"\n  ],\n  \"department_names\": [\n    \"Tech\"\n  ],\n  \"job_title\": \"Software Engineer\",\n  \"joining_date\": \"2026-11-01\",\n  \"email\": \"priya@acme.com\",\n  \"employee_type\": \"Full Time\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Typical request
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Priya Sharma",
  "phone_number": "9876543210",
  "branch_names": ["Gurgaon HQ"],
  "department_names": ["Tech"],
  "job_title": "Software Engineer",
  "joining_date": "2026-11-01",
  "email": "priya@acme.com",
  "employee_type": "Full Time"
] as [String : Any]

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

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