Skip to main content

Overview

The Email Preview API allows you to generate screenshots of your email HTML rendered on real devices and email clients. Test how your emails will look across Gmail, Outlook, iPhone, Android, and 40+ other platforms before sending.
Credit Cost: Each email preview request costs 2 credits. Make sure you have sufficient credits before generating previews.

Features

  • 40+ Email Clients & Devices: Test across Gmail, Outlook, Apple Mail, Yahoo, and more
  • Real Device Rendering: Screenshots from actual devices, not simulators
  • Mobile & Desktop: Preview on iPhone, Android, iPad, desktop clients
  • Fast Generation: Results typically ready in 60-90 seconds
  • High-Quality Screenshots: Full-resolution images of your email renders

How It Works

  1. Create Preview: Send your email HTML to the preview endpoint
  2. Processing: Your email is rendered on real devices (60-90 seconds)
  3. Get Results: Retrieve high-quality screenshots for each device

Pricing

Credit Usage

Each preview request costs 2 credits, regardless of how many devices you select. The default is 10 common devices, but you can specify custom devices from our list of 40+ supported platforms.

Quick Start

1. Create a Preview

curl -X POST https://api.migma.ai/v1/emails/previews \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<html><body><h1>Test Email</h1></body></html>",
    "subject": "My Email Preview",
    "name": "Homepage Newsletter"
  }'
Response:
{
  "success": true,
  "data": {
    "previewId": "preview_abc123",
    "status": "processing",
    "creditsCharged": 2
  }
}

2. Check Preview Status

curl -X GET https://api.migma.ai/v1/emails/previews/preview_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"
Response (Processing):
{
  "success": true,
  "data": {
    "previewId": "preview_abc123",
    "status": "processing",
    "progress": 45
  }
}
Response (Complete):
{
  "success": true,
  "data": {
    "previewId": "preview_abc123",
    "status": "completed",
    "previews": [
      {
        "device": "gmail-chrome",
        "imageUrl": "https://cdn.migma.ai/previews/...",
        "platform": "desktop"
      },
      {
        "device": "iphone-14-pro",
        "imageUrl": "https://cdn.migma.ai/previews/...",
        "platform": "mobile"
      }
    ]
  }
}

3. Get Supported Devices

curl -X GET https://api.migma.ai/v1/emails/devices/supported \
  -H "Authorization: Bearer YOUR_API_KEY"

Request Parameters

ParameterTypeRequiredDescription
htmlstringYesEmail HTML content to preview
subjectstringNoEmail subject line (default: “Email Preview”)
devicesarrayNoSpecific devices to render on (defaults to 10 common devices)
namestringNoCustom name for the preview

Default Devices

When you don’t specify devices, previews are generated on these 10 platforms:
  • Gmail (Chrome Desktop)
  • Gmail (Android App)
  • Outlook 2016 (Windows)
  • Outlook.com (Browser)
  • Apple Mail (macOS)
  • Apple Mail (iPhone 14)
  • Yahoo Mail (Browser)
  • Samsung Email (Android)
  • Outlook iOS App
  • Gmail iOS App

Custom Device Selection

You can specify exactly which devices to use:
curl -X POST https://api.migma.ai/v1/emails/previews \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<html>...</html>",
    "devices": [
      "gmail-chrome",
      "outlook-2016",
      "iphone-14-pro",
      "gmail-android"
    ]
  }'
Get the full list of 40+ supported devices using the /v1/emails/devices/supported endpoint.

Response Statuses

StatusDescription
processingPreview is being generated
completedAll screenshots are ready
failedPreview generation failed

Common Use Cases

Quality Assurance

Test emails before sending campaigns to ensure they render correctly across all platforms.

Client Approval

Generate previews to show clients how emails will look on different devices.

Responsive Testing

Verify that your email design is mobile-friendly and responsive.

Cross-Platform Compatibility

Identify rendering issues specific to certain email clients.

Best Practices

Ensure your email HTML is valid and uses email-safe CSS. Avoid modern CSS features that may not be supported in all email clients.
Focus on the email clients your audience actually uses. Check your email analytics to see which platforms are most common.
Each preview costs 2 credits. Plan your testing workflow to minimize unnecessary preview generations.
Store preview images for reference. You can reuse them for client presentations without regenerating.

Error Handling

Insufficient Credits

{
  "success": false,
  "error": "Insufficient credits. This operation requires 2 credits.",
  "code": "INSUFFICIENT_CREDITS"
}
Check your credit balance before generating previews. You can view your balance in your account dashboard or via the API.

Invalid HTML

{
  "success": false,
  "error": "Invalid HTML content provided",
  "code": "INVALID_HTML"
}

Limitations

  • Processing Time: Previews typically take 60-90 seconds to generate
  • HTML Size: Maximum HTML size is 500KB
  • Rate Limits: Subject to your plan’s rate limits
  • Image Assets: External images must be publicly accessible

Need Help?