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

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

Schedules a report to be emailed every day, as in the app. Shared rules: see [Writing data](/conventions#writing-data).

- Needs the Attendance Reports plan feature: otherwise `403` with the upgrade message.
- An Admin can schedule any report. A Custom role needs the attendance report edit permission and can only choose branches and departments they manage. The body is closed: an unknown field is refused with `400`. Counts toward your write budget.
- `report` is `Daily Attendance Report` or `Shift Wise Daily Attendance Report`. `time_slot` is `12 PM IST`, `4 PM IST`, `8 PM IST` or `12 AM IST`. `file_type` is `PDF` (default) or `XLSX`; the Shift Wise report is PDF only.
- `recipient_emails` has at max 5 addresses. They are saved trimmed and in lower case, without duplicates.
- `branch_names` and `department_names` are exact names. Left out or empty, the report covers the branches and departments of the person who set it up, worked out each time it is sent.
- A scheduled report is named by its report and time slot, so the same report can't be scheduled twice at the same time: `400` on `time_slot`. Change that one with Update Scheduled Report instead.
- Each person can set up at most 5 scheduled reports: `400` on `report`.


Reference: https://docs.salarybox.in/api-reference/attendance/report-scheduled-create

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a ScheduledReportAddRequest.

- `report` (enum, required)
  - Allowed values: `Daily Attendance Report`, `Shift Wise Daily Attendance Report`
- `time_slot` (enum, required)
  - Allowed values: `12 PM IST`, `4 PM IST`, `8 PM IST`, `12 AM IST`
- `recipient_emails` (list of string, required)
- `file_type` (enum, optional) — Default `PDF`. The Shift Wise report is PDF only.
  - Allowed values: `PDF`, `XLSX`
- `branch_names` (list of string, optional) — Exact branch names. Left out or empty means the branches of the person who set it up.
- `department_names` (list of string, optional) — Exact department names. Left out or empty means the departments of the person who set it up.

## Response

### 201

The report was scheduled. `data` is the scheduled report, as List Scheduled Reports shows it.

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

## Errors

### 400 Bad Request Error

Validation failed, the report is already scheduled at that time, or the 5-report limit is reached.

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

### 403 Forbidden Error

The plan lacks Attendance Reports, or a Custom role lacks the permission.

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

## Types

### ScheduledReportItem

- `report` (enum, required)
  - Allowed values: `Daily Attendance Report`, `Shift Wise Daily Attendance Report`
- `file_type` (enum, required)
  - Allowed values: `PDF`, `XLSX`
- `branches` (list of string, required, nullable) — Branch names. `null` means all branches.
- `departments` (list of string, required, nullable) — Department names. `null` means all departments.
- `time_slot` (enum, required) — When the report is emailed each day.
  - Allowed values: `12 PM IST`, `4 PM IST`, `8 PM IST`, `12 AM IST`
- `recipient_emails` (list of string, required) — Up to 5 email addresses.
- `is_active` (boolean, required)
- `created_by` (string, required, nullable) — Name of the person who set the report up.
- `created_on` (datetime, required)
- `updated_on` (datetime, required)

## Examples

**Request**

```json
{
  "report": "Daily Attendance Report",
  "time_slot": "8 PM IST",
  "recipient_emails": [
    "hr@example.com"
  ],
  "department_names": [
    "Sales"
  ]
}
```

**Response**

```json
{
  "message": "Scheduled report added successfully",
  "status": true,
  "data": {
    "report": "Daily Attendance Report",
    "file_type": "PDF",
    "branches": null,
    "departments": [
      "Sales"
    ],
    "time_slot": "8 PM IST",
    "recipient_emails": [
      "hr@example.com"
    ],
    "is_active": true,
    "created_by": "Asha Mehta",
    "created_on": "2026-11-12T09:30:00.123456Z",
    "updated_on": "2026-11-12T09:30:00.123456Z"
  }
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/report/scheduled"

payload = {
    "report": "Daily Attendance Report",
    "time_slot": "8 PM IST",
    "recipient_emails": ["hr@example.com"],
    "department_names": ["Sales"]
}
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/report/scheduled';
const options = {
  method: 'POST',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"report":"Daily Attendance Report","time_slot":"8 PM IST","recipient_emails":["hr@example.com"],"department_names":["Sales"]}'
};

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/report/scheduled"

	payload := strings.NewReader("{\n  \"report\": \"Daily Attendance Report\",\n  \"time_slot\": \"8 PM IST\",\n  \"recipient_emails\": [\n    \"hr@example.com\"\n  ],\n  \"department_names\": [\n    \"Sales\"\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/report/scheduled")

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  \"report\": \"Daily Attendance Report\",\n  \"time_slot\": \"8 PM IST\",\n  \"recipient_emails\": [\n    \"hr@example.com\"\n  ],\n  \"department_names\": [\n    \"Sales\"\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/report/scheduled")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"report\": \"Daily Attendance Report\",\n  \"time_slot\": \"8 PM IST\",\n  \"recipient_emails\": [\n    \"hr@example.com\"\n  ],\n  \"department_names\": [\n    \"Sales\"\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/report/scheduled', [
  'body' => '{
  "report": "Daily Attendance Report",
  "time_slot": "8 PM IST",
  "recipient_emails": [
    "hr@example.com"
  ],
  "department_names": [
    "Sales"
  ]
}',
  '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/report/scheduled");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"report\": \"Daily Attendance Report\",\n  \"time_slot\": \"8 PM IST\",\n  \"recipient_emails\": [\n    \"hr@example.com\"\n  ],\n  \"department_names\": [\n    \"Sales\"\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 = [
  "report": "Daily Attendance Report",
  "time_slot": "8 PM IST",
  "recipient_emails": ["hr@example.com"],
  "department_names": ["Sales"]
] as [String : Any]

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

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