API Documentation

MockSend API

Comprehensive email and SMS testing service that captures all messages for inspection without sending real communications.

Key Features

  • Email Testing

    Send test emails without delivery. Perfect for development and testing.

  • SMS Testing

    Test SMS messages with Twilio-compatible API endpoints.

  • Secure

    Multiple authentication methods with API key management.

  • Fast Setup

    Get started in minutes with magic link authentication.

Getting Started

1Create an Account

Visit the MockSend Dashboard and create an account using magic link authentication.

Open Dashboard
2Create an Organization

Organizations allow you to manage team access and separate different projects or environments.

3Generate API Credentials

Navigate to your organization and create credentials:

  • Email Credentials: Generates an API token for email services
  • SMS Credentials: Generates an API token and Account SID for SMS services
4Start Testing

Use the generated credentials to send test messages through our API endpoints.

Authentication

MockSend supports multiple authentication methods to accommodate different integration patterns:

API Token in Authorization Header
Authorization: Bearer api_your_token_here
API Key Header
Authorization: API-Key api_your_token_here
# OR
X-API-Key: api_your_token_here
# OR
API-Key: api_your_token_here
Basic Authentication (SMS only)
For Twilio-style compatibility
Authorization: Basic base64(account_sid:api_token)

Email API

POST/api/v1/email/send

Send a single email message

Headers

Content-Type: application/json
Authorization: Bearer api_your_token_here

Request Body

{
  "to": "[email protected]",
  "from": "[email protected]",
  "subject": "Your email subject",
  "html": "<h1>HTML content</h1><p>Rich text email content</p>",
  "text": "Plain text version of your email content",
  "cc": ["[email protected]", "[email protected]"],
  "bcc": ["[email protected]"],
  "replyTo": "[email protected]"
}

Response

{
  "id": "msg_abc123def456",
  "status": "queued",
  "to": "[email protected]",
  "from": "[email protected]",
  "subject": "Your email subject",
  "created_at": "2024-01-15T10:30:00Z"
}

cURL Example

curl -X POST http://localhost:3000/api/v1/email/send \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer api_your_token_here" \
  -d '{
    "to": "[email protected]",
    "from": "[email protected]",
    "subject": "Welcome to Our Service",
    "html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
    "text": "Welcome! Thanks for signing up."
  }'

SMS API

MockSend provides two SMS API formats for maximum compatibility:

POST/api/v1/sms/send

Generic SMS API endpoint

Headers

Content-Type: application/json
Authorization: Bearer api_your_token_here
X-Account-Sid: AC_your_account_sid_here

Request Body

{
  "to": "+1234567890",
  "from": "+0987654321",
  "body": "Your SMS message content here",
  "mediaUrl": "https://example.com/image.jpg"
}

Response

{
  "sid": "SM_abc123def456",
  "account_sid": "AC_your_account_sid",
  "to": "+1234567890",
  "from": "+0987654321",
  "body": "Your SMS message content here",
  "status": "queued",
  "direction": "outbound-api",
  "date_created": "2024-01-15T10:30:00Z",
  "price": null,
  "price_unit": "USD",
  "uri": "/Messages/SM_abc123def456"
}
POST/api/v1/accounts/{AccountSid}/messages

Twilio-compatible SMS API endpoint

Authentication

# Basic Auth with Account SID as username, API Token as password
Authorization: Basic base64(AC_your_sid:api_your_token)

cURL Example

curl -X POST http://localhost:3000/api/v1/accounts/AC_your_sid/messages \
  -u "AC_your_sid:api_your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "To": "+1234567890",
    "From": "+0987654321",
    "Body": "Test message from MockSend"
  }'

Error Handling

HTTP Status Codes
200 OKRequest successful
400 Bad RequestInvalid request parameters
401 UnauthorizedInvalid or missing API credentials
429 Too Many RequestsRate limit exceeded
Error Response Format
{
  "error": {
    "code": "invalid_parameter",
    "message": "The 'to' field is required",
    "param": "to",
    "type": "invalid_request_error"
  }
}

Rate Limits

Current Limits
MockSend implements rate limiting to ensure fair usage
Email API100 requests/minute
SMS API100 requests/minute
Burst allowance10 requests/second

Rate Limit Headers

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1642234567