Skip to main content

Authenticate

Create an account at migma.ai, then pick the first path that works:
1

Hosted MCP

Add https://migma.ai/mcp in your agent client and approve access in the browser.
2

CLI

Install the CLI and run migma login. A browser window opens; the key is stored for you.
3

Claim-code or CI

Direct agents that cannot complete an OAuth callback, but can call the API, poll, and securely store a credential, should fetch https://api.migma.ai/auth.md. CI and servers set MIGMA_API_KEY.
Do not send agents to Settings to copy a key. Settings keys are for CI and server automation only.

Import Your Brand

Before generating emails, you need to import your brand information:
Node.js SDK
cURL
JavaScript
Python
Brand import is asynchronous. The SDK’s importAndWait handles polling automatically. With raw HTTP, save the projectId and poll the status endpoint or use webhooks.

Generate Your First Email

Once your brand is imported, generate an email:
Node.js SDK
cURL
JavaScript
Python

Poll for Status

Email generation is asynchronous. Use the SDK’s generateAndWait — it handles polling automatically. Or set up webhooks to get notified when generation completes without polling at all.

Get, Edit, and Send the Generated Email

Use emailId from result.emails[] to fetch, prompt-edit, test-send, or send one generated email. This is required for email series because conversationId points at the whole generation.
Node.js SDK
cURL
JavaScript

Complete Example

Here’s a complete workflow from import to generated HTML:
Node.js SDK

Next steps

Node.js SDK

Full SDK guide with error handling, polling, and all 14 resources

CLI

Generate, send, and validate from your terminal

MCP

Connect Migma to Cursor, Codex, Claude, VS Code, and other AI tools

Skills

Add Migma to AI coding assistants

Set Up Webhooks

Real-time notifications instead of polling

API Reference

Full endpoint documentation

Common Issues

Check that your API key is correct and included in the Authorization header as Bearer YOUR_API_KEY
Brand imports can take 30-60 seconds. Use webhooks to get notified when complete instead of polling.
Check the error message in the response. Common issues:
  • Invalid projectId (brand not imported yet)
  • Prompt is too vague or too long
  • Rate limit exceeded
The generated HTML is optimized for email clients. Run email preflight checks to test compatibility across 30+ clients, or send a test email to yourself first.
Last modified on September 1, 2026