Skip to main content
POST
/
v1
/
sending
import Migma from 'migma';

const migma = new Migma('YOUR_API_KEY');

// Send using a conversationId (resolves template and projectId automatically)
const { data, error } = await migma.sending.send({
  recipientType: 'email',
  recipientEmail: 'recipient@example.com',
  from: 'hello@yourbrand.com',
  fromName: 'Your Brand',
  subject: 'Hello!',
  conversationId: 'CONVERSATION_ID'
});
{
  "success": true,
  "data": {
    "id": "<string>",
    "provider": "<string>",
    "status": "<string>",
    "sentCount": 123,
    "message": "<string>"
  },
  "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.

Body

application/json
recipientType
enum<string>
required

Type of recipient. 'email' for single send, 'audience' or 'segment' for segment-based batch sends, 'tag' for tag-based batch sends.

Available options:
email,
audience,
segment,
tag
from
string<email>
required

Sender email address (must be from a verified domain)

fromName
string
required

Sender display name

subject
string
required
recipientId
string

Required for audience/segment/tag sends. The segment or tag ID.

recipientEmail
string<email>

Required for single email sends.

replyTo
string<email>
template
string

Email HTML template. Required unless conversationId is provided, in which case the template is resolved from the conversation.

variables
object

Template variables for personalization

providerType
enum<string>
default:migma

Email service provider to send through. Defaults to Migma's built-in sending. To use an external provider, connect it first in Settings → Integrations → Email Providers.

Available options:
ses,
resend,
sendgrid,
mailgun,
migma
projectId
string

Project ID. Required unless conversationId is provided, in which case the projectId is resolved from the conversation.

conversationId
string

Conversation ID from a generated email. When provided, template and projectId are resolved automatically from the conversation.

transactional
boolean

Controls whether the email is treated as transactional (order confirmations, password resets) or marketing. Defaults to true for single sends (recipientType 'email') and false for batch sends (recipientType 'audience', 'segment', 'tag'). Transactional emails bypass subscription status and topic preference filters, and omit List-Unsubscribe headers. Bounced and invalid addresses are always excluded. Set explicitly to override the default.

Response

Email sent or batch queued

success
boolean
required
data
object
error
string | null