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

# Set Staff Add-on Access

PUT https://api.salaryboxapp.com/v2/customer/v1/staff/{salarybox_id}/addon-access
Content-Type: application/json

Gives or removes one staff member's access to a paid add-on. Shared rules: see [Writing Data](/writing-data).

- Send exactly one of `location_tracking` or `crm` (the same keys as Get Staff Add-on Permissions): `true` gives access, `false` removes it.
- Giving access uses one of the company's purchased add-on seats.
- If the add-on isn't purchased, no seats are left, or there is no active subscription, you get `403` with the app's own message.
- On older plans where the add-on is part of the plan, every staff member already has access and it can't be changed per person (`400`).
- The response shows the staff member's access to both add-ons.

**Custom role needs:** `additional_settings:edit`.


Reference: https://docs.salarybox.in/api-reference/staff/addon-access-set

## Authentication

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

## Request

### Path parameters

- `salarybox_id` (string, required) — SalaryBox ID of the staff member.

### Body (application/json)

This endpoint expects a StaffAddonAccessSetRequest.

- `location_tracking` (boolean, optional) — `true` gives the staff member Location Tracking access, `false` removes it.
- `crm` (boolean, optional) — `true` gives the staff member CRM access, `false` removes it.

## Response

### 200

The access was updated.

- `message` (string, required)
- `status` (boolean, required)
- `data` (StaffAddonAccessSetResponseData, required) — The staff member's resulting access to both add-ons, computed the same way as Get Staff Add-on Permissions.

## Errors

### 400 Bad Request Error

Validation failed, the staff member is inactive, or the add-on is part of the plan so access cannot be changed per staff member.

- `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 (key owner no longer has access, or is a Custom-role user lacking `additional_settings:edit` or outside their My Team scope), or the plan does not allow it: add-on not purchased, all purchased seats in use, or no active subscription when enabling.

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

### StaffAddonAccessSetResponseData

The staff member's resulting access to both add-ons, computed the same way as Get Staff Add-on Permissions.

- `salarybox_id` (string, required)
- `location_tracking` (boolean, required)
- `crm` (boolean, required)

## Examples

### Example

**Response**

```json
{
  "message": "Add-on access updated successfully",
  "status": true,
  "data": {
    "salarybox_id": "ABCDEFGHIJ",
    "location_tracking": true,
    "crm": false
  }
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access"

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/staff/ABCDEFGHIJ/addon-access';
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/staff/ABCDEFGHIJ/addon-access"

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

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/staff/ABCDEFGHIJ/addon-access")
  .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/staff/ABCDEFGHIJ/addon-access', [
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
  ],
]);

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

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access");
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/staff/ABCDEFGHIJ/addon-access")! 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()
```

### Give location tracking access

**Request**

```json
{
  "location_tracking": true
}
```

**Response**

```json
{
  "message": "Add-on access updated successfully",
  "status": true,
  "data": {
    "salarybox_id": "ABCDEFGHIJ",
    "location_tracking": true,
    "crm": false
  }
}
```

**SDK Code**

```python Give location tracking access
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access"

payload = { "location_tracking": True }
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Give location tracking access
const url = 'https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"location_tracking":true}'
};

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

```go Give location tracking access
package main

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

func main() {

	url := "https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access"

	payload := strings.NewReader("{\n  \"location_tracking\": true\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 Give location tracking access
require 'uri'
require 'net/http'

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

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  \"location_tracking\": true\n}"

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

```java Give location tracking access
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"location_tracking\": true\n}")
  .asString();
```

```php Give location tracking access
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access', [
  'body' => '{
  "location_tracking": true
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Give location tracking access
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"location_tracking\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Give location tracking access
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["location_tracking": true] as [String : Any]

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

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

### Remove CRM access

**Request**

```json
{
  "crm": false
}
```

**Response**

```json
{
  "message": "Add-on access updated successfully",
  "status": true,
  "data": {
    "salarybox_id": "ABCDEFGHIJ",
    "location_tracking": true,
    "crm": false
  }
}
```

**SDK Code**

```python Remove CRM access
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access"

payload = { "crm": False }
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Remove CRM access
const url = 'https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"crm":false}'
};

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

```go Remove CRM access
package main

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

func main() {

	url := "https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access"

	payload := strings.NewReader("{\n  \"crm\": false\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 Remove CRM access
require 'uri'
require 'net/http'

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

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  \"crm\": false\n}"

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

```java Remove CRM access
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"crm\": false\n}")
  .asString();
```

```php Remove CRM access
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access', [
  'body' => '{
  "crm": false
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Remove CRM access
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/staff/ABCDEFGHIJ/addon-access");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"crm\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Remove CRM access
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["crm": false] as [String : Any]

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

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