Skip to navigation

Create Time Off Request

Creates a time off request — vacations, leave or a permission — for a user of the organization against one of its time off policies. The request follows the rules of the policy: when the policy needs approvals it is created as IN_PROGRESS and its approvers are notified; otherwise it is created as APPROVED and the time is discounted from the user’s balance. The dates cannot overlap another active request of the user.

Authentication

Api-Keystring

API key of the organization. Always sent together with the Secret-Access header.

Path parameters

organization_slugstringRequired

Headers

Secret-AccessstringRequired

Request

This endpoint expects an object.
policy_idintegerRequired

Id of the time off policy the request consumes: id in GET /org/{organization_slug}/timeoff/policies/. The person must have a balance in that policy unless the policy is unlimited.

start_datedateRequired

First day of the request, YYYY-MM-DD.

end_datedateRequired

Last day of the request, YYYY-MM-DD. Same as start_date for a single day; never before it.

valuedoubleRequired

Amount of time requested, in the unit of the policy (quantification: days or hours). For a full-day request on a policy counted in days the amount is recalculated from the dates, skipping holidays and non-working days. For a request by hours or a half day it is taken as sent.

user_idintegerOptional

Centralized id of the person the request is for: user.user_id in the time off requests listing, or user.id in GET /org/{organization_slug}/users/user-organizations/. Not the learning user id. Send either user_id or email, not both.

emailstringOptional>=1 character

Email of the person the request is for, as an alternative to user_id. It must match exactly (case-insensitive) the email of a user of the organization.

commentstringOptionalDefaults to
Free text that explains the request to its approvers.
allow_request_by_hourbooleanOptional

Send true to request hours of a single day on a policy counted in days; value is then a number of hours and start_time / end_time are required.

start_timestringOptionalformat: "time"

Start time of a partial-day request, 24-hour HH:MM without time zone. Sent together with end_time, on a single day. Ignored on a full-day request.

end_timestringOptionalformat: "time"

End time of a partial-day request, 24-hour HH:MM without time zone; after start_time.

Response

Time off request created
successboolean
True when the request was created.
messagestring
Human readable result of the creation.
codestring

Result code of the operation, namespaced by section — not an HTTP status. The reason of a failed creation travels in the error payload instead.

datetimestring
Datetime of the API in ISO Format
dataobject
Identification and status of the created request.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
422
Unprocessable Entity Error