Get a Scheduled Report
This endpoint returns one scheduled report for the company tied to your API key. You need the notifications:read scope, and the key owner's role determines which reports are visible. The response is a single report object wrapped in a data field.
Request shape
Send a GET request to /v2/scheduled-reports/{id}. The only path parameter is id, a required string identifying the report. Authentication uses a bearer token in the Authorization header, and the key must carry the notifications:read scope. The endpoint returns 200 with the report on success; error responses use the shared error envelope described below.
What the returned report contains
The 200 response wraps a report object in data. The table below maps each field to its meaning and the reader guidance that matters when consuming it. Empty arrays are meaningful: an empty locationIds means all locations, an empty departmentIds means all departments, and an empty labelIds means users with or without labels. The timezone field applies to the report's dates but not to sendHourUtc and sendMinuteUtc, which are always UTC. Optional fields (period, leaveStatus, error) are omitted when not stored or not applicable.
Role and plan checks before you call
Three failure modes are specific to this endpoint, and each points at a different cause. Start with the plan: if the company is not subscribed to the Complete plan, the call fails with 403 SCHEDULED_REPORTS_NOT_AVAILABLE, so check the subscription before investigating permissions. Next, the role: a key owner who is neither an admin nor a location admin receives 403 FORBIDDEN. Finally, visibility: a 404 RESOURCE_NOT_FOUND can mean the report genuinely does not exist, but it also appears when the key owner is a location admin and the report either lists no locations or lists at least one location outside that admin's scope. Because a location admin only sees reports tied to locations they manage, a report that exists but sits outside their scope is reported as not found rather than forbidden. The practical fix is to widen the key owner's managed locations or switch to an admin-owned key; repeating the same request will not change the outcome.
Worked example
The sample response below shows a monthly leave balance report named "Monthly balances" with reportType leaveBalanceReport, period LAST_MONTH, no location, department or label filters, one receiver, timezone Europe/Belgrade, and a send schedule of day 1 at 07:30 UTC. Because locationIds, departmentIds and labelIds are empty, the report covers all locations, all departments and users with or without labels. The timezone affects the report's dates only; the send time is 07:30 UTC regardless of the timezone field.
Error responses
Every error uses the same envelope: an error object with code, name, description, resolution, requestId and optional details. The 401 response means the API key is missing, malformed or not recognized. A 403 with INSUFFICIENT_SCOPE means the key lacks the required scope; add notifications:read to the key. A 403 with FORBIDDEN means the key owner's role is insufficient. A 404 with RESOURCE_NOT_FOUND means the report is missing or outside the key owner's visibility. A 429 with RATE_LIMITED means too many requests were sent in a short time; wait and retry. A 500 with INTERNAL_ERROR means something failed on the server; retry later and quote the requestId if it persists.
| Field | Type | Required | Meaning and reader guidance |
|---|---|---|---|
| id | string | yes | scheduled report ID |
| name | string | yes | report name |
| reportType | string enum | yes | the kind of report; one of leaveHistoryReport, leaveBalanceReport, monthlyLeaveBalanceReport |
| period | string enum | no | the period the report covers; left out when it is not stored; only LAST_MONTH is documented |
| locationIds | array<string> | yes | IDs of the locations included; empty means all locations |
| departmentIds | array<string> | yes | IDs of the departments included; empty means all departments |
| labelIds | array<string> | yes | IDs of the labels included; empty means users with or without labels |
| receivers | array<string> (email) | yes | email addresses the report is sent to |
| timezone | string | yes | the time zone used for the report's dates; does not apply to sendHourUtc and sendMinuteUtc |
| sendDayOfMonth | integer (1–31) | yes | the day of the month the report is sent |
| sendHourUtc | integer (0–23) | yes | the hour the report is sent, in UTC |
| sendMinuteUtc | integer (0–59) | yes | the minute the report is sent, in UTC |
| leaveStatus | array<string enum> | no | the leave statuses included, only for leaveHistoryReport; left out when none are stored; values APPROVED, DENIED, EXPIRED, CANCELLED |
| creatorId | string | yes | the ID of the user who created the report |
| error | string | no | the last error that stopped the report from being sent; left out when there is none |
Field meanings and constraints are taken from the endpoint's response schema. Optional fields are omitted when not stored or not applicable.
Frequently asked questions
Which scope does this endpoint require?
notifications:read. The key is sent as a bearer token in the Authorization header.
Why does a location admin get a 404 instead of a 403?
A location admin sees only reports whose locations they manage. If the report has no locations or includes a location the key owner does not manage, the endpoint returns 404 RESOURCE_NOT_FOUND rather than 403. A 403 FORBIDDEN is reserved for a key owner who is neither an admin nor a location admin.
Does the timezone field change the send time?
No. The timezone field applies to the report's dates. The send time is expressed by sendHourUtc and sendMinuteUtc in UTC and is not shifted by the timezone field.
What do empty locationIds, departmentIds and labelIds mean?
An empty locationIds means all locations, an empty departmentIds means all departments, and an empty labelIds means users with or without labels.
What does SCHEDULED_REPORTS_NOT_AVAILABLE mean?
The company is not on the Complete plan. This is a plan gate, not a role problem.
curl -X GET "$API_BASE_URL/v2/scheduled-reports/string" \
-H "Authorization: Bearer "{
"data": {
"id": "scheduledReport-8a47c61e-2b7f-4d5e-9c61-3f1c2b9e1d93",
"name": "Monthly balances",
"reportType": "leaveBalanceReport",
"period": "LAST_MONTH",
"locationIds": [],
"departmentIds": [],
"labelIds": [],
"receivers": [
"[email protected]"
],
"timezone": "Europe/Belgrade",
"sendDayOfMonth": 1,
"sendHourUtc": 7,
"sendMinuteUtc": 30,
"creatorId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14"
}
}{
"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": "RESOURCE_NOT_FOUND",
"name": "ResourceNotFound",
"description": "Example post details.",
"resolution": "Check the ID of the resource named in details.resource and that the key owner can see it.",
"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"
}
}id
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| id | string | Yes | resource ID. |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | |||
| response.data | object | Yes | ||
| response.data.id | string | Yes | scheduled report ID | |
| response.data.name | string | Yes | report name | |
| response.data.reportType | string | Yes | the kind of report | "leaveHistoryReport" | "leaveBalanceReport" | "monthlyLeaveBalanceReport" |
| response.data.period | string | No | the period the report covers; left out when it is not stored | "LAST_MONTH" |
| response.data.locationIds | array<string> | Yes | IDs of the locations included; empty means all locations | |
| response.data.locationIds[] | string | |||
| response.data.departmentIds | array<string> | Yes | IDs of the departments included; empty means all departments | |
| response.data.departmentIds[] | string | |||
| response.data.labelIds | array<string> | Yes | IDs of the labels included; empty means users with or without labels | |
| response.data.labelIds[] | string | |||
| response.data.receivers | array<string> | Yes | email addresses the report is sent to | |
| response.data.receivers[] | string | |||
| response.data.timezone | string | Yes | the time zone used for the report's dates. It does not apply to sendHourUtc and sendMinuteUtc. | |
| response.data.sendDayOfMonth | integer | Yes | the day of the month the report is sent | 1 <= value <= 31 |
| response.data.sendHourUtc | integer | Yes | the hour the report is sent, in UTC | 0 <= value <= 23 |
| response.data.sendMinuteUtc | integer | Yes | the minute the report is sent, in UTC | 0 <= value <= 59 |
| response.data.leaveStatus | array<ScheduledReportLeaveStatus> | No | the leave statuses included, only for leaveHistoryReport; left out when none are stored | |
| response.data.leaveStatus[] | string | a leave status a leaveHistoryReport includes | "APPROVED" | "DENIED" | "EXPIRED" | "CANCELLED" | |
| response.data.creatorId | string | Yes | the ID of the user who created the report | |
| response.data.error | string | No | the last error that stopped the report from being sent; left out when there is none |
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 |