---
title: Add time-off record
slug: api/add-time-off-record
description: API reference for POST endpoint: Add time-off record.
docTags: 
createdAt: 2023-12-01T07:44:41.913Z
---

:::hint{type="success"}
<font color="#3b9f0f">**POST**</font>**&#x20;/api/apply-ee-time-off**
:::

Adds a time-off record to one staff, using the user ID in your system (external ID). The time-off record can be added in your language of choice.



**Request**

***

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

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
**customer\_id** <font color="#a7b4c3">integer Required</font>
:::

:::VerticalSplitItem
The unique Marco identifier for your company.
:::
::::

***

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

:::VerticalSplitItem
The staff's unique identifier in your company's system.

Example: 50
:::
::::

***

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

:::VerticalSplitItem
The leave type.

Example: Sick Leave
:::
::::

***

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

:::VerticalSplitItem
The language settings, formatted as an uppercase [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). The leave type information should be sent in the selected language.

Valid values: EN, ZH
:::
::::

***

::::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).

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
**total\_days** <font color="#a7b4c3">string Required</font>
:::

:::VerticalSplitItem
The total number of days in the leave request.
:::
::::

***

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

:::VerticalSplitItem
The notes for the time-off record. Typically contains the reason for the leave application.
:::
::::

***

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

:::VerticalSplitItem
The decision for the leave request.

Valid values: Approve, Reject
:::
::::

***



**Example Requests**

***

::::CodeDrawer{title="Example" isResponseExpanded="true"}
:::CodeblockTabsExamples
```curl
curl -X POST 'https://api.marcopayroll.com/api:benKoCK8/api/apply-ee-time-off' \
-H 'Content-Type: application/json' \
-H 'Authorization: $AUTH_TOKEN' \
-d '{
  "customer_id":"99",
  "customer_system_id":"5555",
  "leave_type":"Sick Leave",
  "lang":"EN",
  "country":"MY",
  "start_date":"2022-10-08",
  "end_date":"2022-10-09",
  "total_days":"2",
  "notes":"Stomach&nbsp;infection",
  "decision":""
}'
```

```python
import requests

url = "https://api.marcopayroll.com/api:benKoCK8/api/apply-ee-time-off"

payload={
  "customer_id":"99",
  "customer_system_id":"5555",
  "leave_type":"Sick Leave",
  "lang":"EN",
  "country":"MY",
  "start_date":"2022-10-08",
  "end_date":"2022-10-09",
  "total_days":"2",
  "notes":"Stomach&nbsp;infection",
  "decision":""
}

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

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

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

:::CodeblockTabsResponses
```javascript
{
  "time_off_data": {
    "id": 1111,
    "user": 55,
    "customer_id": 99,
    "leave_type": 2,
    "approver": 0,
    "total_days": 2,
    "start_date": "2022-10-08",
    "end_date": "2022-10-09",
    "notes": "Stomach&nbsp;infection",
    "reject_notes": "",
    "decision_time": 1665564058828,
    "decision": "",
    "doc_list": [],
    "created_at": 1665564058831,
    "updated_at": 1665564058831,
    "deleted_at": null,
    "last_modified_by": 123
  },
  "message": "Successfully added"
}
```
:::
::::



**Response (200)**

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
**&#x7B;time\_off\_data}** <font color="#a7b4c3">object</font>
:::

:::VerticalSplitItem
The time-off record details.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**id** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
The unique Marco identifier for the staff's time-off record.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**user** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
The unique Marco identifier for the staff.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**customer\_id** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
The staff's unique identifier in your company's system.

Example: 50
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**leave\_type** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
The unique Marco identifier for the leave type.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**approver** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
The unique Marco identifier for the approver.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**total\_days** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
The total number of days in the leave request.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**start\_date** <font color="#a7b4c3">string</font>
:::

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

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

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**end\_date** <font color="#a7b4c3">string</font>
:::

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

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**notes** <font color="#a7b4c3">string</font>
:::

:::VerticalSplitItem
The notes for the time-off record. Typically contains the reason for the leave application.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**reject\_notes** <font color="#a7b4c3">string</font>
:::

:::VerticalSplitItem
The rejection notes for the time-off record, if rejected.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**decision** <font color="#a7b4c3">string</font>
:::

:::VerticalSplitItem
The decision for the leave request.

Valid values: Approve, Reject
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**doc\_list** <font color="#a7b4c3">array\[string\]</font>
:::

:::VerticalSplitItem
The supporting documents for the leave application.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**created\_at** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
Unix timestamp for the time-off record's creation date.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**updated\_at** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
Unix timestamp for the time-off record's update date.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**deleted\_at** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
Unix timestamp for the time-off record's deletion date.
:::
::::

***

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
&#x7B;time\_off\_data}.**last\_modified\_by** <font color="#a7b4c3">integer</font>
:::

:::VerticalSplitItem
The unique Marco identifier for the user who last modified the leave item details.
:::
::::

***

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

:::VerticalSplitItem
The endpoint response status.
:::
::::

***

