Skip to content

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.

Scheduled report fields
FieldTypeRequiredMeaning and reader guidance
idstringyesscheduled report ID
namestringyesreport name
reportTypestring enumyesthe kind of report; one of leaveHistoryReport, leaveBalanceReport, monthlyLeaveBalanceReport
periodstring enumnothe period the report covers; left out when it is not stored; only LAST_MONTH is documented
locationIdsarray<string>yesIDs of the locations included; empty means all locations
departmentIdsarray<string>yesIDs of the departments included; empty means all departments
labelIdsarray<string>yesIDs of the labels included; empty means users with or without labels
receiversarray<string> (email)yesemail addresses the report is sent to
timezonestringyesthe time zone used for the report's dates; does not apply to sendHourUtc and sendMinuteUtc
sendDayOfMonthinteger (1–31)yesthe day of the month the report is sent
sendHourUtcinteger (0–23)yesthe hour the report is sent, in UTC
sendMinuteUtcinteger (0–59)yesthe minute the report is sent, in UTC
leaveStatusarray<string enum>nothe leave statuses included, only for leaveHistoryReport; left out when none are stored; values APPROVED, DENIED, EXPIRED, CANCELLED
creatorIdstringyesthe ID of the user who created the report
errorstringnothe 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

FieldTypeRequiredDescriptionConstraints
idstringYesresource ID.

response

FieldTypeRequiredDescriptionConstraints
responseobject
response.dataobjectYes
response.data.idstringYesscheduled report ID
response.data.namestringYesreport name
response.data.reportTypestringYesthe kind of report"leaveHistoryReport" | "leaveBalanceReport" | "monthlyLeaveBalanceReport"
response.data.periodstringNothe period the report covers; left out when it is not stored"LAST_MONTH"
response.data.locationIdsarray<string>YesIDs of the locations included; empty means all locations
response.data.locationIds[]string
response.data.departmentIdsarray<string>YesIDs of the departments included; empty means all departments
response.data.departmentIds[]string
response.data.labelIdsarray<string>YesIDs of the labels included; empty means users with or without labels
response.data.labelIds[]string
response.data.receiversarray<string>Yesemail addresses the report is sent to
response.data.receivers[]stringemail
response.data.timezonestringYesthe time zone used for the report's dates. It does not apply to sendHourUtc and sendMinuteUtc.
response.data.sendDayOfMonthintegerYesthe day of the month the report is sent1 <= value <= 31
response.data.sendHourUtcintegerYesthe hour the report is sent, in UTC0 <= value <= 23
response.data.sendMinuteUtcintegerYesthe minute the report is sent, in UTC0 <= value <= 59
response.data.leaveStatusarray<ScheduledReportLeaveStatus>Nothe leave statuses included, only for leaveHistoryReport; left out when none are stored
response.data.leaveStatus[]stringa leave status a leaveHistoryReport includes"APPROVED" | "DENIED" | "EXPIRED" | "CANCELLED"
response.data.creatorIdstringYesthe ID of the user who created the report
response.data.errorstringNothe last error that stopped the report from being sent; left out when there is none

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo