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

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

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

- Saving a structure 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. It is not before the joining month and not in a finalised month.
- `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.
- A second structure on the same `from_date` is refused with `400`, which is harmless. Use `PUT /payroll/ctc` to change it.


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

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

### 201

The salary structure was saved.

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

## Errors

### 400 Bad Request Error

Validation failed, a salary structure already starts on this date, 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

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

### 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": 25000,
  "basic_amount": 12500,
  "allowances": [
    {
      "name": "HRA",
      "amount": 6250
    },
    {
      "name": "Conveyance",
      "amount": 6250
    }
  ],
  "deductions": [
    {
      "name": "Uniform",
      "amount": 200
    }
  ]
}
```

**Response**

```json
{
  "message": "Salary structure saved successfully",
  "status": true,
  "data": {
    "salarybox_id": "SBX1234567",
    "from_date": "2026-11-01",
    "pay_cycle_type": "monthly",
    "ctc_amount": 25000,
    "basic_amount": 12500,
    "allowances": [
      {
        "name": "HRA",
        "amount": 6250
      },
      {
        "name": "Conveyance",
        "amount": 6250
      }
    ],
    "deductions": [
      {
        "name": "Uniform",
        "amount": 200
      }
    ]
  }
}
```

**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": 25000,
    "basic_amount": 12500,
    "allowances": [
        {
            "name": "HRA",
            "amount": 6250
        },
        {
            "name": "Conveyance",
            "amount": 6250
        }
    ],
    "deductions": [
        {
            "name": "Uniform",
            "amount": 200
        }
    ]
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

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

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\": 25000,\n  \"basic_amount\": 12500,\n  \"allowances\": [\n    {\n      \"name\": \"HRA\",\n      \"amount\": 6250\n    },\n    {\n      \"name\": \"Conveyance\",\n      \"amount\": 6250\n    }\n  ],\n  \"deductions\": [\n    {\n      \"name\": \"Uniform\",\n      \"amount\": 200\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/payroll/ctc")

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  \"salarybox_id\": \"SBX1234567\",\n  \"from_date\": \"2026-11-01\",\n  \"pay_cycle_type\": \"monthly\",\n  \"ctc_amount\": 25000,\n  \"basic_amount\": 12500,\n  \"allowances\": [\n    {\n      \"name\": \"HRA\",\n      \"amount\": 6250\n    },\n    {\n      \"name\": \"Conveyance\",\n      \"amount\": 6250\n    }\n  ],\n  \"deductions\": [\n    {\n      \"name\": \"Uniform\",\n      \"amount\": 200\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/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\": 25000,\n  \"basic_amount\": 12500,\n  \"allowances\": [\n    {\n      \"name\": \"HRA\",\n      \"amount\": 6250\n    },\n    {\n      \"name\": \"Conveyance\",\n      \"amount\": 6250\n    }\n  ],\n  \"deductions\": [\n    {\n      \"name\": \"Uniform\",\n      \"amount\": 200\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/payroll/ctc', [
  'body' => '{
  "salarybox_id": "SBX1234567",
  "from_date": "2026-11-01",
  "pay_cycle_type": "monthly",
  "ctc_amount": 25000,
  "basic_amount": 12500,
  "allowances": [
    {
      "name": "HRA",
      "amount": 6250
    },
    {
      "name": "Conveyance",
      "amount": 6250
    }
  ],
  "deductions": [
    {
      "name": "Uniform",
      "amount": 200
    }
  ]
}',
  '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.POST);
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\": 25000,\n  \"basic_amount\": 12500,\n  \"allowances\": [\n    {\n      \"name\": \"HRA\",\n      \"amount\": 6250\n    },\n    {\n      \"name\": \"Conveyance\",\n      \"amount\": 6250\n    }\n  ],\n  \"deductions\": [\n    {\n      \"name\": \"Uniform\",\n      \"amount\": 200\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": 25000,
  "basic_amount": 12500,
  "allowances": [
    [
      "name": "HRA",
      "amount": 6250
    ],
    [
      "name": "Conveyance",
      "amount": 6250
    ]
  ],
  "deductions": [
    [
      "name": "Uniform",
      "amount": 200
    ]
  ]
] 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 = "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()
```