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

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

Renames a holiday on your company's holiday list or moves it to another date. Shared rules: see [Writing data](/conventions#writing-data).

- The body is closed: an unknown field is refused with `400`. Counts toward your write budget.
- Find the holiday with `date` and `name`, exactly as List Holidays shows them (`name` is matched ignoring case). No match gives `404`.
- Send `new_name`, `new_date` or both: otherwise `400` `"Send new_name, new_date or both."` `new_date` must be in the current year or next year.
- If the change would give two holidays the same name on the same date (name compared ignoring case), you get `400` and nothing is saved.
- Deleting holidays is not available through the API; use the SalaryBox app.
- Needs the Holiday Lists plan feature.


Reference: https://docs.salarybox.in/api-reference/attendance/holiday-update

## Authentication

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

## Request

### Body (application/json)

This endpoint expects an AttendanceHolidayEditRequest.

- `date` (date, required) — The holiday's current date, `YYYY-MM-DD`.
- `name` (string, required) — The holiday's current name, matched ignoring case.
- `new_name` (string, optional) — The new name.
- `new_date` (date, optional) — The new date, `YYYY-MM-DD`, in the current year or next year.

## Response

### 200

The holiday was updated. `data` shows its name and date after the change.

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

## Errors

### 400 Bad Request Error

Validation failed.

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

### 403 Forbidden Error

Only an Admin can change the holiday list, or the plan lacks Holiday Lists.

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

### 404 Not Found Error

No holiday with this name on this date.

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

## Types

### AttendanceHolidayItem

- `name` (string, required)
- `date` (date, required)

## Examples

### Example

**Response**

```json
{
  "message": "Holiday updated successfully",
  "status": true,
  "data": {
    "name": "Diwali (Festival of Lights)",
    "date": "2026-11-08"
  }
}
```

**SDK Code**

```python Example
import requests

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

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/attendance/holiday';
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/attendance/holiday"

	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/attendance/holiday")

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/attendance/holiday")
  .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/attendance/holiday', [
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
  ],
]);

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

```csharp Example
using RestSharp;

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

### Rename a holiday

**Request**

```json
{
  "date": "2026-11-08",
  "name": "Diwali",
  "new_name": "Diwali (Festival of Lights)"
}
```

**Response**

```json
{
  "message": "Holiday updated successfully",
  "status": true,
  "data": {
    "name": "Diwali (Festival of Lights)",
    "date": "2026-11-08"
  }
}
```

**SDK Code**

```python Rename a holiday
import requests

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

payload = {
    "date": "2026-11-08",
    "name": "Diwali",
    "new_name": "Diwali (Festival of Lights)"
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Rename a holiday
const url = 'https://api.salaryboxapp.com/v2/customer/v1/attendance/holiday';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"date":"2026-11-08","name":"Diwali","new_name":"Diwali (Festival of Lights)"}'
};

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

```go Rename a holiday
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"date\": \"2026-11-08\",\n  \"name\": \"Diwali\",\n  \"new_name\": \"Diwali (Festival of Lights)\"\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 Rename a holiday
require 'uri'
require 'net/http'

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

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  \"date\": \"2026-11-08\",\n  \"name\": \"Diwali\",\n  \"new_name\": \"Diwali (Festival of Lights)\"\n}"

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

```java Rename a holiday
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.salaryboxapp.com/v2/customer/v1/attendance/holiday")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"date\": \"2026-11-08\",\n  \"name\": \"Diwali\",\n  \"new_name\": \"Diwali (Festival of Lights)\"\n}")
  .asString();
```

```php Rename a holiday
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.salaryboxapp.com/v2/customer/v1/attendance/holiday', [
  'body' => '{
  "date": "2026-11-08",
  "name": "Diwali",
  "new_name": "Diwali (Festival of Lights)"
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Rename a holiday
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/attendance/holiday");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"date\": \"2026-11-08\",\n  \"name\": \"Diwali\",\n  \"new_name\": \"Diwali (Festival of Lights)\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Rename a holiday
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "date": "2026-11-08",
  "name": "Diwali",
  "new_name": "Diwali (Festival of Lights)"
] as [String : Any]

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

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

### Move a holiday to another date

**Request**

```json
{
  "date": "2026-11-08",
  "name": "Diwali",
  "new_date": "2026-11-09"
}
```

**Response**

```json
{
  "message": "Holiday updated successfully",
  "status": true,
  "data": {
    "name": "Diwali (Festival of Lights)",
    "date": "2026-11-08"
  }
}
```

**SDK Code**

```python Move a holiday to another date
import requests

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

payload = {
    "date": "2026-11-08",
    "name": "Diwali",
    "new_date": "2026-11-09"
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Move a holiday to another date
const url = 'https://api.salaryboxapp.com/v2/customer/v1/attendance/holiday';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"date":"2026-11-08","name":"Diwali","new_date":"2026-11-09"}'
};

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

```go Move a holiday to another date
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"date\": \"2026-11-08\",\n  \"name\": \"Diwali\",\n  \"new_date\": \"2026-11-09\"\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 Move a holiday to another date
require 'uri'
require 'net/http'

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

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  \"date\": \"2026-11-08\",\n  \"name\": \"Diwali\",\n  \"new_date\": \"2026-11-09\"\n}"

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

```java Move a holiday to another date
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.salaryboxapp.com/v2/customer/v1/attendance/holiday")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"date\": \"2026-11-08\",\n  \"name\": \"Diwali\",\n  \"new_date\": \"2026-11-09\"\n}")
  .asString();
```

```php Move a holiday to another date
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.salaryboxapp.com/v2/customer/v1/attendance/holiday', [
  'body' => '{
  "date": "2026-11-08",
  "name": "Diwali",
  "new_date": "2026-11-09"
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Move a holiday to another date
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/attendance/holiday");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"date\": \"2026-11-08\",\n  \"name\": \"Diwali\",\n  \"new_date\": \"2026-11-09\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Move a holiday to another date
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "date": "2026-11-08",
  "name": "Diwali",
  "new_date": "2026-11-09"
] as [String : Any]

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

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