> ## 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 Staff Salary Structure

PUT https://api.salaryboxapp.com/v2/customer/v1/payroll/ctc
Content-Type: application/json

Changes the salary structure that already starts on `from_date`. This changes what the staff member is paid. Shared rules: see [Writing data](/conventions#writing-data). Needs Payroll on your plan.

- Same body as `POST /payroll/ctc`. Saving recalculates that staff member's unfinalised payroll from `from_date`. Read existing structures with `GET /payroll/staff-ctc`.
- `from_date` is `YYYY-MM-DD` and the first day of a month. If no structure starts on that date the result is `404` "Salary structure not found."
- `ctc_amount` must equal `basic_amount` plus the allowances plus the employer contributions that are part of CTC, within 1. Otherwise `400` on `non_field_errors` with the app's message, for example "ctc_amount provided is not correct, should be 25000.0".
- `allowances` and `deductions`: left out means the same as the current structure; sent means the list replaces all of them. Removing an allowance also removes it from what PF and ESI are worked out on.
- PF, ESI, PT and LWF cannot be set through this endpoint. They carry over from the staff member's current structure (the one in force on `from_date`, else their earliest). A staff member with no structure gets none of them; they are set up in the SalaryBox app.
- A structure set by hand no longer follows a template.
- Repeating the request is safe.


Reference: https://docs.salarybox.in/api-reference/payroll/ctc-update

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a PayrollCtcRequest.

- `salarybox_id` (string, required) — SalaryBox ID of an active staff member.
- `from_date` (date, required) — `YYYY-MM-DD`, the first day of a month (otherwise `400`, "Must be the first day of a month."). Not before the joining month and not in a finalised month.
- `pay_cycle_type` (enum, required)
  - Allowed values: `monthly`, `daily`, `weekly`, `hourly`
- `ctc_amount` (double, required) — JSON number with up to 2 decimals. Must equal basic plus allowances plus the employer contributions that are part of CTC, within 1.
- `basic_amount` (double, required) — JSON number with up to 2 decimals, at most `ctc_amount`.
- `allowances` (list of PayrollSalaryItem, optional) — Optional. Left out means the same as the current structure; sent means the list replaces all of them. Names do not repeat.
- `deductions` (list of PayrollSalaryItem, optional) — Optional. Left out means the same as the current structure; sent means the list replaces all of them. Names do not repeat.

## Response

### 200

The salary structure was updated.

- `message` (string, optional)
- `status` (boolean, optional)
- `data` (PayrollCtcData, optional)

## Errors

### 400 Bad Request Error

Validation failed, the date is in a finalised month or before joining, the staff member is inactive, or `ctc_amount` does not add up. Other errors come from the app's checks, nested by field (for example rule category errors under `pt_config` or `lwf_config`).

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

### 403 Forbidden Error

Your plan does not include payroll.

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

### 404 Not Found Error

The staff member was not found, or no salary structure starts on `from_date`.

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

## Types

### PayrollSalaryItem

- `name` (string, required) — Trimmed. Names do not repeat within the list.
- `amount` (double, required) — JSON number with up to 2 decimals.

### PayrollCtcData

- `salarybox_id` (string, optional)
- `from_date` (string, optional)
- `pay_cycle_type` (enum, optional)
  - Allowed values: `monthly`, `daily`, `weekly`, `hourly`
- `ctc_amount` (double, optional)
- `basic_amount` (double, optional)
- `allowances` (list of PayrollSalaryItem, optional)
- `deductions` (list of PayrollSalaryItem, optional)

## Examples

**Request**

```json
{
  "salarybox_id": "SBX1234567",
  "from_date": "2026-11-01",
  "pay_cycle_type": "monthly",
  "ctc_amount": 28000,
  "basic_amount": 14000,
  "allowances": [
    {
      "name": "HRA",
      "amount": 7000
    },
    {
      "name": "Conveyance",
      "amount": 7000
    }
  ]
}
```

**Response**

```json
{
  "message": "Salary structure updated successfully",
  "status": true,
  "data": {
    "salarybox_id": "SBX1234567",
    "from_date": "2026-11-01",
    "pay_cycle_type": "monthly",
    "ctc_amount": 28000,
    "basic_amount": 14000,
    "allowances": [
      {
        "name": "HRA",
        "amount": 7000
      },
      {
        "name": "Conveyance",
        "amount": 7000
      }
    ],
    "deductions": []
  }
}
```

**SDK Code**

```python Example
import requests

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

payload = {
    "salarybox_id": "SBX1234567",
    "from_date": "2026-11-01",
    "pay_cycle_type": "monthly",
    "ctc_amount": 28000,
    "basic_amount": 14000,
    "allowances": [
        {
            "name": "HRA",
            "amount": 7000
        },
        {
            "name": "Conveyance",
            "amount": 7000
        }
    ]
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/payroll/ctc';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"salarybox_id":"SBX1234567","from_date":"2026-11-01","pay_cycle_type":"monthly","ctc_amount":28000,"basic_amount":14000,"allowances":[{"name":"HRA","amount":7000},{"name":"Conveyance","amount":7000}]}'
};

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/payroll/ctc"

	payload := strings.NewReader("{\n  \"salarybox_id\": \"SBX1234567\",\n  \"from_date\": \"2026-11-01\",\n  \"pay_cycle_type\": \"monthly\",\n  \"ctc_amount\": 28000,\n  \"basic_amount\": 14000,\n  \"allowances\": [\n    {\n      \"name\": \"HRA\",\n      \"amount\": 7000\n    },\n    {\n      \"name\": \"Conveyance\",\n      \"amount\": 7000\n    }\n  ]\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 Example
require 'uri'
require 'net/http'

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

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  \"salarybox_id\": \"SBX1234567\",\n  \"from_date\": \"2026-11-01\",\n  \"pay_cycle_type\": \"monthly\",\n  \"ctc_amount\": 28000,\n  \"basic_amount\": 14000,\n  \"allowances\": [\n    {\n      \"name\": \"HRA\",\n      \"amount\": 7000\n    },\n    {\n      \"name\": \"Conveyance\",\n      \"amount\": 7000\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.put("https://api.salaryboxapp.com/v2/customer/v1/payroll/ctc")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"salarybox_id\": \"SBX1234567\",\n  \"from_date\": \"2026-11-01\",\n  \"pay_cycle_type\": \"monthly\",\n  \"ctc_amount\": 28000,\n  \"basic_amount\": 14000,\n  \"allowances\": [\n    {\n      \"name\": \"HRA\",\n      \"amount\": 7000\n    },\n    {\n      \"name\": \"Conveyance\",\n      \"amount\": 7000\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.salaryboxapp.com/v2/customer/v1/payroll/ctc', [
  'body' => '{
  "salarybox_id": "SBX1234567",
  "from_date": "2026-11-01",
  "pay_cycle_type": "monthly",
  "ctc_amount": 28000,
  "basic_amount": 14000,
  "allowances": [
    {
      "name": "HRA",
      "amount": 7000
    },
    {
      "name": "Conveyance",
      "amount": 7000
    }
  ]
}',
  '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/payroll/ctc");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"salarybox_id\": \"SBX1234567\",\n  \"from_date\": \"2026-11-01\",\n  \"pay_cycle_type\": \"monthly\",\n  \"ctc_amount\": 28000,\n  \"basic_amount\": 14000,\n  \"allowances\": [\n    {\n      \"name\": \"HRA\",\n      \"amount\": 7000\n    },\n    {\n      \"name\": \"Conveyance\",\n      \"amount\": 7000\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 = [
  "salarybox_id": "SBX1234567",
  "from_date": "2026-11-01",
  "pay_cycle_type": "monthly",
  "ctc_amount": 28000,
  "basic_amount": 14000,
  "allowances": [
    [
      "name": "HRA",
      "amount": 7000
    ],
    [
      "name": "Conveyance",
      "amount": 7000
    ]
  ]
] as [String : Any]

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

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