Get a notification
This endpoint returns one notification record, including the fields that describe its frequency and delivery destinations. A valid API key with the notifications:read scope is required, and the notification must be visible to the key owner unless that owner is an admin.
Request contract
The method is GET and the path is /v2/notifications/{id}. The only path parameter is id, a required string that identifies the resource. Authentication uses a bearer token sent in the Authorization header. The token must carry the notifications:read scope. The complete request and response contracts, including the exact cURL example and the SDK variants, are supplied in the protected modules referenced below.
Response shape and frequency fields
A successful response wraps the notification in a data object. The frequency field determines which additional fields appear. DAILY notifications carry hour, minute, timezone, sendOnDays, groupBy, and sendEmpty. WEEKLY notifications add firstDayOfWeek, day, and currentWeek. BIRTHDAY notifications add sendOnNonWorkingDays and managersReminders. All variants share name, timezone, hour, minute, locale, locationIds, departmentIds, labelIds, destinations, id, enabled, ownerId, error, and frequency. The destinations array holds one or more objects with platform (microsoft, slack, or email), addresses, and optional channelName and msGroup. The full schema is preserved in the protected response module.
Worked example: a daily Slack notification
The supplied example shows a DAILY notification named "Daily team summary" that is enabled and owned by a user. Its timezone is Europe/Belgrade, it fires at 09:00, and it sends on weekdays (sendOnDays 1 through 5). The destination is a Slack channel with the channel ID C04ABCDEF12 and the display name general. groupBy is TEAM and sendEmpty is false. The exact JSON is preserved in the protected example module.
Error handling and the 404 distinction
A 404 RESOURCE_NOT_FOUND is returned in two situations. Either no notification matches the supplied ID, or the notification belongs to a different user while the key owner lacks admin rights. This differs from a 401, where the key itself is absent, malformed, or unrecognized, and from a 403, where the key is valid but does not hold the required scope. On a 404, verify the ID first, then check whether the key owner is an admin or the notification's owner. The error envelope includes a requestId to quote when contacting support. The exact error bodies are preserved in the protected error modules.
Pre-flight checklist
Before sending the request, confirm: (1) the key carries notifications:read; (2) the id value is the notification's own ID, not a user or channel ID; (3) if the key owner is not an admin, the notification belongs to that owner; (4) you are reading the frequency field before interpreting variant-specific fields; and (5) you have a plan for 401, 403, and 404 responses that does not conflate them.
Frequently asked questions
What does a 404 mean on this endpoint?
Two cases produce it: no notification matches the ID, or the record belongs to a different user and the key owner is not an admin. Verify the ID, then the key owner's role, before concluding the record is gone.
Which scope is required?
The notifications:read scope. A key without it receives a 403 INSUFFICIENT_SCOPE response.
How do I know which fields to expect?
Read the frequency field first. DAILY, WEEKLY, and BIRTHDAY notifications each add their own fields on top of the shared set.
What does the destinations array contain?
One or more objects with a platform (microsoft, slack, or email), one or more addresses, and optional channelName and msGroup fields. For email, addresses are email addresses; for microsoft and slack, there is exactly one channel ID.
curl -X GET "$API_BASE_URL/v2/notifications/string" \
-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
}
}{
"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 | 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 |