Use this endpoint when a notification of any frequency must be removed. The request has no body: the notification is identified only by its path ID, and the acting user is either the API key owner or the user named by X-On-Behalf-Of. Before calling, confirm the key carries the notifications:write scope, confirm who the acting user will be, and decide whether a retry key is needed.
Make the request
Send a DELETE request to /v2/notifications/{id}, with the notification's resource ID in the path. The cURL example is provided as protected module code0001. No request body is sent, so there are no body fields to validate; the only required input is the path ID described by schema0001.
Authenticate with Authorization: Bearer followed by the full API key, and ensure the key has the notifications:write scope. The key owner's role also limits what the key can do, so a key that authenticates successfully can still fail on scope or ownership.
Headers that control the acting user and retries
Two optional headers change how the call behaves:
Idempotency-Key: makes the write safe to retry. It must be 1 to 255 printable ASCII characters, is retained for 24 hours per API key, and is detailed in schema0002.
X-On-Behalf-Of: names the user the write is performed for. It requires the users:act-on-behalf scope and the key owner must manage the target user, as described in schema0003.
Checklist before sending: the ID is the notification to remove, the acting user is correct, the scope is present, and, if retries are possible, a fresh Idempotency-Key has been generated for this request.
Read the outcome: 204 or 202
A 204 response has an empty body and means the deletion completed synchronously. A 202 response returns an operation object, shown in protected module code0002 and described by schema0007, with an id, a status, and a url to poll. Poll that URL until the status is SUCCEEDED or FAILED. UNKNOWN means no result arrived within 15 minutes and the change may or may not have been applied, so read the resource to check; a later result can still move it to SUCCEEDED or FAILED.
Ownership and error distinctions
Ownership is the most common source of confusion. Unless the acting user holds admin rights, deletion is limited to that user's own notifications. For that reason, a 404 with code RESOURCE_NOT_FOUND is deliberately ambiguous: it may signal a missing identifier, or it may hide a notification belonging to someone else from a non-admin caller. Read it as 'not found for this acting user', rather than as confirmation that the identifier itself is invalid.
Other failures to distinguish: 403 ON_BEHALF_OF_NOT_ALLOWED when acting on behalf without permission, 400 for an invalid Idempotency-Key, 409 IDEMPOTENCY_REQUEST_IN_PROGRESS while the first request is still running, 422 IDEMPOTENCY_KEY_REUSED when the key is reused for a different request, and 429 when too many requests were sent in a short time. Error responses use the standard envelope with a stable code, a human-readable name, a description, a resolution, and a requestId to quote when seeking help.
Frequently asked questions
What is the difference between a 204 and a 202 response?
A 204 means the deletion finished before the response was sent, so there is no body to inspect. A 202 means the work is still running and an operation object is returned instead; poll its URL until the status becomes SUCCEEDED or FAILED. If the status is UNKNOWN, check the notification itself because the change may or may not have been applied.
How should retries be handled for this delete call?
Use an Idempotency-Key of 1 to 255 printable ASCII characters. Repeating the same key with the same request within 24 hours replays the original response, marked with the Idempotent-Replayed header. Reusing the key for a different request returns 422 IDEMPOTENCY_KEY_REUSED, retrying while the first attempt is still running returns 409 IDEMPOTENCY_REQUEST_IN_PROGRESS, and an invalid key returns 400 INVALID_IDEMPOTENCY_KEY.
Why might a delete return 404 or 403?
A non-admin acting user can remove only notifications they own. A 404 RESOURCE_NOT_FOUND can therefore mean either that the ID does not exist or that it belongs to someone else and the acting user is not an admin. Separately, 403 ON_BEHALF_OF_NOT_ALLOWED applies when X-On-Behalf-Of is used without the required scope or without managing the target user.
{
"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": "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": "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"
}
}
id
Field
Type
Required
Description
Constraints
id
string
Yes
resource ID.
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
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.