Overview
The Migma.ai API provides programmatic access to our AI Email Engine that creates pixel-perfect, on-brand emails in 30 seconds. Build custom integrations, automate email creation workflows, track customer events, export to platforms like Mailchimp and HubSpot, and manage your entire email marketing infrastructure programmatically. Generate emails 200x faster and 95% cheaper with AI that learns your brand voice, fetches live content, and creates cross-client compatible HTML/React code.Base URL
All API requests should be made to:Authentication
All API endpoints require authentication using API keys. Include your API key in theAuthorization header:
Authentication Guide
Learn how to create and manage API keys
API Structure
The Migma.ai API is organized around REST principles:- Predictable resource-oriented URLs
- Standard HTTP response codes
- JSON request and response bodies
- Bearer token authentication
Request Format
AllPOST, PATCH, and PUT requests should use JSON format:
Response Format
All API responses follow a consistent structure:Success Response
Error Response
HTTP Status Codes
The API uses standard HTTP status codes:| Code | Meaning | Description |
|---|---|---|
200 | OK | Request succeeded |
201 | Created | Resource was created successfully |
400 | Bad Request | Invalid request parameters |
401 | Unauthorized | Invalid or missing API key |
403 | Forbidden | API key lacks required permissions |
404 | Not Found | Resource doesn’t exist |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Something went wrong on our end |
503 | Service Unavailable | Service temporarily unavailable |
Rate Limiting
API requests are rate limited based on your plan:| Plan | Rate Limit |
|---|---|
| Free | 10 requests/minute |
| Pro | 100 requests/minute |
| Enterprise | Custom limits |
Pagination
List endpoints support pagination usinglimit and offset parameters:
Idempotency
Some endpoints support idempotency to safely retry requests without duplicating operations. Include anIdempotency-Key header:
Webhooks
Instead of polling for status updates, use webhooks to receive real-time notifications:Webhooks Guide
Learn how to set up webhooks for real-time notifications
API Endpoints
Projects
Manage brand projects and imports:GET /v1/projects- List all projectsGET /v1/projects/{projectId}- Get project detailsPOST /v1/projects/import- Import a new brand
Email Generation
Generate AI-powered, on-brand emails with async processing:POST /v1/projects/emails/generate- Generate an email (async)GET /v1/projects/emails/{conversationId}/status- Check generation status and get HTML/React code
Email Validation
Comprehensive email testing and quality analysis:POST /v1/emails/validate/compatibility- Test across 40+ email clientsPOST /v1/emails/validate/links- Check all links for validityPOST /v1/emails/validate/spelling- AI-powered spell/grammar checkPOST /v1/emails/validate/deliverability- Predict inbox placementPOST /v1/emails/validate/all- Run all validation checks
Email Validation API
Learn about email compatibility testing, link analysis, and deliverability prediction
Email Previews
Generate screenshots on real devices and email clients:POST /v1/emails/previews- Create device previewsGET /v1/emails/previews/{previewId}- Get preview status & resultsGET /v1/emails/devices/supported- List available devices (40+)
Email Preview API
Learn how to generate email previews across Gmail, Outlook, iPhone, and more
Subscribers
Manage your email audience via API:GET /v1/subscribers- List subscribersPOST /v1/subscribers- Add a subscriberPOST /v1/subscribers/bulk- Bulk import subscribersPOST /v1/subscribers/unsubscribe- Unsubscribe a subscriber
Exports
Export emails to various platforms with one-click integrations:POST /v1/export- Export to Mailchimp, HubSpot, Klaviyo, and moreGET /v1/export/{exportId}- Get export status
Browse Full API Reference
Explore auto-generated documentation for all endpoints
Error Codes
Common error codes and their meanings:| Code | Description |
|---|---|
INVALID_API_KEY | API key is invalid or revoked |
INSUFFICIENT_PERMISSIONS | API key lacks required permissions |
INVALID_REQUEST | Request parameters are invalid |
RESOURCE_NOT_FOUND | Requested resource doesn’t exist |
RATE_LIMIT_EXCEEDED | Too many requests in time window |
GENERATION_FAILED | Email generation encountered an error |
IMPORT_FAILED | Brand import encountered an error |
Environments
Use different API keys for different environments:Production
Development/Testing
Test keys are separate from production keys and don’t affect your production data or rate limits.
SDKs & Libraries
Official SDKs coming soon for:- Node.js / TypeScript
- Python
- Ruby
- PHP