Skip to main content
Live. This area is documented as current, user-reliable behavior.

Goal

Use reusable email templates and OTP challenges without storing plaintext OTP codes in your application.

Prerequisites

  • A StackShift API key
  • A verified sender domain for production sends

Workflow

1
Create a template with name, slug, subject, html, and/or text.
2
Preview with data before sending so missing variables are visible.
3
Send by template slug or id and optionally pin versionId.
4
Use OTP send and verify for challenge-based authentication flows.
5
Inspect OTP challenges by to, purpose, status, cursor, and limit.

Template lifecycle

  • Templates have active, archived, or deleted status.
  • Every create or content update creates template version data with subject, html, text, variables, and versionNumber.
  • A template can expose activeVersion and versions in detail responses.
  • Preview renders subject, html, and text and returns missingVariables.
  • Diagnostics analyze the rendered content for unsafe or unsupported markup, insecure links, missing text and image alternatives, remote-image/read-receipt risk, subject quality, and oversized HTML.
  • Test send returns messageId and status.

Create, preview, and send a template

OTP challenge flow

OTP challenge states

  • Challenge status is pending, verified, expired, failed, or canceled.
  • Responses include attempts, maxAttempts, attemptsRemaining, expiresAt, resendAvailableAt, and optional messageId.
  • Admin-style challenge APIs can list, fetch, and cancel challenges.

Expected result

Template sends are rendered server-side, missing variables fail before queueing, and OTP challenges record status and attempt counts.

Common failures

  • Missing template variables in data.
  • Sending with a deleted or archived template.
  • Verifying an OTP after expiration, cancellation, too many attempts, or wrong challenge context.

Send email

Send a single outbound email with the official SDK or REST API, then inspect the message, attempts, logs, and timeline.

Streams, audiences, and campaigns

Separate transactional and broadcast traffic, retain consent evidence, and send template-backed campaigns with unsubscribe protection.

Diagnostics, analytics, and exports

Diagnose rendered templates, measure Mail operations, and create encrypted recipient-level delivery exports.

Events, webhooks, and timelines

List mail events, inspect per-message timelines, subscribe webhooks, rotate secrets, retry deliveries, and verify webhook signatures.