MailPi Developer Documentation
Dispatch high-deliverability transactional emails, schedule future broadcasts, isolate client workspaces, and verify cryptographically signed webhook event streams with our official SDKs.
Quickstart: Send an Email
Use your API key from the Console to send your first email:
import { MailPi } from "@mailpi/node";
const mailpi = new MailPi(process.env.MAILPI_API_KEY);
const { data, error } = await mailpi.emails.send({
from: "notifications@yourdomain.com",
to: ["user@example.com"],
subject: "Welcome to our startup!",
html: "<p>Hello from MailPi TypeScript SDK!</p>",
});
if (error) {
console.error("Dispatch error:", error);
} else {
console.log("Sent successfully, message ID:", data?.id);
}MailPi Developer CLI (`mailpi`)
v1.0.0The official MailPi CLI provides a fast command-line workflow to authenticate, test email rendering in the terminal, view virtual sandboxes, and inspect live AWS SES quota consumption without opening the web console.
Run instantly via npx with zero installation or install globally:
Included automatically when installing the official Python client:
API Keys & Environments
MailPi distinguishes between production email dispatches and development testing via distinct API key prefixes:
Dispatches real emails to external mailboxes with 2048-bit DKIM, SPF, and DMARC alignment.
Simulates delivery with 0 SES quota consumption. Captured directly into your dashboard virtual test inbox.
Virtual Sandbox Mode
Develop and run automated CI/CD test suites without burning your sending limits or sending spam to test emails. Initialize with a mp_test_... key or switch the dashboard environment toggle to Sandbox.
Node.js & TypeScript SDK (`@mailpi/node`)
Features built-in TypeScript definitions, retry logic, scheduled sending, and cryptographic webhook verification helpers.
Python SDK (`mailpi`)
Lightweight standard-library-based client with zero third-party runtime dependencies, supporting Python 3.8 through 3.14+.
Scheduled Email Sending
Pass an ISO 8601 string in the scheduled_at parameter to queue emails for future dispatch up to 30 days in advance:
Idempotency Keys & Safe Retries
Pass the Idempotency-Key header to prevent duplicate email dispatches during connection drops or automated worker retries:
Cryptographically Signed Webhooks
Every webhook HTTP POST callback contains the X-MailPi-Signature: t=timestamp,v1=signature header signed using HMAC-SHA256 with your endpoint secret (whsec_...).
Agency Sub-Accounts & Client Workspaces
Isolate client sender reputations, API keys, and monthly quotas. Send on behalf of any child sub-account by including the X-Subaccount-Id header:
Interactive OpenAPI 3.0 Documentation
Explore and test all endpoints directly in Swagger UI with live schemas.