Skip to main content
POST
/
v1
/
emails
/
{artifactId}
/
compile
Node.js SDK
import Migma from 'migma';

const migma = new Migma('YOUR_API_KEY');

const { data, error } = await migma.emails.compile('ARTIFACT_ID', {
  source: draftMigmaEmailSource
});
{
  "success": true,
  "data": {
    "artifactId": "<string>",
    "html": "<string>",
    "warnings": [
      "<string>"
    ],
    "metadata": {}
  },
  "error": "<string>"
}

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.

Path Parameters

artifactId
string
required

Email artifact ID returned in generation status result.emails[].artifactId or shown in Publish -> Send via API.

Pattern: ^[0-9a-fA-F]{24}$

Body

application/json
source
string

Optional Migma Email source override. If omitted, compiles the saved artifact source.

vars
object

Preview variables used while compiling.

lang
string

Preview locale used while compiling.

Response

Email artifact compiled

success
boolean
required
data
object
error
string | null