POST
/send
Send an email
Sends an email directly without a stored template. Resolves synchronously or queues the email depending on tenant delivery mode. Requires the tenant API key to have the sendByEmail property set to true or 1; returns 403 otherwise.
Request
type SendEmailRequest = {
subject: string;
htmlBody: string;
to: EmailRecipient[];
cc?: EmailRecipient[];
bcc?: EmailRecipient[];
attachments?: EmailAttachment[];
images?: EmailImage[];
};Response
type SendEmailResponse = {
emailId: number;
emailCode: string;
status: EmailStatus;
provider: string;
};
POST
/send/:templateCode
Send a templated email
Loads and renders a stored template with supplied parameters, then sends. Rendered content is stored in audit so future template edits don't affect sent records.
Request
type SendTemplateEmailRequest = {
to: EmailRecipient[];
cc?: EmailRecipient[];
bcc?: EmailRecipient[];
attachments?: EmailAttachment[];
images?: EmailImage[];
parameters: Record<string, unknown>;
};Response
type SendTemplateEmailResponse = {
emailId: number;
emailCode: string;
templateCode: string;
status: EmailStatus;
provider: string;
};
POST
/template/render
Render template preview
Renders a template without sending. Use id or slug for stored templates, or template for inline text. Useful for validating output before sending.
Request
type RenderTemplateRequest = {
id?: number;
slug?: string;
template?: string;
data: Record<string, unknown>;
options?: {
escapeHtml?: boolean;
removeSpaceBeforePunctuation?: boolean;
removeEmptyLines?: boolean;
collapseWhitespace?: boolean;
};
};Response
type RenderTemplateResponse = {
source: 'stored' | 'inline';
templateId?: number;
templateCode?: string;
rendered: string;
renderedSubject?: string;
renderedHtml?: string;
};