Skip to content
MailForge

Documentation

The MailForge API is plain JSON over HTTPS. Base URL: https://mailforge.softunify.com/api/v1

Quickstart

1. Add and verify your domain. 2. Create an API key with the emails:send scope. 3. Send:

curl -X POST "https://mailforge.softunify.com/api/v1/emails" \
  -H "Authorization: Bearer $MAILFORGE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1042" \
  -d '{
    "from": "Acme <receipts@acme.com>",
    "to": "anna@northwind.io",
    "subject": "Your receipt #1042",
    "html": "<p>Thanks for your order, Anna.</p>"
  }'

Authentication

Send your API key as a bearer token. Keys start with mf_ and are shown once, when you create them.

Authorization: Bearer mf_your_api_key

Each key has scopes. A request outside its scopes is refused with 403.

ScopeAllows
emails:sendSend email by API, SMTP or MCP
emails:readRead emails and their events
templates:manageCreate and change templates
domains:manageAdd, verify and remove domains
webhooks:manageManage webhook endpoints
suppressions:manageRead and change the suppression list
marketing:manageContacts, lists, campaigns, automations
outreach:manageMailboxes, prospects, sequences, replies
verifyEmail verification
deliverability:readDeliverability reports

Errors

Errors use the HTTP status code and the same JSON shape:

{ "error": { "code": "validation_error", "message": "to: Invalid email" } }
StatusMeaning
401Missing or invalid API key
403The key lacks the scope, or sending is paused
404Not found in your account
409Conflict, for example a domain already in use
422The request body is invalid
429Too many requests; retry after a pause

Domains

You send from your own domain. After you add it, MailForge shows these records. Sending starts once the required ones are found; they are re-checked every 6 hours.

TypeNameValue
TXT_mailforge.example.commailforge-verify=…
TXTmf1._domainkey.example.comv=DKIM1; k=rsa; p=…
MX 10bounce.example.comrelay.softunify.com
TXTbounce.example.comv=spf1 include:_spf.mail.softunify.com -all
TXT_dmarc.example.comv=DMARC1; p=none; … (recommended)

Send an email

POST /v1/emails — needs emails:send. Give html, text or a template_id.

FieldTypeNotes
fromstringRequired. "Name <you@your-domain.com>" on a verified domain
tostring | string[]Required. Up to 50 addresses
cc, bccstring | string[]Optional
reply_tostringOptional
subjectstringRequired unless the template has one
html, textstringThe body
template_iduuidUse a saved template
variablesobjectValues for {{placeholders}}
headersobjectExtra headers
tagsstring[]Your labels, returned in events
priority"high" | "normal"high for codes and alerts
scheduled_atISO 8601Up to 30 days ahead
attachmentsarray{ filename, content (base64), content_type }, 10 MB total

Add an Idempotency-Key header to retry safely. The response:

{ "id": "6f0c2d8e-…", "status": "queued", "suppressed": [], "duplicate": false }

Recipients on your suppression list are listed in suppressed and skipped. POST /v1/emails/batch takes an array of up to 100 of the same objects.

Read and cancel

GET /v1/emails/:id returns the email with its delivery events. POST /v1/emails/:id/cancel stops a scheduled email that has not been sent.

Templates

Save a subject and body with {{name}} placeholders, then send with template_id and variables. POST /v1/templates/:id/render previews the result.

SMTP

Use the relay from any app that sends over SMTP. STARTTLS is required.

Host      api.mail.softunify.com
Port      2525
Security  STARTTLS
Username  apikey
Password  an API key with emails:send

Webhooks

Add an HTTPS endpoint and choose events: email.sent, email.delivered, email.deferred, email.bounced, email.complained, email.failed, email.suppressed. Each delivery is a POST:

{ "type": "email.delivered", "created_at": "…", "data": { "email_id": "…", "recipient": "anna@northwind.io" } }

Answer with any 2xx within 10 seconds. Failed deliveries are retried 8 times over about two days. Check the mf-signature header before you trust a request:

import { createHmac, timingSafeEqual } from "node:crypto";

// header: mf-signature: t=1767225600,v1=<hex>
function verify(header, rawBody, secret) {
  const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const want = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
  return fresh && timingSafeEqual(Buffer.from(want), Buffer.from(v1));
}

Verification

POST /v1/verify with { "email": "…" } checks one address. POST /v1/verify/bulk with { "emails": [...] } starts a job of up to 50,000 addresses; set suppress_invalid to add invalid ones to your suppression list. Every result has a status (valid, invalid, risky, unknown), an action (send, care, remove), a score and a typo suggestion when there is one.

MCP server

Connect any MCP client over Streamable HTTP. The key's scopes decide which of the 30 tools the agent can use.

URL    https://mailforge.softunify.com/api/v1/mcp
Auth   Authorization: Bearer mf_your_api_key

Tools include send_email, list_emails, verify_email, verify_list, create_campaign, spam_check_campaign, import_prospects, list_replies, get_deliverability and add_suppression.

All endpoints

Emails

  • POST /v1/emails
  • POST /v1/emails/batch
  • GET /v1/emails
  • GET /v1/emails/:id
  • POST /v1/emails/:id/cancel

Templates

  • GET /v1/templates
  • POST /v1/templates
  • GET /v1/templates/:id
  • PUT /v1/templates/:id
  • DELETE /v1/templates/:id
  • POST /v1/templates/:id/render

Domains

  • GET /v1/domains
  • POST /v1/domains
  • GET /v1/domains/:id
  • POST /v1/domains/:id/verify
  • DELETE /v1/domains/:id

Webhooks

  • GET /v1/webhooks
  • POST /v1/webhooks
  • PATCH /v1/webhooks/:id
  • DELETE /v1/webhooks/:id
  • POST /v1/webhooks/:id/test
  • GET /v1/webhooks/:id/deliveries

Suppressions

  • GET /v1/suppressions
  • POST /v1/suppressions
  • DELETE /v1/suppressions/:id

Verification

  • POST /v1/verify
  • POST /v1/verify/bulk
  • GET /v1/verify/jobs
  • GET /v1/verify/jobs/:id
  • GET /v1/verify/jobs/:id/results
  • POST /v1/verify/jobs/:id/cancel

Marketing

  • /v1/contacts
  • /v1/contacts/import
  • /v1/lists
  • /v1/campaigns
  • /v1/campaigns/:id/test
  • /v1/campaigns/:id/schedule
  • /v1/campaigns/:id/spam-check
  • /v1/automations

Outreach

  • /v1/outreach/mailboxes
  • /v1/outreach/prospects
  • /v1/outreach/prospects/import
  • /v1/outreach/sequences
  • /v1/outreach/sequences/:id/enroll
  • /v1/outreach/replies

Deliverability

  • GET /v1/deliverability
  • POST /v1/deliverability/content-check