API Docs
Time Off Requests

Time Off Requests

Time off requests in Zoho Shifts can be used to track employees' leave days.

End Points
Get all time off requests
Create a time off request
Get a time off request
Update a time off request
Delete a time off request
Cancel a time off request
Approve a time off request
Deny a time off request
Get all time off types

Get all time off requests

Required OAuth Scope: ZohoShifts.timeoff.READ

Query Parameters

schedules
Comma separated schedule IDs to filter requests by schedules.
status
Any of pending, approved, denied, cancelled to filter requests by status.
employee_id
Filter requests by an employee.
start_date
Start date of range in yyyy-mm-dd format.
end_date
End date of range in yyyy-mm-dd format.
limit
The number of entries to return per page. Default: 20 Max: 100
page
The page number to fetch. Default: 1

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/timeoff/requests -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"

Response Example

{ "time_off_requests": [ { "id": "7238362363823", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "employee_id": "7238362363823", "employee": "John Doe", "requested_by_id": "7238362363823", "requested_by": "John Doe", "type_id": "7238362363823", "type": "Sick", "day_type": "all_day", "duration": 8.75, "status": "pending", "created_at": "2019-08-24T14:15:22Z" } ], "meta": { "count": 0, "limit": 0, "page": 0 } }

Create a time off request

Required OAuth Scope: ZohoShifts.timeoff.CREATE

Arguments

employee_id
string
(Required)
start_date
date-time
(Required)
Start time of the time off request
end_date
date-time
(Required)
End time of the time off request
type_id
string
(Required)
Time off type ID
day_type
string
(Required)
Any of all_day, partial.
reason
string
Reason for requesting time off
auto_approve
boolean
, default is true
By default, the time off request is automatically approved when it is created or updated by a user who has Approve time off requests permission. Send false to disable the automatic approval

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/timeoff/requests -X POST -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f" -d '{"field":"value","field":"value"}'

Body Parameters

Click to copy
{ "employee_id": "7238362363823", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "type_id": "7238362363823", "day_type": "all_day", "reason": "Won't be available today", "auto_approve": false }

Response Example

{ "id": "7238362363823", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "employee_id": "7238362363823", "employee": "John Doe", "requested_by_id": "7238362363823", "requested_by": "John Doe", "type_id": "7238362363823", "type": "Sick", "day_type": "all_day", "duration": 8.75, "status": "pending", "created_at": "2019-08-24T14:15:22Z", "is_paid": true, "reason": "Won't be available today", "approver_id": "7238362363823", "approver": "John Doe", "approval_resp_at": "2019-08-24T14:15:22Z", "cancelled_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "comments": [ { "comment_id": "7238362363823", "comment": "Cannot allow this time off", "commenter_id": "7238362363823", "commenter": "John Doe", "created_at": "2019-08-24T14:15:22Z" } ] }

Get a time off request

Required OAuth Scope: ZohoShifts.timeoff.READ

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/timeoff/requests/{id} -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"

Response Example

{ "id": "7238362363823", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "employee_id": "7238362363823", "employee": "John Doe", "requested_by_id": "7238362363823", "requested_by": "John Doe", "type_id": "7238362363823", "type": "Sick", "day_type": "all_day", "duration": 8.75, "status": "pending", "created_at": "2019-08-24T14:15:22Z", "is_paid": true, "reason": "Won't be available today", "approver_id": "7238362363823", "approver": "John Doe", "approval_resp_at": "2019-08-24T14:15:22Z", "cancelled_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "comments": [ { "comment_id": "7238362363823", "comment": "Cannot allow this time off", "commenter_id": "7238362363823", "commenter": "John Doe", "created_at": "2019-08-24T14:15:22Z" } ] }

Update a time off request

Required OAuth Scope: ZohoShifts.timeoff.UPDATE

Arguments

start_date
date-time
Start time of the time off request
end_date
date-time
End time of the time off request
type_id
string
Time off type ID
day_type
string
Any of all_day, partial.
reason
string
Reason for requesting time off
auto_approve
boolean
, default is true
By default, the time off request is automatically approved when it is created or updated by a user who has Approve time off requests permission. Send false to disable the automatic approval

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/timeoff/requests/{id} -X PUT -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f" -d '{"field":"value","field":"value"}'

Body Parameters

Click to copy
{ "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "type_id": "7238362363823", "day_type": "all_day", "reason": "Won't be available today", "auto_approve": false }

Response Example

{ "id": "7238362363823", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "employee_id": "7238362363823", "employee": "John Doe", "requested_by_id": "7238362363823", "requested_by": "John Doe", "type_id": "7238362363823", "type": "Sick", "day_type": "all_day", "duration": 8.75, "status": "pending", "created_at": "2019-08-24T14:15:22Z", "is_paid": true, "reason": "Won't be available today", "approver_id": "7238362363823", "approver": "John Doe", "approval_resp_at": "2019-08-24T14:15:22Z", "cancelled_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "comments": [ { "comment_id": "7238362363823", "comment": "Cannot allow this time off", "commenter_id": "7238362363823", "commenter": "John Doe", "created_at": "2019-08-24T14:15:22Z" } ] }

Delete a time off request

Required OAuth Scope: ZohoShifts.timeoff.DELETE

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/timeoff/requests/{id} -X DELETE -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"

Response Example

{ "message": "Time off request deleted" }

Cancel a time off request

Required OAuth Scope: ZohoShifts.timeoff.UPDATE

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/timeoff/requests/{id}/cancel -X POST -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"

Response Example

{ "id": "7238362363823", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "employee_id": "7238362363823", "employee": "John Doe", "requested_by_id": "7238362363823", "requested_by": "John Doe", "type_id": "7238362363823", "type": "Sick", "day_type": "all_day", "duration": 8.75, "status": "pending", "created_at": "2019-08-24T14:15:22Z", "is_paid": true, "reason": "Won't be available today", "approver_id": "7238362363823", "approver": "John Doe", "approval_resp_at": "2019-08-24T14:15:22Z", "cancelled_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "comments": [ { "comment_id": "7238362363823", "comment": "Cannot allow this time off", "commenter_id": "7238362363823", "commenter": "John Doe", "created_at": "2019-08-24T14:15:22Z" } ] }

Approve a time off request

Required OAuth Scope: ZohoShifts.timeoff.UPDATE

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/timeoff/requests/{id}/approve -X POST -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"

Response Example

{ "id": "7238362363823", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "employee_id": "7238362363823", "employee": "John Doe", "requested_by_id": "7238362363823", "requested_by": "John Doe", "type_id": "7238362363823", "type": "Sick", "day_type": "all_day", "duration": 8.75, "status": "pending", "created_at": "2019-08-24T14:15:22Z", "is_paid": true, "reason": "Won't be available today", "approver_id": "7238362363823", "approver": "John Doe", "approval_resp_at": "2019-08-24T14:15:22Z", "cancelled_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "comments": [ { "comment_id": "7238362363823", "comment": "Cannot allow this time off", "commenter_id": "7238362363823", "commenter": "John Doe", "created_at": "2019-08-24T14:15:22Z" } ] }

Deny a time off request

Required OAuth Scope: ZohoShifts.timeoff.UPDATE

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/timeoff/requests/{id}/deny -X POST -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"

Response Example

{ "id": "7238362363823", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "employee_id": "7238362363823", "employee": "John Doe", "requested_by_id": "7238362363823", "requested_by": "John Doe", "type_id": "7238362363823", "type": "Sick", "day_type": "all_day", "duration": 8.75, "status": "pending", "created_at": "2019-08-24T14:15:22Z", "is_paid": true, "reason": "Won't be available today", "approver_id": "7238362363823", "approver": "John Doe", "approval_resp_at": "2019-08-24T14:15:22Z", "cancelled_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "comments": [ { "comment_id": "7238362363823", "comment": "Cannot allow this time off", "commenter_id": "7238362363823", "commenter": "John Doe", "created_at": "2019-08-24T14:15:22Z" } ] }

Get all time off types

Required OAuth Scope: ZohoShifts.settings.READ

Request Example

Click to copy
$ curl https://shifts.zoho.com/api/v1/{org_id}/settings/timeofftypes -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"

Response Example

{ "time_off_types": [ { "id": "7238362363823", "name": "Sick" } ] }
© 2024, Zoho Corporation Pvt. Ltd. All Rights Reserved.