API integration
Send email into an inbox programmatically with an API key

Prefer HTTP over SMTP? You can capture email in an inbox by POSTing it to the MailSandbox API. This is handy for tooling, tests, or apps that build messages themselves.

Authentication

Each inbox has its own API key (prefixed with "ms_"), found on the inbox's Configuration screen. Send it with every request in either of these headers:

X-API-Key: ms_your_inbox_api_key

# or, equivalently:
Authorization: Bearer ms_your_inbox_api_key

The API key identifies the inbox, so every message you post is captured in that inbox.

Send an email

POST a JSON body to the emails endpoint:

curl -X POST https://mailsandbox.com/api/emails \
  -H "X-API-Key: ms_your_inbox_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "Welcome to Acme",
    "from_email": "hello@acme.test",
    "from_name": "Acme",
    "to_emails": ["jane@example.com"],
    "body": "<h1>Hello Jane</h1>"
  }'

Fields:

  • subject — the email subject (required)
  • from_email — sender address (required); from_name — sender name (optional)
  • to_emails — array of recipient addresses (required)
  • cc_emails, bcc_emails — optional arrays of addresses
  • body — the HTML body (required)
  • headers — optional object of extra headers
Responses

A successful request returns the created message:

{
  "message": "Email created successfully",
  "data": {
    "id": 123,
    "subject": "Welcome to Acme",
    "inbox_id": 7,
    "created_at": "2026-07-18T10:00:00Z"
  }
}
  • 401 — the API key is missing or invalid
  • 422 — validation failed; the response lists the errors

Captured messages appear in the inbox immediately, ready to preview, inspect and share.