> ## 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 Employee ID Settings

PUT https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config
Content-Type: application/json

Changes how SalaryBox numbers new staff automatically, as the Employee ID settings screen in the app does. Send only what you want to change; anything left out stays as it is. Shared rules: see [Writing data](/conventions#writing-data).

- The body is closed: an unknown field is refused with `400` `"Unknown field."` Counts toward your write budget.
- Needs the plan feature for automatic Employee IDs: otherwise `403`.
- At least one field is required: otherwise `400` `"Send at least one field to change."`
- `enabled` switches automatic numbering on or off. `prefix` is up to 50 characters (`""` for none). `next_number` is 1 or more. `padding` is 0-10.
- Staff who already have an ID keep it; only staff added afterwards are numbered.
- The response has the settings after the change, the same as Fetch Employee ID Settings.


Reference: https://docs.salarybox.in/api-reference/company/employee-id-config-update

## Authentication

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

## Request

### Body (application/json)

This endpoint expects an EmployeeIdConfigUpdateRequest.

- `enabled` (boolean, optional) — Switch automatic numbering on or off.
- `prefix` (string, optional) — Letters put before the number, for example `EMP`. `""` for none.
- `next_number` (integer, optional) — The number the next new staff member gets.
- `padding` (integer, optional) — Digits the number is zero-padded to.

## Response

### 200

The settings were saved. `data` has the settings after the change.

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

## Errors

### 400 Bad Request Error

The request was refused, so nothing was changed.

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

### 403 Forbidden Error

The requester is not an Admin, or the plan does not include automatic Employee IDs.

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

## Types

### EmployeeIdConfigResponseData

- `enabled` (boolean, required) — Automatic numbering is switched on in the app.
- `available_on_plan` (boolean, required) — The plan includes auto-generated employee IDs.
- `prefix` (string, required) — Letters put before the number, for example `EMP`. Empty when there is none.
- `next_number` (integer, required) — The number the next new staff member gets.
- `padding` (integer, required) — Digits the number is zero-padded to.
- `next_employee_id` (string, required, nullable) — The employee ID the next new staff member will get, for example `EMP0042`. `null` unless `enabled` and `available_on_plan` are both `true`. When it is not `null`, Add Staff assigns the `employee_id` automatically.

## Examples

### Example

**Response**

```json
{
  "message": "Employee ID settings updated successfully",
  "status": true,
  "data": {
    "enabled": true,
    "available_on_plan": true,
    "prefix": "EMP",
    "next_number": 1,
    "padding": 4,
    "next_employee_id": "EMP0001"
  }
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config"

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

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

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config';
const options = {method: 'PUT', 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/company/employee-id-config"

	req, _ := http.NewRequest("PUT", 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/company/employee-id-config")

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

request = Net::HTTP::Put.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.put("https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config")
  .header("Authorization", "Api-Key  <apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config");
var request = new RestRequest(Method.PUT);
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/company/employee-id-config")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```

### Number new staff EMP0001, EMP0002, ...

**Request**

```json
{
  "enabled": true,
  "prefix": "EMP",
  "next_number": 1,
  "padding": 4
}
```

**Response**

```json
{
  "message": "Employee ID settings updated successfully",
  "status": true,
  "data": {
    "enabled": true,
    "available_on_plan": true,
    "prefix": "EMP",
    "next_number": 1,
    "padding": 4,
    "next_employee_id": "EMP0001"
  }
}
```

**SDK Code**

```python Number new staff EMP0001, EMP0002, ...
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config"

payload = {
    "enabled": True,
    "prefix": "EMP",
    "next_number": 1,
    "padding": 4
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Number new staff EMP0001, EMP0002, ...
const url = 'https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"enabled":true,"prefix":"EMP","next_number":1,"padding":4}'
};

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

```go Number new staff EMP0001, EMP0002, ...
package main

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

func main() {

	url := "https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config"

	payload := strings.NewReader("{\n  \"enabled\": true,\n  \"prefix\": \"EMP\",\n  \"next_number\": 1,\n  \"padding\": 4\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 Number new staff EMP0001, EMP0002, ...
require 'uri'
require 'net/http'

url = URI("https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config")

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  \"enabled\": true,\n  \"prefix\": \"EMP\",\n  \"next_number\": 1,\n  \"padding\": 4\n}"

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

```java Number new staff EMP0001, EMP0002, ...
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"enabled\": true,\n  \"prefix\": \"EMP\",\n  \"next_number\": 1,\n  \"padding\": 4\n}")
  .asString();
```

```php Number new staff EMP0001, EMP0002, ...
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config', [
  'body' => '{
  "enabled": true,
  "prefix": "EMP",
  "next_number": 1,
  "padding": 4
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Number new staff EMP0001, EMP0002, ...
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/company/employee-id-config");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"enabled\": true,\n  \"prefix\": \"EMP\",\n  \"next_number\": 1,\n  \"padding\": 4\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Number new staff EMP0001, EMP0002, ...
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "enabled": true,
  "prefix": "EMP",
  "next_number": 1,
  "padding": 4
] as [String : Any]

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

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