T
transmit.

API Reference

Send transactional emails programmatically. API endpoints, authentication, request/response formats, and code examples.

Send transactional emails programmatically with Transmit's REST API.

Authentication

Generate an API key from Settings → API Keys in your dashboard.

  1. Click Create API Key
  2. Copy your key (starts with pm_live_ for production)

Never expose API keys in client-side code or public repositories.

Send Email

POST https://api.xmit.sh/email/send
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Request Parameters

ParameterTypeRequiredDescription
tostring or arrayYesRecipient email(s)
subjectstringYesEmail subject line
fromstring*Sender email address
senderIdstring*Pre-configured sender ID
htmlstring**HTML body content
templateIdstring**Use a saved template
textstringNoPlain text fallback
fromNamestringNoDisplay name for sender
replyTostringNoReply-to address
ccstring or arrayNoCarbon copy recipients
bccstring or arrayNoBlind carbon copy recipients
variablesobjectNoTemplate variables
attachmentsarrayNoFile attachments (base64-encoded, see below)
metadataobjectNoCustom data returned in webhooks
headersobjectNoCustom email headers
inReplyTostringNoMessage-ID for threading
referencesstringNoMessage-ID chain for threading

* Either from or senderId is required ** Either html or templateId is required

Example Request

curl -X POST https://api.xmit.sh/email/send \
  -H "Authorization: Bearer pm_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "user@example.com",
    "from": "hello@yourapp.com",
    "subject": "Welcome to YourApp",
    "html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>"
  }'

Using a Template

curl -X POST https://api.xmit.sh/email/send \
  -H "Authorization: Bearer pm_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "user@example.com",
    "senderId": "snd_xxxxx",
    "subject": "Your order has shipped",
    "templateId": "tmpl_xxxxx",
    "variables": {
      "firstName": "John",
      "orderId": "ORD-12345"
    }
  }'

With Attachments

Each attachment object has three fields:

FieldTypeRequiredDescription
filenamestringYesFile name shown to recipient
contentstringYesFile contents, base64-encoded
contentTypestringNoMIME type (e.g., application/pdf, image/png)
curl -X POST https://api.xmit.sh/email/send \
  -H "Authorization: Bearer pm_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "user@example.com",
    "from": "hello@yourapp.com",
    "subject": "Your invoice",
    "html": "<p>Please find your invoice attached.</p>",
    "attachments": [
      {
        "filename": "invoice.pdf",
        "content": "JVBERi0xLjQKMS...",
        "contentType": "application/pdf"
      }
    ]
  }'

To base64-encode a file:

# macOS / Linux
base64 -i invoice.pdf | tr -d '\n'

# Node.js
fs.readFileSync("invoice.pdf").toString("base64")

# Python
import base64; base64.b64encode(open("invoice.pdf", "rb").read()).decode()

Response

Success (200):

{
  "success": true,
  "messageId": "msg_1a2b3c4d5e6f"
}

Error (4xx):

{
  "error": "Recipient (to) is required"
}

Limits

LimitValue
Recipients per request50 (to + cc + bcc combined)
Per attachment5 MB (decoded size)
Total attachments7 MB (decoded size)

Error Codes

StatusMeaning
200Success
400Validation error (missing/invalid fields)
401Invalid or missing API key
403Limit exceeded or feature not available
404Resource not found (sender, template)
  • Templates — Create reusable email templates
  • Webhooks — Track delivery and engagement
  • Senders — Manage sender identities