Skip to content

List notifications

Use this endpoint to retrieve every daily, weekly and birthday notification visible to your API key in one unpaginated response. Visibility depends on the key owner's role: admins receive all company notifications, while other users receive only notifications they own.

Make the request

Make a GET request to /v2/notifications against the configured API base URL. There is no request body and no pagination parameter: the endpoint returns the complete visible set in one response. The request example is provided by protected module code0001.

Authorization and scope

Send the API key in the Authorization header as a Bearer token, using the full vt_live_ key. The key needs the notifications:read scope, placed in the header. How keys are created and how the owner's role limits them is covered by the authentication and scopes guidance. The authorization details are in units unit00017 to unit00021.

Who sees what

Visibility is role-based, not filter-based. An admin key returns every notification in the company. A non-admin key returns only notifications whose ownerId matches the key owner. If your result set looks unexpectedly small, check the key owner's role before assuming notifications are missing. This distinction is the most common reason two keys calling the same endpoint see different lists.

Reading the response

A successful 200 response contains a data array. Every entry shares common fields such as id, name, frequency, enabled, ownerId, timezone, hour, minute, locale, locationIds, departmentIds, labelIds and destinations. Beyond those shared fields, each frequency adds its own settings: daily and weekly entries require groupBy and sendEmpty, while sendOnDays is optional for daily entries; weekly entries may optionally include firstDayOfWeek, day and currentWeek; birthday entries include sendOnNonWorkingDays and may include managersReminders. An optional error field appears when the last send attempt failed. The full response contract is protected module schema0001 and the worked example is protected module code0002.

Worked example: two frequencies

Branch on frequency before interpreting an entry. For example, a daily summary sent to a Slack channel at 09:00 on weekdays uses sendOnDays and groupBy, while a birthday notice sent by email uses sendOnNonWorkingDays instead. Treating both as identical objects will cause fields to be misread. Destinations also vary: email takes one or more addresses, while Slack and Microsoft destinations take exactly one channel ID, with channelName and, for Microsoft, msGroup where applicable.

Errors and recovery checklist

Use the status code and error code together. 401 UNAUTHORIZED means the key is missing, malformed or not recognized — resend it as Bearer followed by the full key (code0003). 403 INSUFFICIENT_SCOPE means the key lacks a needed scope — add the scopes listed in details.requiredScopes (code0004). A revoked key and an acting user who may not perform the action also surface as 403 variants. 429 RATE_LIMITED means too many requests in a short time — wait and retry (code0005). 500 INTERNAL_ERROR means a server-side failure — retry later and quote the requestId if it persists (code0006). All errors share the envelope in protected modules schema0002 to schema0005.

Pre-flight checklist

Before calling in production, confirm these points: the key carries notifications:read; the Authorization header uses Bearer plus the full key; the key owner's role matches the visibility you expect; your parser branches on frequency; empty location, department and label lists mean no restriction rather than no users; and you have a retry path for 429 and 500 responses that preserves the requestId for support.

Frequency-specific fields in the list response
FrequencyDistinguishing fieldsWhat to check
DAILYgroupBy and sendEmpty (required); sendOnDays (optional)Weekdays, grouping and whether empty summaries are sent
WEEKLYgroupBy and sendEmpty (required); firstDayOfWeek, day, currentWeek (optional)Which week is summarized and on which day it sends
BIRTHDAYsendOnNonWorkingDays, managersRemindersNon-working-day handling and manager reminders

Field presence follows the protected response schema; groupBy and sendEmpty are required for DAILY and WEEKLY, while sendOnDays, firstDayOfWeek, day and currentWeek are optional where listed.

Error codes for the list endpoint
StatusError codeLikely cause and fix
401UNAUTHORIZEDKey missing, malformed or unrecognized — resend as Bearer plus full key
403INSUFFICIENT_SCOPEKey lacks a required scope — add scopes from details.requiredScopes
403Revoked key or acting-user restrictionKey was revoked, or the acting user may not perform the action
429RATE_LIMITEDToo many requests — wait a few seconds and retry
500INTERNAL_ERRORServer-side failure — retry later and quote requestId if persistent

Error examples are provided by protected modules code0003 to code0006.

Frequently asked questions

What authorization does listing notifications require?

Send the key as a Bearer token in the Authorization header. The key must carry notifications:read; the owner's role then determines whether the response covers the whole company or only notifications owned by that user.

How do I distinguish authentication, scope and permission failures?

A 401 means the key is missing, malformed, unrecognized or revoked. A 403 can mean the key lacks a required scope or the acting user may not perform the action. Check the error code and, for scope errors, the required scopes listed in the response details.

Is the notification list paginated, and why do entries differ?

The response is a single data array with no pagination. Each entry follows the shape for its frequency — daily, weekly or birthday — so branch on frequency before reading frequency-specific fields.

curl -X GET "$API_BASE_URL/v2/notifications" \
  -H "Authorization: Bearer "
{
  "data": [
    {
      "id": "notification-2b7f0e4a-1d93-4c61-8a47-3f1c2b9e4d5e",
      "name": "Daily team summary",
      "frequency": "DAILY",
      "enabled": true,
      "ownerId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14",
      "timezone": "Europe/Belgrade",
      "hour": 9,
      "minute": 0,
      "locale": "en",
      "locationIds": [],
      "departmentIds": [],
      "labelIds": [],
      "destinations": [
        {
          "platform": "slack",
          "addresses": [
            "C04ABCDEF12"
          ],
          "channelName": "general"
        }
      ],
      "sendOnDays": [
        1,
        2,
        3,
        4,
        5
      ],
      "groupBy": "TEAM",
      "sendEmpty": false
    },
    {
      "id": "notification-9e4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
      "name": "Birthdays",
      "frequency": "BIRTHDAY",
      "enabled": false,
      "ownerId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14",
      "timezone": "Europe/Belgrade",
      "hour": 10,
      "minute": 0,
      "locale": "en",
      "locationIds": [],
      "departmentIds": [],
      "labelIds": [],
      "destinations": [
        {
          "platform": "email",
          "addresses": [
            "[email protected]"
          ]
        }
      ],
      "sendOnNonWorkingDays": true,
      "managersReminders": []
    }
  ]
}
{
  "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": "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"
  }
}

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