Create an Automation with the REST API
The create-automation endpoint lets you add a leave-management rule of a specific type. The type is part of the URL, and the request body must match that type exactly. The endpoint creates the automation in an active state and returns either the finished object or an operation you can poll. This guide explains the request shape, the headers that affect ownership and retries, and the response paths you need to handle.
Endpoint and authorization
Send a POST request to /v2/automations/{type}. The {type} path segment must be one of the supported automation types; any other value returns 404 AUTOMATION_TYPE_NOT_FOUND. The request requires the automations:write scope and a bearer token. The acting user is either the API key owner or the user named in the X-On-Behalf-Of header. That acting user becomes the automation's owner (ownerId). The acting user must be an approver or an admin. Two types, seniority-entitlement and entitlement-by-role, can be created only by admins.
Request body rules
The body must contain name plus the fields defined for the selected type. The API reference lists one request schema per type, such as CreateBlackoutPeriodAutomationRequest for blackout-period. Fields that belong to another type, as well as id, type, isActive, ownerId, and other unknown fields, fail validation. The automation is created active (isActive: true). To pause it later, use PATCH /v2/automations/{type}/{id} with isActive: false. The fields name, reason, and autoRejectResponse fail validation when they look like HTML or script.
Scoping fields and type-specific behavior
locationIds, departmentIds, and labelIds limit which users the automation applies to. Omitting them or sending an empty array means everyone. The entitlement-by-role type does not accept these scoping fields; it applies to users who have the label in labelId. For maximum-users-away, maxUsersAway is an object with a type of percentage or absolute and a numeric value. A percentage above the maximum the dashboard allows fails validation. For leave-duration-limit, send minimumDuration, maximumDuration, or both. One of them may be null only when the other is a number.
Response handling: 201, 202, and errors
A successful synchronous create returns 201 with the automation object. If the create takes longer than the wait window, the endpoint returns 202 Accepted with an operation object containing an id, a status, and a url. Poll that URL until the status is SUCCEEDED or FAILED. The 202 response may also carry the same add-on error on the operation. The error envelope includes code, name, description, resolution, requestId, and optional details. The 400 VALIDATION_ERROR response lists failing fields in details.fields. Other common errors include 400 INVALID_REQUEST_BODY, 403 ON_BEHALF_OF_NOT_ALLOWED, 403 FORBIDDEN, 403 AUTOMATION_ADMIN_REQUIRED, 403 AUTOMATION_ADDON_NOT_ACTIVE, 404 AUTOMATION_TYPE_NOT_FOUND, 409 DUPLICATE_NAME, and the idempotency-key codes.
Idempotency and acting on behalf of another user
Add an Idempotency-Key header when you want a create request to be retryable without risking a duplicate. A valid key is 1 to 255 printable ASCII characters, and each API key keeps its keys for 24 hours. Within that window, sending the same key with an identical request returns the stored original response and marks it with an Idempotent-Replayed header. If the request differs, the API answers 422 IDEMPOTENCY_KEY_REUSED. If the earlier request is still executing, a retry gets 409 IDEMPOTENCY_REQUEST_IN_PROGRESS. A key outside the allowed format gets 400 INVALID_IDEMPOTENCY_KEY. To attribute the write to someone other than the key owner, set X-On-Behalf-Of to that user's ID. This needs the users:act-on-behalf scope, and the key owner must manage the target user; if either condition fails, the API returns 403 ON_BEHALF_OF_NOT_ALLOWED. GET requests ignore this header.
Type-by-type field map
Use this checklist to confirm the body shape before sending. The table below shows the required and optional fields for each automation type. Fields not listed for a type should not be sent.
Worked example: a blackout-period automation
The following example creates a blackout-period automation named End of year freeze. It applies to one leave type and one location, runs from 2026-12-20 to 2026-12-31, repeats every year, and includes a reason shown to users. The request body is shown in the cURL example below. A successful response returns 201 with the automation object, including its id, type, name, isActive, ownerId, createdAt, scoping arrays, dates, recurring, and reason.
Decision checklist before you send
- Confirm the
{type}path segment is one of the supported types. 2. Confirm the API key hasautomations:write. 3. Confirm the acting user is an approver or admin; forseniority-entitlementandentitlement-by-role, confirm the acting user is an admin. 4. Confirm the company has the automation's add-on active. 5. Include only fields that belong to the selected type. 6. If retrying, reuse the sameIdempotency-Keyand the same request body. 7. If usingX-On-Behalf-Of, confirm the key owner manages the target user and the key hasusers:act-on-behalf. 8. After sending, handle201by reading the automation object; handle202by polling the operation URL untilSUCCEEDEDorFAILED; handle400,403,404,409, and422according to the error code.
Clarifying failure distinctions
A 400 VALIDATION_ERROR means one or more fields failed validation; inspect details.fields to find the path and message. A 400 INVALID_REQUEST_BODY means the body itself could not be parsed or accepted. A 403 FORBIDDEN or 403 AUTOMATION_ADMIN_REQUIRED means the acting user lacks permission for this action. A 403 AUTOMATION_ADDON_NOT_ACTIVE means the company has not activated the automation's add-on. A 404 AUTOMATION_TYPE_NOT_FOUND means the {type} path segment is not a supported automation type. A 409 DUPLICATE_NAME means another automation already uses the requested name. A 422 IDEMPOTENCY_KEY_REUSED means the same key was used with a different request. A 409 IDEMPOTENCY_REQUEST_IN_PROGRESS means the first request with that key is still running. A 400 INVALID_IDEMPOTENCY_KEY means the key is not 1 to 255 printable ASCII characters.
| Automation type | Required fields | Optional fields | Notes |
|---|---|---|---|
| blackout-period | name, leaveTypeIds, startDate, endDate, recurring, reason | locationIds, departmentIds, labelIds | Dates use YYYY-MM-DD. reason may be empty but must not look like HTML or script. |
| maximum-users-away | name, startDate, endDate, recurring, autoRejectResponse, maxUsersAway | locationIds, departmentIds, labelIds, leaveTypeIds | maxUsersAway is an object with type (percentage or absolute) and value. A percentage above the dashboard maximum fails validation. |
| seniority-entitlement | name, leaveTypeId, prorate, periods | locationIds, departmentIds, labelIds, calculateFrom, awardSeniorityEntitlementDaysOn | periods is an array of 1 to 20 objects with years, amount, and units. Only admins can create this type. |
| entitlement-by-role | name, leaveTypeId, startDate, amount, units, labelId | None | Does not accept locationIds, departmentIds, or labelIds. Only admins can create this type. If the label is deleted, labelId becomes an empty string and the automation no longer applies. |
| probation-period | name, leaveTypeIds, lengthDays, reason | locationIds, departmentIds, labelIds | lengthDays is counted from the user's employment start date. |
| leave-duration-limit | None strictly required; send minimumDuration, maximumDuration, or both | name, locationIds, departmentIds, labelIds, period, units, recurring, autoRejectResponse, leaveTypeIds | One of minimumDuration or maximumDuration may be null only when the other is a number. period is an array of exactly two YYYY-MM-DD strings. |
| leave-request-notice-period | name, minLeaveDurationForAdvanceNotice, requiredAdvanceNoticeDays, autoRejectResponse | locationIds, departmentIds, labelIds, leaveTypeIds | minLeaveDurationForAdvanceNotice and requiredAdvanceNoticeDays are integers. |
This table summarizes the request schema fields. The exact schema module remains the source of truth for field names, types, and validation rules.
Frequently asked questions
What scope does the create-automation endpoint require?
The endpoint requires the automations:write scope. The API key is sent as Authorization: Bearer vt_live_<secret>. The acting user must be an approver or an admin.
What should I do when the endpoint returns 202 Accepted?
The response includes an operation object with an id, a status, and a url. Poll that URL until the status is SUCCEEDED or FAILED. If the operation reports AUTOMATION_ADDON_NOT_ACTIVE, the company has not activated the automation's add-on.
How do I safely retry a create request?
Attach an Idempotency-Key header of 1 to 255 printable ASCII characters. Each API key remembers its keys for 24 hours, and a repeat of the identical request inside that window gets the stored response back, flagged with Idempotent-Replayed. A key that is reused alongside a changed request is rejected with 422 IDEMPOTENCY_KEY_REUSED. If the first attempt is still executing when the retry arrives, the API answers 409 IDEMPOTENCY_REQUEST_IN_PROGRESS. A key that does not meet the format rules produces 400 INVALID_IDEMPOTENCY_KEY.
How does X-On-Behalf-Of affect ownership?
Whoever acts — the key owner, or the user identified in X-On-Behalf-Of — is recorded as the automation's owner (ownerId). The header only works when the key carries the users:act-on-behalf scope and the key owner manages the target user; when either condition is unmet, the API responds with 403 ON_BEHALF_OF_NOT_ALLOWED. GET requests ignore the header.
Why does entitlement-by-role reject locationIds, departmentIds, and labelIds?
The entitlement-by-role type applies to users who have the label in labelId. It does not accept the general scoping fields locationIds, departmentIds, or labelIds. If the label is deleted, labelId becomes an empty string and the automation no longer applies.
Can I send only a maximumDuration for leave-duration-limit?
Yes. Send minimumDuration, maximumDuration, or both. One of them may be null only when the other is a number. The period field is an array of exactly two YYYY-MM-DD strings.
curl -X POST "$API_BASE_URL/v2/automations/blackout-period" \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{
"name": "End of year freeze",
"leaveTypeIds": [
"leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615"
],
"startDate": "2026-12-20",
"endDate": "2026-12-31",
"recurring": true,
"reason": "Year-end closing",
"locationIds": [
"location-79c77ac8-e5bf-479f-9488-648a58379ff1"
]
}'{
"data": {
"id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"type": "blackout-period",
"name": "End of year freeze",
"isActive": true,
"ownerId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14",
"createdAt": "2026-09-23T10:00:00.000Z",
"locationIds": [
"location-79c77ac8-e5bf-479f-9488-648a58379ff1"
],
"departmentIds": [],
"labelIds": [],
"leaveTypeIds": [
"leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615"
],
"startDate": "2026-12-20",
"endDate": "2026-12-31",
"recurring": true,
"reason": "Year-end closing"
}
}{
"operation": {
"id": "pa_3f1c2b9e-8a47-4d5e-9c61-2b7f0e4a1d93",
"status": "PENDING",
"url": "/v2/operations/pa_3f1c2b9e-8a47-4d5e-9c61-2b7f0e4a1d93"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"name": "ValidationError",
"description": "Example post details.",
"resolution": "Fix the fields listed in details.fields and send the request again.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"details": {
"fields": [
{
"path": "startDate",
"message": "\"startDate\" is required"
}
]
}
}
}{
"error": {
"code": "UNAUTHORIZED",
"name": "Unauthorized",
"description": "Example post details.",
"resolution": "Send a valid API key in the Authorization header as Bearer followed by the full vt_live_ key.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}{
"error": {
"code": "INSUFFICIENT_SCOPE",
"name": "InsufficientScope",
"description": "Example post details.",
"resolution": "Add the scopes listed in details.requiredScopes to the key in the OnlyLeave dashboard.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"details": {
"requiredScopes": [
"leaves:write"
]
}
}
}{
"error": {
"code": "AUTOMATION_TYPE_NOT_FOUND",
"name": "Automation type not found",
"description": "Example post details.",
"resolution": "Use one of the automation types listed in the API reference.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}{
"error": {
"code": "CONFLICT",
"name": "Conflict",
"description": "Example post details.",
"resolution": "Read the resource again and retry with up-to-date values.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}{
"error": {
"code": "LEAVE_NEGATIVE_BALANCE",
"name": "LeaveNegativeBalance",
"description": "Example post details.",
"resolution": "Shorten the leave, use a different leave type, or ask an admin to adjust the quota.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}{
"error": {
"code": "RATE_LIMITED",
"name": "RateLimited",
"description": "Example post details.",
"resolution": "Wait a few seconds and retry, using the same Idempotency-Key for writes.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"name": "InternalError",
"description": "Example post details.",
"resolution": "Retry later, and if it keeps happening, contact OnlyLeave support and quote the requestId.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}type
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| type | string | Yes | automation type. Any other value returns 404 AUTOMATION_TYPE_NOT_FOUND . | Allowed values: "blackout-period" | "seniority-entitlement" | "entitlement-by-role" | "maximum-users-away" | "probation-period" | "leave-duration-limit" | "leave-request-notice-period" |
Idempotency-Key
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| Idempotency-Key | string | No | optional key (1 to 255 printable ASCII characters) that makes a write request safe to retry. Keys are retained for 24 hours per API key. Retrying with the same key and the same request within those 24 hours replays the original response (with the Idempotent-Replayed header). Reusing the key with a different request returns 422 IDEMPOTENCY_KEY_REUSED ; retrying while the first request is still running returns 409 IDEMPOTENCY_REQUEST_IN_PROGRESS ; an invalid key returns 400 INVALID_IDEMPOTENCY_KEY . | 1 <= length <= 255 |
X-On-Behalf-Of
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| X-On-Behalf-Of | string | No | ID of the user the write is performed for. Requires the users:act-on-behalf scope, and the key owner must manage the target user; otherwise the request fails with 403 ON_BEHALF_OF_NOT_ALLOWED . Ignored on GET requests. |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | |||
| response.data | blackout-period | maximum-users-away | seniority-entitlement | entitlement-by-role | probation-period | leave-duration-limit | leave-request-notice-period | Yes | ||
| response.data[variant1] | object | |||
| response.data[variant1].id | string | Yes | automation ID | |
| response.data[variant1].type | string | Yes | automation type | Allowed values: "blackout-period" | "seniority-entitlement" | "entitlement-by-role" | "maximum-users-away" | "probation-period" | "leave-duration-limit" | "leave-request-notice-period" |
| response.data[variant1].name | string | Yes | automation name, unique among the company's automations | |
| response.data[variant1].isActive | boolean | Yes | whether the automation is currently applied | |
| response.data[variant1].ownerId | string | Yes | the ID of the user who created the automation | |
| response.data[variant1].createdAt | string | Yes | a timestamp in the ISO 8601 format | Format: date-time |
| response.data[variant1].locationIds | array<string> | Yes | IDs of the locations the automation applies to; empty means all locations | |
| response.data[variant1].locationIds[] | string | |||
| response.data[variant1].departmentIds | array<string> | Yes | IDs of the departments the automation applies to; empty means all departments | |
| response.data[variant1].departmentIds[] | string | |||
| response.data[variant1].labelIds | array<string> | Yes | IDs of the labels the automation applies to; empty means users with or without labels | |
| response.data[variant1].labelIds[] | string | |||
| response.data[variant1].leaveTypeIds | array<string> | Yes | IDs of the leave types the automation applies to | |
| response.data[variant1].leaveTypeIds[] | string | |||
| response.data[variant1].startDate | string | Yes | first day of the blackout period in YYYY-MM-DD format | date |
| response.data[variant1].endDate | string | Yes | last day of the blackout period in YYYY-MM-DD format | date |
| response.data[variant1].recurring | boolean | Yes | whether the blackout period repeats every year | |
| response.data[variant1].reason | string | Yes | the reason shown to users, may be empty. Text that looks like HTML or script fails validation. | |
| response.data[variant2] | object | |||
| response.data[variant2].id | string | Yes | automation ID | |
| response.data[variant2].type | string | Yes | automation type | "blackout-period" | "seniority-entitlement" | "entitlement-by-role" | "maximum-users-away" | "probation-period" | "leave-duration-limit" | "leave-request-notice-period" |
| response.data[variant2].name | string | Yes | automation name, unique among the company's automations | |
| response.data[variant2].isActive | boolean | Yes | whether the automation is currently applied | |
| response.data[variant2].ownerId | string | Yes | the ID of the user who created the automation | |
| response.data[variant2].createdAt | string | Yes | a timestamp in the ISO 8601 format | Format: date-time |
| response.data[variant2].locationIds | array<string> | Yes | IDs of the locations the automation applies to; empty means all locations | |
| response.data[variant2].locationIds[] | string | |||
| response.data[variant2].departmentIds | array<string> | Yes | IDs of the departments the automation applies to; empty means all departments | |
| response.data[variant2].departmentIds[] | string | |||
| response.data[variant2].labelIds | array<string> | Yes | IDs of the labels the automation applies to; empty means users with or without labels | |
| response.data[variant2].labelIds[] | string | |||
| response.data[variant2].leaveTypeIds | array<string> | Yes | IDs of the leave types counted; omitted or empty means all leave types | |
| response.data[variant2].leaveTypeIds[] | string | |||
| response.data[variant2].startDate | string | Yes | first day the limit applies, in YYYY-MM-DD format | date |
| response.data[variant2].endDate | string | Yes | last day the limit applies, in YYYY-MM-DD format | date |
| response.data[variant2].recurring | boolean | Yes | whether the period repeats every year | |
| response.data[variant2].autoRejectResponse | string | Yes | the message sent to the user when a leave request is automatically rejected by this automation, may be empty. Text that looks like HTML or script fails validation. | |
| response.data[variant2].maxUsersAway | object | Yes | ||
| response.data[variant2].maxUsersAway.type | string | Yes | whether value is a percentage of the matching users or a number of users | "percentage" | "absolute" |
| response.data[variant2].maxUsersAway.value | number | Yes | the maximum share or number of users who can be away at the same time. A percentage above the maximum the dashboard allows fails validation. | 0 <= value |
| response.data[variant3] | object | |||
| response.data[variant3].id | string | Yes | automation ID | |
| response.data[variant3].type | string | Yes | automation type | "blackout-period" | "seniority-entitlement" | "entitlement-by-role" | "maximum-users-away" | "probation-period" | "leave-duration-limit" | "leave-request-notice-period" |
| response.data[variant3].name | string | Yes | automation name, unique among the company's automations | |
| response.data[variant3].isActive | boolean | Yes | whether the automation is currently applied | |
| response.data[variant3].ownerId | string | Yes | the ID of the user who created the automation | |
| response.data[variant3].createdAt | string | Yes | a timestamp in the ISO 8601 format | Format: date-time |
| response.data[variant3].locationIds | array<string> | Yes | IDs of the locations the automation applies to; empty means all locations | |
| response.data[variant3].locationIds[] | string | |||
| response.data[variant3].departmentIds | array<string> | Yes | IDs of the departments the automation applies to; empty means all departments | |
| response.data[variant3].departmentIds[] | string | |||
| response.data[variant3].labelIds | array<string> | Yes | IDs of the labels the automation applies to; empty means users with or without labels | |
| response.data[variant3].labelIds[] | string | |||
| response.data[variant3].leaveTypeId | string | Yes | the ID of the leave type that receives the extra entitlement | |
| response.data[variant3].prorate | boolean | Yes | whether the extra entitlement is prorated | |
| response.data[variant3].periods | array<object> | Yes | the extra entitlement awarded after each number of years of service | 1 <= items <= 20 |
| response.data[variant3].periods[] | object | |||
| response.data[variant3].periods[].years | integer | Yes | years of service | 1 <= value |
| response.data[variant3].periods[].amount | number | Yes | the extra entitlement, in steps of 0.5 | 0.5 0.5 <= value |
| response.data[variant3].periods[].units | string | Yes | the unit of the amount, days or hours | "days" | "hours" |
| response.data[variant3].calculateFrom | string | Yes | whether years of service count from the user's employment start date or from today; TODAY when it was never set | "USER_EMPLOYMENT_DATE" | "TODAY" |
| response.data[variant3].awardSeniorityEntitlementDaysOn | string | No | when the extra entitlement is awarded; USER_WORK_ANNIVERSARY when it was never set | "USER_WORK_ANNIVERSARY" | "BEGINNING_OF_THE_FISCAL_YEAR" |
| response.data[variant4] | object | |||
| response.data[variant4].id | string | Yes | automation ID | |
| response.data[variant4].type | string | Yes | automation type | "blackout-period" | "seniority-entitlement" | "entitlement-by-role" | "maximum-users-away" | "probation-period" | "leave-duration-limit" | "leave-request-notice-period" |
| response.data[variant4].name | string | Yes | automation name, unique among the company's automations | |
| response.data[variant4].isActive | boolean | Yes | whether the automation is currently applied | |
| response.data[variant4].ownerId | string | Yes | the ID of the user who created the automation | |
| response.data[variant4].createdAt | string | Yes | a timestamp in the ISO 8601 format | Format: date-time |
| response.data[variant4].leaveTypeId | string | Yes | the ID of the leave type that receives the extra entitlement | |
| response.data[variant4].startDate | string | Yes | date in YYYY-MM-DD format from which the extra entitlement applies | date |
| response.data[variant4].amount | number | Yes | the extra entitlement | |
| response.data[variant4].units | string | Yes | the unit of the amount, days or hours | "days" | "hours" |
| response.data[variant4].labelId | string | Yes | the ID of the label (role) whose users receive the extra entitlement; an empty string after that label was deleted, and the automation then no longer applies | |
| response.data[variant5] | object | |||
| response.data[variant5].id | string | Yes | automation ID | |
| response.data[variant5].type | string | Yes | automation type | "blackout-period" | "seniority-entitlement" | "entitlement-by-role" | "maximum-users-away" | "probation-period" | "leave-duration-limit" | "leave-request-notice-period" |
| response.data[variant5].name | string | Yes | automation name, unique among the company's automations | |
| response.data[variant5].isActive | boolean | Yes | whether the automation is currently applied | |
| response.data[variant5].ownerId | string | Yes | the ID of the user who created the automation | |
| response.data[variant5].createdAt | string | Yes | a timestamp in the ISO 8601 format | Format: date-time |
| response.data[variant5].locationIds | array<string> | Yes | IDs of the locations the automation applies to; empty means all locations | |
| response.data[variant5].locationIds[] | string | |||
| response.data[variant5].departmentIds | array<string> | Yes | IDs of the departments the automation applies to; empty means all departments | |
| response.data[variant5].departmentIds[] | string | |||
| response.data[variant5].labelIds | array<string> | Yes | IDs of the labels the automation applies to; empty means users with or without labels | |
| response.data[variant5].labelIds[] | string | |||
| response.data[variant5].leaveTypeIds | array<string> | Yes | IDs of the leave types the automation applies to | |
| response.data[variant5].leaveTypeIds[] | string | |||
| response.data[variant5].lengthDays | number | Yes | length of the probation period in days, counted from the user's employment start date | |
| response.data[variant5].reason | string | Yes | the reason shown to users, may be empty. Text that looks like HTML or script fails validation. | |
| response.data[variant6] | object | |||
| response.data[variant6].id | string | Yes | automation ID | |
| response.data[variant6].type | string | Yes | automation type | "blackout-period" | "seniority-entitlement" | "entitlement-by-role" | "maximum-users-away" | "probation-period" | "leave-duration-limit" | "leave-request-notice-period" |
| response.data[variant6].name | string | Yes | automation name, unique among the company's automations | |
| response.data[variant6].isActive | boolean | Yes | whether the automation is currently applied | |
| response.data[variant6].ownerId | string | Yes | the ID of the user who created the automation | |
| response.data[variant6].createdAt | string | Yes | a timestamp in the ISO 8601 format | Format: date-time |
| response.data[variant6].locationIds | array<string> | Yes | IDs of the locations the automation applies to; empty means all locations | |
| response.data[variant6].locationIds[] | string | |||
| response.data[variant6].departmentIds | array<string> | Yes | IDs of the departments the automation applies to; empty means all departments | |
| response.data[variant6].departmentIds[] | string | |||
| response.data[variant6].labelIds | array<string> | Yes | IDs of the labels the automation applies to; empty means users with or without labels | |
| response.data[variant6].labelIds[] | string | |||
| response.data[variant6].period | array<string> | Yes | the start and end dates, in YYYY-MM-DD format, during which the limit applies | 2 <= items <= 2 |
| response.data[variant6].period[] | string | date | ||
| response.data[variant6].minimumDuration | number | null | Yes | the shortest allowed leave, in units; null when there is no minimum | 0 < value |
| response.data[variant6].minimumDuration[variant1] | number | the shortest allowed leave, in units; null when there is no minimum | 0 < value | |
| response.data[variant6].minimumDuration[variant2] | null | the shortest allowed leave, in units; null when there is no minimum | 0 < value | |
| response.data[variant6].maximumDuration | number | null | Yes | the longest allowed leave, in units; null when there is no maximum | 0 < value |
| response.data[variant6].maximumDuration[variant1] | number | the longest allowed leave, in units; null when there is no maximum | 0 < value | |
| response.data[variant6].maximumDuration[variant2] | null | the longest allowed leave, in units; null when there is no maximum | 0 < value | |
| response.data[variant6].units | string | Yes | the unit of the amount, days or hours | "days" | "hours" |
| response.data[variant6].recurring | boolean | Yes | whether the period repeats every year | |
| response.data[variant6].autoRejectResponse | string | Yes | the message sent to the user when a leave request is automatically rejected by this automation, may be empty. Text that looks like HTML or script fails validation. | |
| response.data[variant6].leaveTypeIds | array<string> | Yes | IDs of the leave types limited; omitted or empty means all leave types | |
| response.data[variant6].leaveTypeIds[] | string | |||
| response.data[variant7] | object | |||
| response.data[variant7].id | string | Yes | automation ID | |
| response.data[variant7].type | string | Yes | automation type | "blackout-period" | "seniority-entitlement" | "entitlement-by-role" | "maximum-users-away" | "probation-period" | "leave-duration-limit" | "leave-request-notice-period" |
| response.data[variant7].name | string | Yes | automation name, unique among the company's automations | |
| response.data[variant7].isActive | boolean | Yes | whether the automation is currently applied | |
| response.data[variant7].ownerId | string | Yes | the ID of the user who created the automation | |
| response.data[variant7].createdAt | string | Yes | a timestamp in the ISO 8601 format | Format: date-time |
| response.data[variant7].locationIds | array<string> | Yes | IDs of the locations the automation applies to; empty means all locations | |
| response.data[variant7].locationIds[] | string | |||
| response.data[variant7].departmentIds | array<string> | Yes | IDs of the departments the automation applies to; empty means all departments | |
| response.data[variant7].departmentIds[] | string | |||
| response.data[variant7].labelIds | array<string> | Yes | IDs of the labels the automation applies to; empty means users with or without labels | |
| response.data[variant7].labelIds[] | string | |||
| response.data[variant7].minLeaveDurationForAdvanceNotice | integer | Yes | leaves at least this long must be requested in advance | |
| response.data[variant7].requiredAdvanceNoticeDays | integer | Yes | how many days in advance those leaves must be requested | |
| response.data[variant7].autoRejectResponse | string | Yes | the message sent to the user when a leave request is automatically rejected by this automation, may be empty. Text that looks like HTML or script fails validation. | |
| response.data[variant7].leaveTypeIds | array<string> | Yes | IDs of the leave types the notice applies to; omitted or empty means all leave types | |
| response.data[variant7].leaveTypeIds[] | string |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Returned with HTTP 202 when a write operation is still running, or succeeded but its result could not be read back yet. The Location header carries the same URL as operation.url . Poll it until the status is SUCCEEDED or FAILED . | ||
| response.operation | object | Yes | ||
| response.operation.id | string | Yes | ||
| response.operation.status | string | Yes | operation status. UNKNOWN means no result arrived within 15 minutes; the change may or may not have been applied, so read the resource to check. A result that arrives later still changes it to SUCCEEDED or FAILED. | Allowed values: "PENDING" | "SUCCEEDED" | "FAILED" | "UNKNOWN" |
| response.operation.url | string | Yes |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |