Skip to main content
POST
/
v1
/
emails
/
previews
Node.js SDK
import Migma from 'migma';

const migma = new Migma('YOUR_API_KEY');

const { data, error } = await migma.previews.create({
  html: '<html>...</html>',
  subject: 'My Email Preview'
});

// Or wait for completion:
// const result = await migma.previews.createAndWait({ ... });
{
  "success": true,
  "data": {
    "previewId": "<string>",
    "status": "processing",
    "name": "<string>",
    "subject": "<string>",
    "devices": [
      "<string>"
    ],
    "metadata": {
      "requestedDevices": 123,
      "completedDevices": 123,
      "failedDevices": 123,
      "estimatedCompletionTime": 123
    }
  }
}

Authorizations

Authorization
string
header
required

API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → API Integration.

Body

application/json
html
string
required

Email HTML content to preview

subject
string
default:Email Preview

Email subject line (for display purposes)

devices
string[]

Specific devices to render on (optional, defaults to 10 common devices)

name
string

Custom name for the preview

Response

Preview creation started

success
boolean
data
object