REST API Reference
Complete REST API documentation for integrating Metigan directly via HTTP requests. No SDK required - use any programming language or tool.
Base URL
All API requests should be made to the following base URL:
https://api.metigan.comFor improved latency, you can use regional endpoints:
https://us.api.metigan.com- US Easthttps://eu.api.metigan.com- Europe
Authentication
Authenticate requests using your API key in the x-api-key header:
curl -X POST https://api.metigan.com/api/email/send \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"from": "sender@example.com", "recipients": ["user@example.com"], "subject": "Hello", "content": "<p>Hello World</p>"}'Never expose your API key in client-side code. Use environment variables and server-side requests.
Request Format
Headers
x-api-key- Your API key (required)Content-Type- application/jsonAccept- application/json
Body Format
All request bodies should be JSON encoded. Use camelCase for field names.
Response Format
All responses are JSON and include the following structure:
Success Response
{
"success": true,
"message": "Email sent successfully",
"data": {
"trackingId": "mtg-1234567890-0001",
"emailsRemaining": 9999
}
}Error Response
{
"success": false,
"error": "VALIDATION_ERROR",
"message": "Invalid email address format",
"field": "recipients"
}HTTP Status Codes
| Code | Status | Description |
|---|---|---|
200 | OK | Request successful |
201 | Created | Resource created successfully |
400 | Bad Request | Invalid request body or parameters |
401 | Unauthorized | Missing or invalid API key |
403 | Forbidden | Insufficient permissions |
404 | Not Found | Resource not found |
422 | Unprocessable Entity | Validation error |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Error | Server error - please retry |
Rate Limits
Rate limits are applied per API key:
| Plan | Requests/Second | Requests/Day |
|---|---|---|
| Free | 10 | 1,000 |
| Pro | 50 | 50,000 |
| Growth | 100 | 200,000 |
| Business | 200 | Unlimited |
Check these headers in responses:
X-RateLimit-Limit- Max requests allowedX-RateLimit-Remaining- Requests remainingX-RateLimit-Reset- Unix timestamp when limit resets
API Endpoints
Explore the complete API reference for each module:
Send emails, OTP codes, and transactional messages
Contacts
Create, update, and manage contact records
Audiences
Organize contacts into segmented audiences
Templates
Create and manage reusable email templates
Forms
Submit form data and manage form configurations
Quick Examples
Send Email
curl -X POST https://api.metigan.com/api/email/send \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"from": "Your Company <noreply@yourcompany.com>",
"recipients": ["user@example.com"],
"subject": "Welcome to Our Platform!",
"content": "<h1>Welcome!</h1><p>Thank you for signing up.</p>"
}'Send OTP (Verification Code)
curl -X POST https://api.metigan.com/api/otp/send \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"from": "security@yourapp.com",
"code": "123456",
"appName": "YourApp",
"expiresInMinutes": 10
}'Send Transactional Email
curl -X POST https://api.metigan.com/api/transactional/send \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"from": "orders@yourshop.com",
"subject": "Order Confirmed #12345",
"content": "<h1>Order Confirmed</h1><p>Your order #12345 has been confirmed.</p>"
}'Create Contact
curl -X POST https://api.metigan.com/api/contacts \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"audienceId": "aud_123456",
"tags": ["customer", "newsletter"],
"status": "subscribed"
}'Official SDKs
While you can use the REST API directly, we recommend using our official SDKs for the best developer experience:
Node.js
npm install metiganPython
pip install metiganPHP
composer require metigan/metigan-phpGo
go get github.com/metigan/goJava
com.metigan:metigan-javaAngular
npm install @metigan/angularNestJS
npm install @metigan/nestjs