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

# List Leave Approval Flows

GET https://api.salaryboxapp.com/v2/customer/v1/leave/approval-flows

Returns your company's multi-level leave approval flows and the people who can be chosen as approvers. Not paginated.

- `flows` lists every flow, oldest first. Companies without multi-level approval get `flows: []`. `assigned_staff_count` counts active staff on the flow.
- A request passes level 1, then level 2 and so on. At each level, any one eligible approver (a named person in `approvers`, or anyone with one of the `approver_roles`) can approve or reject.
- Approvers other than admins can only act on staff who share their branch, and one of their departments if they have any. An admin can only be on a flow's last level.
- `eligible_approvers` has one group per role, in this order: Admins, Branch Admins, Advanced Attendance Managers, custom roles. Active people only, sorted by name.


Reference: https://docs.salarybox.in/api-reference/leave/approval-flows-retrieve

## Authentication

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

## Response

### 200

Flows and eligible approvers.

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

## Errors

### 403 Forbidden Error

The company's plan does not include multi-level leave approval. Companies on older (legacy) plans are not affected.

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

## Types

### LeaveApprovalFlowsData

- `flows` (list of LeaveApprovalFlow, required) — Non-deleted flows, oldest first, in the order they were created. Empty when the company does not use multi-level approval.
- `eligible_approvers` (list of LeaveEligibleApproverGroup, required) — One group per role, in the order Admins, Branch Admins, Advanced Attendance Manager, Custom Role.

### LeaveApprovalFlow

- `name` (string, required) — Flow name.
- `assigned_staff_count` (integer, required) — Number of active staff currently assigned to this flow.
- `levels` (list of LeaveApprovalLevel, required) — Levels in order, level 1 first.
- `created_on` (datetime, required) — When the flow was created.
- `updated_on` (datetime, required) — When the flow was last changed.

### LeaveEligibleApproverGroup

- `role` (enum, required) — Role the group represents.
  - Allowed values: `ROLE_ADMIN`, `ROLE_BRANCH_ADMIN`, `ROLE_ADVANCED_ATTENDANCE_MANAGER`, `ROLE_CUSTOM`
- `label` (string, required) — Group heading. Admins, Branch Admins, Advanced Attendance Manager or Custom Role.
- `staff` (list of LeaveApprovalPerson, required) — Active people who can be picked as named approvers for this role, sorted by name. May be empty.

### LeaveApprovalLevel

One step of a flow. Any one eligible approver at the level can approve or reject.

- `level` (integer, required) — Position in the flow. 1 is the first level.
- `approver_roles` (list of LeaveApprovalRole, required) — Roles whose holders can approve at this level. May be empty.
- `approvers` (list of LeaveApprovalPerson, required) — Named people who can approve at this level. People who have since been deactivated still appear, because the saved flow still names them. May be empty.
- `no_action_mode` (enum, required) — What happens if nobody acts. `AUTO_APPROVE` approves the level automatically once `no_action_days` have passed, via a daily job that runs around 01:00 IST.
  - Allowed values: `NONE`, `AUTO_APPROVE`
- `no_action_days` (integer, required, nullable) — Days to wait before auto-approving. Null when `no_action_mode` is `NONE`.
- `skip_if_no_user` (boolean, required) — If true and no eligible approver exists for this level for that request, the level is skipped instead of waiting.

### LeaveApprovalPerson

A named person.

- `salarybox_id` (string, required) — SalaryBox ID of the person.
- `name` (string, required) — Full name.

### LeaveApprovalRole

A role whose holders may approve at a level ("anyone holding this role").

- `role` (enum, required) — Role code. `ROLE_ADMIN` is all company admins, company-wide. `ROLE_ATTENDANCE_MANAGER` appears only in older flows and is no longer offered for new flows. `ROLE_CUSTOM` is any custom role with the approve-leave permission.
  - Allowed values: `ROLE_ADMIN`, `ROLE_BRANCH_ADMIN`, `ROLE_ATTENDANCE_MANAGER`, `ROLE_ADVANCED_ATTENDANCE_MANAGER`, `ROLE_CUSTOM`
- `label` (string, required) — Display name of the role. One of Admin, Branch Admin, Attendance Manager, Advanced Attendance Manager, or "Custom role with leave approval permission".

## Examples

**Response**

```json
{
  "message": "Success",
  "status": true,
  "data": {
    "flows": [
      {
        "name": "Field Staff Leave Approval",
        "assigned_staff_count": 38,
        "levels": [
          {
            "level": 1,
            "approver_roles": [
              {
                "role": "ROLE_BRANCH_ADMIN",
                "label": "Branch Admin"
              }
            ],
            "approvers": [
              {
                "salarybox_id": "SBHYBSEEIG",
                "name": "Rohit Sharma"
              }
            ],
            "no_action_mode": "AUTO_APPROVE",
            "no_action_days": 2,
            "skip_if_no_user": true
          },
          {
            "level": 2,
            "approver_roles": [
              {
                "role": "ROLE_ADMIN",
                "label": "Admin"
              }
            ],
            "approvers": [],
            "no_action_mode": "NONE",
            "no_action_days": null,
            "skip_if_no_user": false
          }
        ],
        "created_on": "2026-03-04T10:15:00+05:30",
        "updated_on": "2026-09-18T16:42:00+05:30"
      }
    ],
    "eligible_approvers": [
      {
        "role": "ROLE_ADMIN",
        "label": "Admins",
        "staff": [
          {
            "salarybox_id": "SBXDFJHVMA",
            "name": "Anita Verma"
          }
        ]
      },
      {
        "role": "ROLE_BRANCH_ADMIN",
        "label": "Branch Admins",
        "staff": [
          {
            "salarybox_id": "SBHYBSEEIG",
            "name": "Rohit Sharma"
          }
        ]
      },
      {
        "role": "ROLE_ADVANCED_ATTENDANCE_MANAGER",
        "label": "Advanced Attendance Manager",
        "staff": []
      },
      {
        "role": "ROLE_CUSTOM",
        "label": "Custom Role",
        "staff": [
          {
            "salarybox_id": "SBKLMNPQRS",
            "name": "Priya Nair"
          }
        ]
      }
    ]
  }
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/leave/approval-flows"

headers = {"Authorization": "Api-Key  <apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/leave/approval-flows';
const options = {method: 'GET', 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/leave/approval-flows"

	req, _ := http.NewRequest("GET", 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/leave/approval-flows")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.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.get("https://api.salaryboxapp.com/v2/customer/v1/leave/approval-flows")
  .header("Authorization", "Api-Key  <apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.salaryboxapp.com/v2/customer/v1/leave/approval-flows', [
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
  ],
]);

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

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/leave/approval-flows");
var request = new RestRequest(Method.GET);
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/leave/approval-flows")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
```