REST API

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:

Terminal
1
https://api.metigan.com
Regional Endpoints

For improved latency, you can use regional endpoints:

  • https://us.api.metigan.com - US East
  • https://eu.api.metigan.com - Europe

Authentication

Authenticate requests using your API key in the x-api-key header:

curlTerminal
1
2
3
4
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>"}'
Keep Your API Key Secret

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/json
  • Accept - 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

200 OKJSON
1
2
3
4
5
6
7
8
{
  "success": true,
  "message": "Email sent successfully",
  "data": {
    "trackingId": "mtg-1234567890-0001",
    "emailsRemaining": 9999
  }
}

Error Response

400 Bad RequestJSON
1
2
3
4
5
6
{
  "success": false,
  "error": "VALIDATION_ERROR",
  "message": "Invalid email address format",
  "field": "recipients"
}

HTTP Status Codes

CodeStatusDescription
200OKRequest successful
201CreatedResource created successfully
400Bad RequestInvalid request body or parameters
401UnauthorizedMissing or invalid API key
403ForbiddenInsufficient permissions
404Not FoundResource not found
422Unprocessable EntityValidation error
429Too Many RequestsRate limit exceeded
500Internal ErrorServer error - please retry

Rate Limits

Rate limits are applied per API key:

PlanRequests/SecondRequests/Day
Free101,000
Pro5050,000
Growth100200,000
Business200Unlimited
Rate Limit Headers

Check these headers in responses:

  • X-RateLimit-Limit - Max requests allowed
  • X-RateLimit-Remaining - Requests remaining
  • X-RateLimit-Reset - Unix timestamp when limit resets

API Endpoints

Explore the complete API reference for each module:

Quick Examples

Send Email

curlTerminal
1
2
3
4
5
6
7
8
9
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)

curlTerminal
1
2
3
4
5
6
7
8
9
10
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

curlTerminal
1
2
3
4
5
6
7
8
9
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

curlTerminal
1
2
3
4
5
6
7
8
9
10
11
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 metigan

Python

pip install metigan

PHP

composer require metigan/metigan-php

Go

go get github.com/metigan/go

Java

com.metigan:metigan-java

Angular

npm install @metigan/angular

NestJS

npm install @metigan/nestjs

Need Help?

📚 Documentation

Explore our comprehensive guides and examples.

Browse Docs →

💬 Support

Contact our support team for assistance.

support@metigan.com →