# Update Timeoff requests

> Source: https://truto.one/docs/api-reference/unified-hris-api/timeoffrequests/update/

`PATCH /unified/hris/timeoff_requests/{id}`

Resource: **TimeoffRequests** · API: **Unified HRIS API**

## Supported integrations

7shifts, Deel, HR WORKS, Humaans, Remote, Sesame, UKG Dimensions

## Path parameters

- **`id`** _(string, required)_
  The ID of the resource.

## Query parameters

- **`integrated_account_id`** _(string, required)_
  The ID of the integrated account to use for the request.
- **`truto_response_format`** _(string)_
  The format of the response. - `unified` returns the response with unified mappings applied. - `raw` returns the unprocessed, raw response from the remote API. - `normalized` applies the unified mappings and returns the data in a normalized format. - `stream` returns the response as a stream, which is ideal for transmitting large datasets, files, or binary data. Using streaming mode helps to efficiently handle large payloads or real-time data flows without requiring the entire data to be buffered in memory. - `debug` returns the final unified result alongside raw remote fetch information. The response is an envelope containing `result` (identical to unified mode output) and `debug` (with `requestUrl`, `requestOptions`, `data`, `responseHeaders`, and for list operations: `nextCursor`, `isLooping`, `isEmptyResult`, `resultCount`). When the upstream body exceeds 1 MiB, `data` is replaced by `{ truto_truncated: true, truto_max_bytes, truto_excerpt }`. `debug` is `null` for static responses or when `truto_skip_api_call=true`. Defaults to `unified`.
  Allowed: `unified`, `raw`, `normalized`, `stream`, `debug`
- **`truto_ignore_remote_data`** _(boolean)_
  Excludes the `remote_data` attribute from the response.
- **`truto_enforce_write_schema`** _(boolean)_
  Validates the request body against this method's `request_body_schema` before the request is sent to the underlying integration. When a field marked `required` is missing, Truto responds `400` with the missing field names under `truto_error_insight.missing_required_body_fields` instead of forwarding the call. Only the fields documented in `request_body_schema` are checked. A body carrying a non-empty `remote_data` object is forwarded unchecked, because `remote_data` is merged into the provider request and may already carry the required values. A field the mapping always supplies through its default body is treated as present, and a field that is only conditionally required is reported under `truto_error_insight.conditionally_required_body_fields` rather than rejected. Some integrations declare fields `required` on `update` that the provider only requires on `create`; check `meta/{method}` for the resource before enabling this on update calls. If you sent an `Idempotency-Key` and the request was rejected, use a fresh key when you retry with a corrected body: the idempotency cache is keyed on the integrated account, path and key only — it ignores the query string and the body — so reusing the key replays the rejection. Defaults to `false`, which forwards the request as-is.
- **`truto_exclude_fields`** _(array<string>)_
  Array of fields to exclude from the response.
- **`remote_query`** _(object)_
  Query parameters to pass to the underlying API without any transformations. Refer [this guide](https://truto.one/docs/api-reference/overview/querying#remote-query-parameters) to see how to structure the query parameters.

## Request body

- **`start_time`** _(string)_
  New first day (only the date is used). The dates and the per-day hours only change when start_time and end_time are sent together; the per-day hours are then rebuilt (8 hours Monday to Friday, 0 on Saturday and Sunday). Sent without end_time it is ignored.
- **`end_time`** _(string)_
  New last day (only the date is used). Send together with start_time: the per-day hours only change when both dates are sent. Sent without start_time it is ignored.
- **`timeoff_type`** _(string)_
  Change the Remote leave type (timeoff_types.id, e.g. paid_time_off, sick_leave). Requires change_reason.
- **`status`** _(string)_
  Move the request to this status as a manager. The request is read first (one extra call) and only a status that UKG lists in the request's next valid statuses is sent; when UKG offers none of them nothing is written and the call fails with 409 naming the allowed ones. Side effects: UKG's approval workflow runs (reviewers are notified per tenant configuration) and approving or cancelling changes the employee's schedule and timecard pay code edits, which feed payroll. Dates, amounts and types of an existing request are not changed: a request without a status is refused with 400 and nothing is written. DELETE on a request is the same as status cancelled. When UKG's only cancel transition is one a manager still has to approve (CANCELSUBMITTED), the time off stays booked until that approval, and the record returned keeps the status it really has (approved).
  Allowed: `pending`, `approved`, `rejected`, `approved`, `rejected`, `cancelled`, `approved`, `rejected`, `approved`, `rejected`, `cancelled`
- **`employee_note`** _(string)_
  Notes for the request.
- **`amount`** _(number)_
  Hours requested. Required by 7shifts for paid and paid_sick types on single-day requests. Multi-day requests spread it evenly per day, with any rounding remainder on the last day. 7shifts stores the hours per day, so amount is only applied together with start_time and end_time (always the case on create); on update, an amount sent without both dates is not applied.
- **`employee`** _(object)_
  Only accepted when it is the employee the absence already belongs to: HR WORKS has no API to move an absence to another person (its edit body has no personnel number), so a different id is refused with a 400 instead of being ignored.
  - **`id`** _(string, required)_
    The unique identifier for employees
  - **`name`** _(string)_
    This represents the name of the employee.
- **`reason`** _(object)_
  Deel reason: a free-text sub-category of the time off.
  - **`id`** _(string, required)_
    The unique identifier for timeoff_reason
  - **`name`** _(string)_
    This represents the name of the timeoff_reason.
- **`is_paid`** _(boolean)_
  Deel-specific: whether the time off is paid. Defaults to the policy configuration.
- **`session`** _(string)_
  full, morning or afternoon. HR WORKS stores two flags instead: isBeginDateHalfDay ("the absence spans only the afternoon of the first day") and isEndDateHalfDay ("only the forenoon of the last day"). For a one-day absence afternoon sets isBeginDateHalfDay, morning sets isEndDateHalfDay and full sets both to false. For an absence spanning several days only full is accepted: morning and afternoon cannot say which end they mean, so they are refused with a 400 (use the proxy API to set the two flags individually).
  Allowed: `full`, `morning`, `afternoon`, `full`, `morning`, `afternoon`
- **`description`** _(string)_
  This represents the description of the time off request.
- **`timezone`** _(string)_
  Change the IANA timezone of the request. Requires change_reason.
- **`approver`** _(string)_
  The deciding manager's employee id (Sesame managerId).
- **`change_reason`** _(string)_
  Reason sent to Remote: edit_reason for edits, decline_reason for rejected, cancel_reason for cancelled.
- **`resolution_comment`** _(string)_
  Not a unified field. Manager's comment (Sesame resolutionComment); not sent when approving a vacation request, whose accept endpoint takes only managerId.
- **`remote_data`** _(object)_
  Any additional data that should be passed as part of the request body. This data is not transformed by Truto and is passed as is to the remote API.

## Response body

- **`id`** _(string, required)_
  The unique identifier for timeoffpolicies
- **`description`** _(string)_
  This represents the description of the time off request.
- **`reason`** _(object)_
  This represents the reason of the time off request.
  - **`id`** _(string, required)_
    The unique identifier for timeoff_reason
  - **`name`** _(string)_
    This represents the name of the timeoff_reason.
- **`employee`** _(object)_
  This represents the employee requesting time off.
  - **`id`** _(string, required)_
    The unique identifier for employees
  - **`name`** _(string)_
    This represents the name of the employee.
- **`approver`** _(string)_
  This represents the approver of the time off request.
- **`status`** _(string)_
  This represents the status of the time off request.
- **`employee_note`** _(string)_
  This represents the employee note for the time off request.
- **`units`** _(string)_
  This represents the units of the time off request.
  Allowed: `hours`, `days`, `weeks`, `months`
- **`amount`** _(number)_
  This represents the amount of the time off request.
- **`timeoff_type`** _(string)_
  This represents the time off type of the time off request.
- **`request_policy_type`** _(string)_
  This represents the request type of the time off request.
- **`start_time`** _(string)_
  This represents the start time of the time off request.
- **`end_time`** _(string)_
  This represents the end time of the time off request.
- **`session`** _(string)_
  This represents the session of the time off request.
  Allowed: `full`, `morning`, `afternoon`
- **`created_at`** _(string)_
  This represents the date when the timeoffpolicies was created
- **`updated_at`** _(string)_
  This represents the date when the timeoffpolicies was updated
- **`remote_data`** _(object)_
  Raw data returned from the remote API call.

## Code examples

### Truto CLI

```bash
truto unified hris timeoffrequests '<resource_id>' \
  -m update \
  -a '<integrated_account_id>' \
  -b '{
  "start_time": "your_start_time",
  "end_time": "your_end_time",
  "timeoff_type": "your_timeoff_type",
  "status": "pending",
  "employee_note": "your_employee_note",
  "amount": 0,
  "employee": {},
  "reason": {},
  "is_paid": true,
  "session": "full",
  "description": "your_description",
  "timezone": "your_timezone",
  "approver": "your_approver",
  "change_reason": "your_change_reason",
  "resolution_comment": "your_resolution_comment",
  "remote_data": {}
}' \
  -o json
```

### Truto TS SDK

```typescript
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const result = await truto.unifiedApi.update(
  'hris',
  'timeoffrequests',
  '<resource_id>',
  {
  "start_time": "your_start_time",
  "end_time": "your_end_time",
  "timeoff_type": "your_timeoff_type",
  "status": "pending",
  "employee_note": "your_employee_note",
  "amount": 0,
  "employee": {},
  "reason": {},
  "is_paid": true,
  "session": "full",
  "description": "your_description",
  "timezone": "your_timezone",
  "approver": "your_approver",
  "change_reason": "your_change_reason",
  "resolution_comment": "your_resolution_comment",
  "remote_data": {}
},
  { integrated_account_id: '<integrated_account_id>' }
);

console.log(result);
```

### Truto Python SDK

```python
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    result = await truto_api.unified_api.update(
        "hris",
        "timeoffrequests",
        "<resource_id>",
        {
        "start_time": "your_start_time",
        "end_time": "your_end_time",
        "timeoff_type": "your_timeoff_type",
        "status": "pending",
        "employee_note": "your_employee_note",
        "amount": 0,
        "employee": {},
        "reason": {},
        "is_paid": True,
        "session": "full",
        "description": "your_description",
        "timezone": "your_timezone",
        "approver": "your_approver",
        "change_reason": "your_change_reason",
        "resolution_comment": "your_resolution_comment",
        "remote_data": {}
},
        {"integrated_account_id": "<integrated_account_id>"}
    )
    print(result)

asyncio.run(main())
```

### curl

```bash
curl -X PATCH 'https://api.truto.one/unified/hris/timeoff_requests/{id}?integrated_account_id=<integrated_account_id>' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "start_time": "your_start_time",
  "end_time": "your_end_time",
  "timeoff_type": "your_timeoff_type",
  "status": "pending",
  "employee_note": "your_employee_note",
  "amount": 0,
  "employee": {},
  "reason": {},
  "is_paid": true,
  "session": "full",
  "description": "your_description",
  "timezone": "your_timezone",
  "approver": "your_approver",
  "change_reason": "your_change_reason",
  "resolution_comment": "your_resolution_comment",
  "remote_data": {}
}'
```

### JavaScript

```javascript
const integratedAccountId = '<integrated_account_id>';

const body = {
  "start_time": "your_start_time",
  "end_time": "your_end_time",
  "timeoff_type": "your_timeoff_type",
  "status": "pending",
  "employee_note": "your_employee_note",
  "amount": 0,
  "employee": {},
  "reason": {},
  "is_paid": true,
  "session": "full",
  "description": "your_description",
  "timezone": "your_timezone",
  "approver": "your_approver",
  "change_reason": "your_change_reason",
  "resolution_comment": "your_resolution_comment",
  "remote_data": {}
};

const response = await fetch(`https://api.truto.one/unified/hris/timeoff_requests/{id}?integrated_account_id=${integratedAccountId}`, {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/unified/hris/timeoff_requests/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
    "integrated_account_id": "<integrated_account_id>"
}
payload = {
    "start_time": "your_start_time",
    "end_time": "your_end_time",
    "timeoff_type": "your_timeoff_type",
    "status": "pending",
    "employee_note": "your_employee_note",
    "amount": 0,
    "employee": {},
    "reason": {},
    "is_paid": True,
    "session": "full",
    "description": "your_description",
    "timezone": "your_timezone",
    "approver": "your_approver",
    "change_reason": "your_change_reason",
    "resolution_comment": "your_resolution_comment",
    "remote_data": {}
}

response = requests.patch(url, headers=headers, params=params, json=payload)
print(response.json())
```
