Documentation & Reference

Vernal Developer Platform

Integrate Vernal with your application, run an email preflight, and track job status.

Quickstart

Set VERNAL_API_KEY on your server before running the quickstart. The API origin is https://api.vernalmail.dev. The SDK install commands require registry publication. For a release candidate, install its approved SDK archive.

1. Install Package

npm install @vernal-systems/sdk

2. Run a Preflight

import { Vernal } from "@vernal-systems/sdk";

const vernal = new Vernal({
  apiKey: process.env.VERNAL_API_KEY
});

const { data, error } = await vernal.emails.send({
  to: "developer@example.com",
  subject: "Vernal preflight",
  text: "This message checks the integration without sending email.",
  dryRun: true
}, { idempotencyKey: "first-preflight" });

if (error) {
  throw error;
}

console.log("Preflight:", data.jobId, "Score:", data.lint?.score);

Use one Idempotency-Key with 1–128 ASCII letters, digits, dots, underscores, tildes or hyphens. The key is case-sensitive and scoped to your tenant and operation. With durable dispatch, a keyed request returns HTTP 202 and a job ID. After a timeout or a retryable 429 or 503, retry with the same key and payload. Honor Retry-After when present. The receipt includes the minimum 24-hour key expiry. The gateway retains unresolved keys beyond that expiry. While the key is reserved, reusing it with a changed payload returns 409. Check the original job before sending again after expiry or when submission is uncertain. Requests without a key are independent submissions.

Send Lifecycle

With durable dispatch enabled, poll the receipt's statusUrl for current progress. For a batch, inspect each item's job ID and status.

queued, preparing, submitting
The gateway is holding, preparing, or handing the job to the relay.
validated
The dry run completed. It used zero sending quota and made no relay submission.
provider_accepted
The relay accepted the message. Check recipient feedback separately when available.
uncertain
The gateway could not confirm the relay's response. Keep the original job ID for reconciliation.
rejected, failed
The batch item was rejected at admission or the admitted job ended in failure.

Live admission reserves one sending-quota unit per admitted envelope recipient. A matching retry uses the original reservation. The relay has a separate shared budget, so accepted jobs can wait for capacity. Customer webhook delivery is outside the supported API.

Terminal history and its usage records become eligible for cleanup 90 days after the latest of admission, the terminal job update, or recorded recipient feedback. Cleanup retains unresolved jobs and active keys. Suppressions have their own lifecycle.

Built-In Dynamic Templates

Instead of designing custom HTML from scratch or dealing with broken mobile rendering, Vernal provides pre-compiled, bulletproof responsive templates. Both HTML and plain-text parts are generated automatically.

otp

One-time security passwords, 2FA verification codes, and expiration countdowns.

receipt

Itemized transaction receipts, bills of lading, and freight invoices.

alert

System infrastructure notifications with severity badges (info, warning, critical).

Template Usage Examples

await vernal.emails.send({
  to: "developer@vernalmail.dev",
  template: "otp",
  templateData: {
    code: "482019",
    appName: "Bank of Vernal Vault",
    expiresInMinutes: 5
  },
  headers: {
    "X-Vernal-Weight": "50lb",
    "X-Parcel-Post": "1916"
  }
});

Deliverability Linter & Rate Pacing

The Vernal linter runs before every email is queued or dispatched. If a message scores below 70 (Grade F), it is rejected to safeguard your domain reputation.

Rule CodeSeverityDescription
MISSING_TEXT_PARTerror (-25)Email has HTML body but lacks a plain-text fallback part.
BULK_UNSUBSCRIBE_MISSINGerror (-20)Marketing/bulk emails without RFC 8058 List-Unsubscribe header.
ALL_CAPS_SUBJECTwarning (-10)Subject line contains excessive capitalization (>70%).
SPAM_TRIGGER_WORDSwarning (-15)Subject or body contains aggressive spam keywords.
SUSPICIOUS_LINKSwarning (-10)Links targeting raw IP addresses or known URL shorteners.

Sending capacity

Live admission reserves the tenant's recipient quota. A job can stay queued when the shared transport reaches its rolling 24-hour recipient budget. Use the original job ID to check status. Dry runs use neither recipient budget and never contact the provider.

Custom Domains & Cryptographic DKIM

Vernal provides cryptographic isolation for every client domain. When you register a domain in the console or via POST /v1/domains, Vernal generates a dedicated 2048-bit RSA key pair.

1. TXT DKIM Record

Host: vernal._domainkey.vernalmail.dev
Value: v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BA...

2. TXT SPF Record

Host: vernalmail.dev
Value: v=spf1 include:_spf.google.com ~all

3. TXT DMARC Record

Host: _dmarc.vernalmail.dev
Value: v=DMARC1; p=none; adkim=r; aspf=r; fo=1; pct=100

REST API Reference

All endpoints accept and return JSON. Authenticate by providing your tenant API key in the Authorization: Bearer <key> header. Custom headers like X-Vernal-Weight and X-Parcel-Post are preserved throughout the dispatch pipeline.

GET /v1/health
Auth: None Checks whether the gateway endpoint is responding.
POST /v1/send
Auth: Bearer Key Validates preflight deliverability, renders templates, and enqueues/dispatches email.
POST /v1/send/batch
Auth: Bearer Key Enqueues up to 100 email dispatches in a single HTTP request.
GET /v1/domains
Auth: Bearer Key Lists registered custom sender domains with their DKIM, SPF, and DMARC status.
POST /v1/domains
Auth: Bearer Key Creates a custom domain and generates dedicated 2048-bit RSA DKIM key pairs.
POST /v1/domains/:id/verify
Auth: Bearer Key Performs live DNS-over-HTTPS queries to verify published DNS TXT DKIM records.
DELETE /v1/domains/:id
Auth: Bearer Key Deletes a registered custom domain and revokes its DKIM signing key.
GET /v1/messages
Auth: Bearer Key Lists recently sent dispatches, delivery statuses, attempt counts, and scores.
GET /v1/messages/:id
Auth: Bearer Key Fetches granular delivery audit trail and preflight findings for a specific message.