---
title: Calculate total leave days
slug: api/calculate-total-leave-days
description: API reference for POST endpoint: Calculate total leave days.
createdAt: 2023-12-01T06:04:09.112Z
---

:::hint{type="success"}
<font color="#3b9f0f">**POST**</font>**&#x20;/api/calculate-total-days**
:::

Calculates the total number of leave days in a given leave request, based on the start and end date. The calculation takes into account the weekend days and public holidays for a given country.



**Request**

***

<font color="#00a2e9">**Body parameters**</font>

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
**country** <font color="#a7b4c3">string Required</font>
:::

:::VerticalSplitItem
The country where the leave will be taken, formatted as an [ISO Alpha-2 code](https://www.iban.com/country-codes). The information will be used to account for the weekend days and public holidays in the calculation.

Example: JP
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
**start\_date** <font color="#a7b4c3">string Required</font>
:::

:::VerticalSplitItem
The start date of the leave request, formatted as YYYY-MM-DD.

Example: 2023-12-31
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
**end\_date** <font color="#a7b4c3">string Required</font>
:::

:::VerticalSplitItem
The end date of the leave request, formatted as YYYY-MM-DD.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
**is\_half\_start\_date** <font color="#a7b4c3">boolean </font><font color="#a7b4c3">Required</font>
:::

:::VerticalSplitItem
Whether the start date will be taken as a half day leave.

Default: False
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
**is\_half\_end\_date** <font color="#a7b4c3">boolean</font> <font color="#a7b4c3">Required</font>
:::

:::VerticalSplitItem
Whether the end date will be taken as a half day leave.

Default: False
:::
::::

***



**Example Requests**

***

::::CodeDrawer{title="Example" isResponseExpanded="true"}
:::CodeblockTabsExamples
```curl
curl -X POST 'https://api.marcopayroll.com/api:benKoCK8/api/calculate-total-days' \
-H 'Content-Type: application/json' \
-H 'Authorization: $AUTH_TOKEN' \
-d '{
  "country": "CN",
  "start_date": "2023/11/11", 
  "end_date": "2023/11/21",
  "is_half_start_date":"false",
  "is_half_end_date":"false"
}'
```

```python
import requests

url = "https://api.marcopayroll.com/api:benKoCK8/api/calculate-total-days"

payload={
  "country": "CN",
  "start_date": "2023/11/11", 
  "end_date": "2023/11/21",
  "is_half_start_date":"false",
  "is_half_end_date":"false"
}

headers = {
  "accept": "application/json",
  "Authorization": "YOUR_AUTH_TOKEN"
}

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

print(response.text)
```
:::

:::CodeblockTabsResponses
```javascript
{
  "totaldays": 7
}
```
:::
::::



**Response (200)**

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
**totaldays** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
The total number of leave days in a given leave request.
:::
::::

***

