Email API

Simple, powerful email sending API with support for attachments and custom headers.

Quick Start

curl -X POST 'https://api.shoutbox.net/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "[email protected]",
    "to": "[email protected]",
    "subject": "Hello World",
    "html": "<h1>Welcome!</h1>"
  }'

Authentication

All API requests require an API key passed in the Authorization header:

Authorization: Bearer key_XXXXXXXXX

Basic Request Structure

FieldTypeRequiredDescription
fromstringYesSender email address
tostringYesRecipient email address(es)
subjectstringYesEmail subject line
htmlstringYesHTML content of the email
namestringNoSender name
reply_tostringNoReply-to email address

Recipients

Multiple Recipients

You can send to multiple recipients by separating email addresses with commas:

curl -X POST 'https://api.shoutbox.net/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "[email protected]",
    "to": "[email protected],[email protected]",
    "subject": "Team Update",
    "html": "<h1>Important Announcement</h1>"
  }'

Named Recipients

You can include recipient names using the format Name <[email protected]>:

curl -X POST 'https://api.shoutbox.net/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "[email protected]",
    "to": "John Doe <[email protected]>,Jane Smith <[email protected]>",
    "subject": "Team Meeting",
    "html": "<h1>Meeting Invitation</h1>"
  }'

Reply-To Address

Set a different reply-to address using the reply_to field:

curl -X POST 'https://api.shoutbox.net/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "[email protected]",
    "reply_to": "[email protected]",
    "to": "[email protected]",
    "subject": "Support Ticket Update",
    "html": "<h1>Your ticket has been updated</h1>"
  }'

You can also include a name in the reply-to address:

curl -X POST 'https://api.shoutbox.net/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "[email protected]",
    "reply_to": "Support Team <[email protected]>",
    "to": "[email protected]",
    "subject": "Support Ticket Update",
    "html": "<h1>Your ticket has been updated</h1>"
  }'

Attachments

Complete Example with Attachment

curl -X POST 'https://api.shoutbox.net/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "[email protected]",
    "name": "Reports Team",
    "to": "John Smith <[email protected]>",
    "subject": "Monthly Report - January 2024",
    "html": "<h1>Monthly Report</h1><p>Please find your report attached.</p>",
    "attachments": [
      {
        "content": "VGhpcyBpcyBhbiBhdHRhY2htZW50IQo=",
        "filename": "january_report.pdf"
      },
      {
        "content": "SGVsbG8gV29ybGQh",
        "filename": "data.xlsx"
      }
    ]
  }'

Multiple Attachments with Headers

curl -X POST 'https://api.shoutbox.net/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "[email protected]",
    "name": "Document System",
    "to": "Jane Doe <[email protected]>,[email protected]",
    "reply_to": "Support <[email protected]>",
    "subject": "Your Requested Documents",
    "html": "<h1>Documents Ready</h1><p>Please find your requested documents attached.</p>",
    "attachments": [
      {
        "content": "VGhpcyBpcyBhbiBhdHRhY2htZW50IQo=",
        "filename": "document1.pdf"
      },
      {
        "content": "SGVsbG8gV29ybGQh",
        "filename": "document2.pdf"
      }
    ],
    "headers": {
      "X-Priority": "1",
      "X-Document-Type": "confidential",
      "List-Unsubscribe": "<https://yourdomain.com/unsubscribe>",
      "X-Tracking-ID": "doc-123456"
    }
  }'

Custom Headers

Complete Example with Headers

curl -X POST 'https://api.shoutbox.net/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "[email protected]",
    "name": "Newsletter Team",
    "to": "Subscriber <[email protected]>",
    "reply_to": "Newsletter Support <[email protected]>",
    "subject": "Your Weekly Newsletter",
    "html": "<h1>This Week'\''s Updates</h1><p>Latest news and updates...</p>",
    "headers": {
      "List-Unsubscribe": "<https://yourdomain.com/unsubscribe>",
      "List-Unsubscribe-Post": "List-Unsubscribe=One-Click",
      "X-Campaign-ID": "newsletter_2024_01",
      "X-Mailer": "ShoutboxAPI/1.0",
      "Precedence": "bulk",
      "X-Auto-Response-Suppress": "OOF, AutoReply"
    }
  }'

Security Best Practices

Follow these security guidelines to ensure safe API usage:

  1. Never share your API key publicly
  2. Use environment variables to store your API key
  3. Implement proper error handling
  4. Validate email addresses before sending
  5. Use HTTPS for all API calls
  6. Base64 encode attachments properly
  7. Keep attachment sizes reasonable

Rate Limits

Please contact support for information about rate limits for your API key.

Support

For additional support or questions, please contact our support team.