> ## Documentation Index
> Fetch the complete documentation index at: https://docs.migma.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Documentation

> AI-powered email generation API - Build beautiful, on-brand emails in seconds

## Welcome to Migma.ai

Migma lets you generate, edit, validate, and send on-brand emails through a REST API, Node.js SDK, CLI, or MCP server. Import your brand from a URL, generate emails with AI, and send to individuals, tags, or segments — or export to Klaviyo, Mailchimp, and HubSpot.

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Get started with your first API call in under 5 minutes
  </Card>

  <Card title="Node.js SDK" icon="npm" href="/sdk">
    Official TypeScript SDK — install, configure, and start building
  </Card>

  <Card title="CLI" icon="terminal" href="/cli">
    Generate, send, validate, and export AI-powered emails from the terminal
  </Card>

  <Card title="Events & Webhooks" icon="bolt" href="/webhooks">
    Receive event notifications for API automations and contact changes
  </Card>

  <Card title="MCP" icon="server" href="/mcp-server">
    Connect Cursor, Codex, Claude, and other AI agents to Migma
  </Card>

  <Card title="Skills" icon="wand-magic-sparkles" href="/skills">
    Add Migma to AI coding assistants
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore all available endpoints and responses
  </Card>
</CardGroup>

## What can you build?

<AccordionGroup>
  <Accordion title="Email Marketing Automation" icon="envelope">
    Generate personalized email campaigns at scale. Import your brand, define your audience, and let AI create perfectly on-brand emails automatically.
  </Accordion>

  <Accordion title="E-commerce Integrations" icon="shopping-cart">
    Build integrations with Shopify, WooCommerce, or any e-commerce platform. Generate product announcements, promotional emails, and cart abandonment campaigns. Export to platforms like Mailchimp and Klaviyo with one click.
  </Accordion>

  <Accordion title="CRM & Marketing Tools" icon="chart-line">
    Connect Migma to your CRM or marketing automation platform. Trigger email generation based on customer events (purchases, cart abandons, page visits). Sync with Mailchimp, Klaviyo, HubSpot, and more.
  </Accordion>

  <Accordion title="Custom Applications" icon="wand-magic-sparkles">
    Build prompt-to-email workflows for transactional emails, onboarding series, newsletters, and agentic tools. Generate emails, retrieve HTML and screenshots by `emailId`, prompt-edit them, then send through Migma.
  </Accordion>
</AccordionGroup>

## Key Features

<CardGroup cols={3}>
  <Card title="AI-Powered Generation" icon="brain">
    Generate on-brand emails in 30 seconds with Migma Memory that learns your style
  </Card>

  <Card title="One-Click Brand Import" icon="palette">
    Auto-fetch logo, colors, fonts, and brand voice from any website URL
  </Card>

  <Card title="Events & Webhooks" icon="bolt">
    Get notified for email generation, test sends, project imports, and subscriber events
  </Card>

  <Card title="Cross-Client Compatible" icon="file-code">
    Export clean, production-ready email code that works perfectly across 30+ email clients
  </Card>

  <Card title="Audience Management" icon="users">
    Manage subscribers, track events, create segments, and personalize campaigns
  </Card>

  <Card title="Export Integrations" icon="plug">
    One-click export to Mailchimp, Klaviyo, HubSpot, and custom webhooks
  </Card>
</CardGroup>

## Popular Use Cases

### Marketing Automation

```typescript Node.js SDK theme={null}
import Migma from 'migma';
const migma = new Migma(process.env.MIGMA_API_KEY);

// Generate and wait for a promotional email
const { data } = await migma.emails.generateAndWait({
  projectId: 'your_project_id',
  prompt: 'Create a summer sale announcement with 30% off, highlighting our new collection',
  languages: ['en']
});

const selectedEmail = data.result.emails[0];
console.log(selectedEmail.emailId);
console.log(selectedEmail.html);
console.log(selectedEmail.screenshotUrl);
```

```javascript JavaScript theme={null}
// Generate a promotional email with async generation
const response = await fetch('https://api.migma.ai/v1/projects/emails/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    projectId: "your_project_id",
    prompt: "Create a summer sale announcement with 30% off, highlighting our new collection",
    languages: ["en"]
  })
});

// Check status at /v1/projects/emails/{conversationId}/status,
// then use result.emails[0].emailId to fetch, edit, or send.
```

### E-commerce Integration with Mailchimp Export

```typescript Node.js SDK theme={null}
// Export a generated email to Mailchimp
const { data } = await migma.export.mailchimp('conversation_id');

console.log(data.files[0].url);
```

```javascript JavaScript theme={null}
// Generate and export to Mailchimp
const response = await fetch('https://api.migma.ai/v1/export/mailchimp/conv_123', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});
```

## Need Help?

<CardGroup cols={2}>
  <Card title="Join Our Community" icon="discord" href="https://discord.gg/ZB6c2meCUA">
    Connect with other developers and get support
  </Card>

  <Card title="Contact Support" icon="life-ring" href="https://migma.ai/support">
    Get in touch with our support team
  </Card>
</CardGroup>
