PTO Approved Email API (2026): Tell an Employee Their Time-Off Request Was Approved with POST /emails
After the HR or leave backend already approves a time-off request, email the employee the leave permalink they already have using Rovela POST /emails. Rovela does not approve leave.
A PTO-approved notice is not an expense-approved, plan-changed, or invite-accepted mail
When the HR or leave backend has already recorded that a paid-time-off request was approved — the leave is in an approved, scheduled state, a leave permalink the employee can open is already minted, the approval event is finished — that process still has to tell the employee: “Your time-off request was approved,” plus the leave permalink they already have. That send is transactional email. It is not a company newsletter, not a holiday calendar digest, and it is not a rewrite of the Odoo expense-approved, plan upgraded, plan downgraded, or invite accepted guides. Those tutorials already exist, and they describe an employee being told an expense report was approved, an account owner being told a workspace plan changed, or an inviter being told someone accepted an invitation. This article is one event in your own leave workflow: a time-off request was already approved, the dates are already on the record, and a leave permalink already exists. Rovela does not approve leave, manage balances, or talk to your HR system — this is your backend’s own PTO-approved event, sent through POST /emails. The recipient is the employee (the address you already store on that leave request). The call to action is “open the leave record,” not “your expense was approved,” not “your plan changed,” and not “your invite was accepted.”
Point the permalink at a URL the employee can actually open now — the leave record your HR system already minted when the request became approved. Do not attach a complete balance spreadsheet, a manager worksheet, or a dump of every past request unless you have a deliberate reason and the file is small enough for your own product rules; the documented call to action is the leave permalink they already have. Do not deep-link an HR-admin console the employee cannot open. If the useful destination is simply the approved leave record they already have, that URL is the right destination. There is no client library to install, and there is no official Rovela HR plugin or leave product. Use a Node.js https client plus curl in a shell when you want to prove the JSON. The JSON body and headers are the product. The leave backend that already marked the request approved should send the notice; Rovela does not change approval status and does not invent a time-off product.
This is also not a rewrite of nearby approval or scheduling guides. The Yii purchase-order-approved tutorial tells a team that a purchase order is ready to fulfill; it is not a leave mail. The appointment confirmed tutorial tells an attendee that a meeting time is confirmed; that is a scheduling confirmation, not a PTO approval. Nearby Node guides such as Express transactional email, NestJS, Koa, Sails, and FeathersJS cover other callers; they do not replace this PTO-approved story. A “your time-off request was approved” notice is a different event. Rovela’s Email API is a single HTTPS call. The base URL is https://api.rovela.dev. You authenticate with Authorization: Bearer re_… (Authentication) and queue a message with POST /emails. The response is {"object":"email","id":"..."}. HTTP 200 means the message was accepted and queued, not that it has already arrived (Quick Start).
If you are still choosing between HTTP and SMTP, read Email API vs SMTP. Rovela’s SMTP is mailbox SMTP for mail apps (mx.rovela.dev:465, a device credential, send-as-self, 30 messages a minute from one client address). Programmatic volume from an HR or leave backend belongs on POST /emails, which is also the distinction drawn in Email API vs SMTP relay. Related reading on the HTTP shape includes the transactional email API, the simple transactional email API, and sending transactional email from an app.
What you need before the first PTO-approved notice
The first-email guide and the Quick Start are the same five steps, whether the caller is curl or a Node.js https helper inside your leave service:
- Create an account. You start on the free plan, which sends real mail. There is no separate sandbox, and no test key that behaves differently from production.
- Add and verify a sending domain (a subdomain such as
mail.example.comis a common choice). You cannot send from a domain you have not verified; an unverified or foreignfromis refused with a 400 that names the domain. The dashboard asks for four DNS records — SPF, DKIM, DMARC, and return-path. See the domain setup guide, the Domains API, and what domain email is. - Create an API key. A
sending_accesskey can send and nothing else — the right default for a production PTO-approved notifier. Afull_accesskey can also read messages and events, and manage domains, templates, and webhooks. The full key is shown once. - Send with
POST /emails. - Confirm delivery in the dashboard, with
GET /emails/:idorGET /emails/:id/events(those reads needfull_accessor a dashboard session), or with a webhook.
from is a string in the documented form "People Ops <leave@yourdomain.com>". The address must sit on a verified sending domain. That is the same rule that makes domain email trustworthy: you prove you control the domain before you speak as it. How the display name and the address work is covered in the From name guide and the sending domains API overview. Related reading on records and subdomains includes how email authentication works, how to set up domain email, and sending subdomain setup.
At least one of html, text, or template is required. template is a documented { id, variables } object and is mutually exclusive with html and text. Send both html and text where you can — many clients preview the text part, which is often where the employee first sees the leave permalink (HTML email API). If you later store reusable copy in a template, follow the templates guide; this article keeps the copy inline so the service stays easy to read.
A leave backend that sends after the request is already approved
Keep the Rovela key out of the browser, out of a public repository, and out of a container image. A leaked sending_access key can send mail as your domain. The HR or leave backend that already marked the request approved should read ROVELA_API_KEY from its process environment and call Rovela only on the server (email API authentication). If a manager approves the request in your own leave product, write your own approved-leave record first (status approved and scheduled, leave permalink already minted and reachable by that employee), then enqueue the notice. Do not call the Email API from a browser form, and do not invent a Rovela plugin that changes leave status — Rovela only sends the mail.
Store the event first: the leave request id you already have, a short date range you already show on the leave record, the employee’s address, and the leave permalink they already have. The send is just the notice. The recipient is consistently the employee whose request was just approved — not every manager, not the whole department, and not a shared payroll inbox unless you add that address deliberately. Key the Idempotency-Key to that PTO-approved event so a retried worker does not mail the same “your time-off request was approved” notice twice. A later approval for a different request is a different event and should be a different key. If a later job cancels the leave or denies a pending request, those are different events, not this one.
// ptoApprovedMailer.js
// HR / leave backend helper. Plain Node.js https. No official Rovela HR plugin.
// Send only after the time-off request has already been approved.
const https = require("https");
function sendEmail({ to, subject, html, text, idempotencyKey, fromAddress, tags }) {
const payload = JSON.stringify({
from: `People Ops <${fromAddress}>`,
to,
subject,
html,
text,
reply_to: fromAddress,
tags,
});
const options = {
hostname: "api.rovela.dev",
path: "/emails",
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ROVELA_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": idempotencyKey,
"Content-Length": Buffer.byteLength(payload),
},
};
return new Promise((resolve, reject) => {
const req = https.request(options, (res) => {
let body = "";
res.on("data", (chunk) => { body += chunk; });
res.on("end", () => {
if (res.statusCode < 200 || res.statusCode > 299) {
reject(new Error(`Rovela send failed: HTTP ${res.statusCode}`));
return;
}
const parsed = JSON.parse(body);
resolve(parsed.id || "");
});
});
req.on("error", reject);
req.write(payload);
req.end();
});
}
function notifyPtoApproved({ employeeEmail, dateRange, leavePermalink, requestId }) {
const safeRange = String(dateRange).replace(/[<>&"]/g, "");
return sendEmail({
to: employeeEmail,
subject: "Your time-off request was approved",
html: `<p>Your time-off request for ${safeRange} was approved.</p><p><a href="${leavePermalink}">Open the leave record</a></p>`,
text: `Your time-off request for ${dateRange} was approved.\n\nOpen the leave record: ${leavePermalink}`,
idempotencyKey: `pto-approved-${requestId}`,
fromAddress: "leave@yourdomain.com",
tags: { type: "pto_approved" },
});
}
module.exports = { notifyPtoApproved };
Call notifyPtoApproved from the leave service or queued worker that already wrote approved_at (or your own “approved and scheduled” flag) — after the leave permalink exists and remains reachable by that employee, not before. A typical pattern is a domain event or a worker that drains a pto_approved queue your backend already enqueued after the manager’s decision is persisted. Keep the HTTP call out of the request path that merely submits a leave form; the employee should be mailed when the request has actually been approved, not when they first apply. The email is a status notice, not a place to dump a complete balance history, a policy handbook, or every team calendar the employee can already read once they open the leave record. If a later decision cancels the leave, that is a different event and should use a different idempotency key — do not reuse the approved key, and do not treat this mail as an appointment confirmed notice.
If several requests are approved in a short window and you genuinely need one HTTP call per batch of notices, POST /emails/batch accepts up to 100 messages and rejects template and topic_id. Most leave workflows are better served by one idempotent POST /emails per request. topic_id is only a documented field on the single-send endpoint; this guide does not walk through a topics product.
Idempotency, recipients, and what a 200 actually means
Leave workers retry, and a “the time-off request was approved, notify the employee” path can run more than once for the same record. Send an Idempotency-Key header (up to 256 characters). A retry of the same request within 24 hours returns the original response instead of sending again (idempotency). Key it to the leave request id (or to a specific approved event id you already store), not to the clock and not to the employee’s email alone. If the same address later has a different request approved, that is a second notice and a second key.
A message may address at most 50 recipients across to, cc, and bcc combined. That is the transport’s limit, not a plan limit, and it is checked before the request is accepted. Quota is charged per recipient, not per message — cc and bcc count the same as to (cc and bcc). A PTO-approved notice addresses the employee whose request was just approved. If a second contact also has to be told, add that address deliberately and accept that it counts as a second recipient. Do not cc every manager or the whole department by default.
HTTP 200 from POST /emails means the message was accepted and queued. It is not a delivery receipt. The JSON is {"object":"email","id":"..."}. Persist that id next to the leave record if you want to look the message up later from a dashboard session. Do not block the leave service until a mailbox provider confirms delivery.
scheduled_at is a documented ISO 8601 future timestamp if you ever need to hold a notice (scheduled email). For a request that is already approved, send immediately after the approved record is written. If you did schedule a message and the employee should not receive it, POST /emails/:id/cancel cancels an unsent message. Reading, cancelling, and any rescheduling need full_access or a dashboard session. This article does not invent a reschedule request body. Attachments, when you have a genuine reason to include one, use { filename, content, content_type } with content as base64; a PTO-approved notice rarely needs a file.
Errors you should handle in the leave service
Documented send errors use an envelope of { statusCode, name, message }:
- 400 — a missing required field, a
fromdomain that does not belong to your organization, atemplatethat does not exist, or more than 50 recipients on one message. Fix the payload; retrying the same body will fail the same way. - 401 — a missing, malformed, or revoked Bearer key. Check the process environment, not the leave row.
- 429 — you are being rate limited. Back off and retry with the same
Idempotency-Keyso a later attempt cannot send a second notice for the same approval (rate limits, retries).
Treat unknown 5xx responses as retryable with the same key. Log name and message next to the request id; do not log the Bearer key. A practical walk-through is the email API error handling guide. Related operational reading includes email API logs and email API integration.
Delivery is asynchronous — do not poll from the leave service
A 200 from POST /emails means accepted for delivery, not delivered. Reading GET /emails/:id or GET /emails/:id/events needs a full_access key or a dashboard session; a sending_access key cannot do it, and you should not add a polling loop inside the leave backend. Subscribe to a webhook instead, and verify the signature header x-resend-signature as documented in webhook security and signature verification. Event names include accepted, delivered, opened, clicked, bounced, or failed. For a single message you can also use the email delivery status API or the dashboard from a support session. Related reading includes the email webhooks API and transactional email webhooks.
What not to do in this PTO-approved notice
- Do not put the Rovela key in a browser client, a public repository, an employee self-serve form, or a container image.
- Do not invent a Rovela plugin that approves leave or changes balances. Your backend already recorded the approval; Rovela delivers the mail. There is no official client library. Rovela is not changing leave status.
- Do not send this as an “your expense was approved,” “your plan was upgraded,” “your invite was accepted,” or “your appointment is confirmed” template borrowed from another tutorial. The permalink is a leave record the employee can now open, and the recipient is that employee.
- Do not include identity documents, payroll identifiers you would not already show on the leave record, password material, or a dump of private manager notes in the email body. The notice carries a short date range and the permalink.
- Do not send from mailbox SMTP for this. SMTP is for mail apps and mailboxes. An HR or leave backend should use the HTTP API. Inbound mail into a hosted mailbox is a different path, described in the webmail manual; this guide is an outbound PTO-approved notice. If you are migrating an older mailer, see migrate SMTP to the Email API and SMTP ports 25, 465, and 587.
- Do not poll
GET /emails/:idwith asending_accesskey, and do not invent a reschedule body if you later cancel an unsent message.
A compact PTO-approved checklist
- Verify the sending domain and create a
sending_accesskey (Quick Start). - Put
ROVELA_API_KEYandROVELA_FROMin the leave service’s process environment, not in a front-end script. - Record the approved leave first: the employee’s address, a short date range, and the leave permalink they already have.
- Call
POST /emailswith a Node.jshttpsclient (or curl), bothhtmlandtext, areply_toif you want replies in a people-ops inbox, and anIdempotency-Keyscoped to that request id. - Treat HTTP 200 as accepted, not delivered. Persist the returned message id if you need it later.
- Confirm delivery with a signed webhook or from the dashboard.
- If you are comparing providers, the existing pages are Rovela vs Mailgun, vs Amazon SES, vs Postmark, vs SendGrid, vs Resend, and vs Brevo. For the HTTP shape itself, see the transactional email API, the curl sending guide, and the HTTP email API overview. For other notification patterns, see the email notification API guide.