Skip to content

Email Gateway API Documentation

Email Gateway endpoints for managing transactional email sending through verified domains, including domain management, API keys, SMTP credentials, webhooks, and email delivery.

Add a Sender Domain

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.AddDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.adddomain
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainNameStringYesDomain name to add (e.g., example.com)
SubdomainStringNoCustom subdomain override (e.g., outbound). Only letters, numbers, and hyphens allowed (max 32 characters).
TrackPrefixStringNoCustom tracking prefix override (e.g., links). Only letters, numbers, and hyphens allowed (max 32 characters).
TrackMergeStringNoCustom tracking merge character (e.g., -).
TrackPrefixDisabledIntegerNoSet to 1 to disable the separate tracking subdomain. When disabled, tracking URLs use the sender (MFROM) domain instead.
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.adddomain",
    "SessionID": "your-session-id",
    "DomainName": "example.com",
    "Subdomain": "outbound",
    "TrackPrefix": "links"
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "NewSenderDomainID": 123,
  "Domain": {
    "DomainID": 123,
    "SenderDomain": "example.com",
    "Status": "Approval Pending",
    "Options": {
      "LinkTracking": 1,
      "OpenTracking": 1,
      "UnsubscribeLink": 0,
      "CustomSubdomain": "outbound",
      "CustomTrackPrefix": "links"
    }
  }
}
json
{
  "Success": false,
  "ErrorCode": [1]
}
txt
0: Success
1: Missing required parameter (DomainName)
2: Invalid domain name format
3: Maximum sender domains limit reached for user
4: Invalid subdomain or track prefix value

Get Sender Domain Details

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.getdomain
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.getdomain",
    "SessionID": "your-session-id",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "Domain": {
    "DomainID": 123,
    "SenderDomain": "example.com",
    "Status": "Enabled",
    "Options": {
      "LinkTracking": 1,
      "OpenTracking": 1,
      "UnsubscribeLink": 0
    }
  }
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Update Sender Domain Settings

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.updatedomain
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
LinkTrackingIntegerNoEnable link tracking (1 = enabled, 0 = disabled)
OpenTrackingIntegerNoEnable open tracking (1 = enabled, 0 = disabled)
UnsubscribeLinkIntegerNoEnable unsubscribe link (1 = enabled, 0 = disabled)
HostingProviderStringNoHosting provider name
SubdomainStringNoCustom subdomain override (e.g., outbound). Only letters, numbers, and hyphens allowed (max 32 characters). Leave empty to reset to global default.
TrackPrefixStringNoCustom tracking prefix override (e.g., links). Only letters, numbers, and hyphens allowed (max 32 characters). Leave empty to reset to global default.
TrackMergeStringNoCustom tracking merge character (e.g., -).
TrackPrefixDisabledIntegerNoSet to 1 to disable the separate tracking subdomain. When disabled, tracking URLs use the sender (MFROM) domain instead. Set to 0 to re-enable.
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.updatedomain",
    "SessionID": "your-session-id",
    "DomainID": 123,
    "LinkTracking": 1,
    "OpenTracking": 1,
    "Subdomain": "outbound",
    "TrackPrefixDisabled": 1
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "Domain": {
    "DomainID": 123,
    "SenderDomain": "example.com",
    "Status": "Approval Pending",
    "Options": {
      "LinkTracking": 1,
      "OpenTracking": 1,
      "CustomSubdomain": "outbound",
      "TrackPrefixDisabled": true
    }
  },
  "SubdomainChanged": true
}
json
{
  "Success": false,
  "ErrorCode": 5
}
txt
0: Success
1: Missing required parameter (DomainID)
5: Domain not found or access denied
6: Invalid subdomain or track prefix value

Verify Sender Domain DNS Records

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.verifydomain
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.verifydomain",
    "SessionID": "your-session-id",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "Domain": {
    "DomainID": 123,
    "SenderDomain": "example.com",
    "Status": "Enabled"
  },
  "DNSVerificationResults": {
    "mail.example.com": ["CNAME", "target.example.com", true],
    "example.com": ["TXT", "v=spf1 include:example.com ~all", true]
  }
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Get All Sender Domains

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.getdomains
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.getdomains",
    "SessionID": "your-session-id"
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "Domains": [
    {
      "DomainID": 123,
      "SenderDomain": "example.com",
      "Status": "Enabled"
    },
    {
      "DomainID": 124,
      "SenderDomain": "another.com",
      "Status": "Approval Pending"
    }
  ]
}
json
{
  "Success": false,
  "ErrorCode": []
}
txt
0: Success

Delete a Sender Domain

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.deletedomain
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID to delete
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.deletedomain",
    "SessionID": "your-session-id",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Clear Domain Email Queue

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.cleardomainqueue
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.cleardomainqueue",
    "SessionID": "your-session-id",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Get Domain Statistics

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.domainstats
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
StartDateStringNoStart date (Y-m-d format, default: 28 days ago)
EndDateStringNoEnd date (Y-m-d format, default: today)
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.domainstats",
    "SessionID": "your-session-id",
    "DomainID": 123,
    "StartDate": "2024-01-01",
    "EndDate": "2024-01-31"
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "Stats": {
    "Sent": 1000,
    "Delivered": 950,
    "Bounced": 50,
    "Opened": 400,
    "Clicked": 150
  },
  "ComparisonStats": {
    "PreviousPeriod": {
      "Sent": 800,
      "Delivered": 760
    }
  },
  "TagStats": {
    "campaign1": {
      "Sent": 500,
      "Delivered": 475
    }
  }
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Create API Key for Domain

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.addapi
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DescriptionStringYesDescription for the API key
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.addapi",
    "SessionID": "your-session-id",
    "Description": "Production API Key",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "NewAPIKeyID": 456,
  "APIKey": {
    "APIKeyID": 456,
    "APIKey": "eg_live_xxxxxxxxxxxx",
    "Description": "Production API Key",
    "DomainID": 123
  }
}
json
{
  "Success": false,
  "ErrorCode": [1, 2]
}
txt
0: Success
1: Missing required parameter (Description)
2: Missing required parameter (DomainID)
3: Domain not found or access denied

Get Domain API Keys

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.getapis
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.getapis",
    "SessionID": "your-session-id",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "APIKeys": [
    {
      "APIKeyID": 456,
      "APIKey": "eg_live_xxxxxxxxxxxx",
      "Description": "Production API Key",
      "DomainID": 123
    }
  ]
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Delete Domain API Key

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.deleteapi
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
APIKeyIDIntegerYesAPI Key ID to delete
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.deleteapi",
    "SessionID": "your-session-id",
    "APIKeyID": 456
  }'
json
{
  "Success": true,
  "ErrorCode": 0
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (APIKeyID)
2: API Key not found or access denied

Create SMTP Credentials for Domain

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.addsmtp
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.addsmtp",
    "SessionID": "your-session-id",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "NewSMTPID": 789,
  "SMTP": {
    "SMTPID": 789,
    "SMTPUsername": "smtp_user_xxx",
    "SMTPPassword": "generated_password",
    "SMTPHost": "smtp.example.com",
    "SMTPPorts": [25, 587, 2525]
  }
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Get Domain SMTP Credentials

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.getsmtps
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.getsmtps",
    "SessionID": "your-session-id",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "SMTPs": [
    {
      "SMTPID": 789,
      "SMTPUsername": "smtp_user_xxx",
      "SMTPHost": "smtp.example.com",
      "SMTPPorts": [25, 587, 2525]
    }
  ]
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Delete SMTP Credentials

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.deletesmtp
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
SMTPIDIntegerYesSMTP credentials ID to delete
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.deletesmtp",
    "SessionID": "your-session-id",
    "SMTPID": 789
  }'
json
{
  "Success": true,
  "ErrorCode": 0
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (SMTPID)
2: SMTP credentials not found or access denied

Reset SMTP Password

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.resetsmtppassword
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
SMTPIDIntegerYesSMTP credentials ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.resetsmtppassword",
    "SessionID": "your-session-id",
    "SMTPID": 789
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "SMTP": {
    "SMTPID": 789,
    "SMTPUsername": "smtp_user_xxx",
    "SMTPPassword": "new_generated_password"
  }
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (SMTPID)
2: SMTP credentials not found or access denied

Create Webhook for Domain

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.addwebhook
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
EventStringYesEvent type: delivery, bounce, open, click, unsubscribe, complaint
WebhookURLStringYesWebhook URL to receive event notifications
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.addwebhook",
    "SessionID": "your-session-id",
    "DomainID": 123,
    "Event": "delivery",
    "WebhookURL": "https://example.com/webhooks/email-events"
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "NewWebhookID": 999
}
json
{
  "Success": false,
  "ErrorCode": [3]
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Missing required parameter (Event)
3: Invalid event type
4: Domain not found or access denied
5: Missing required parameter (WebhookURL)

Get Domain Webhooks

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.getwebhooks
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.getwebhooks",
    "SessionID": "your-session-id",
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "SigningKey": "whsec_xxxxxxxxxxxx",
  "Webhooks": [
    {
      "WebhookID": 999,
      "Event": "delivery",
      "WebhookURL": "https://example.com/webhooks/email-events"
    }
  ]
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Delete Domain Webhook

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.deletewebhook
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
WebhookIDIntegerYesWebhook ID to delete
DomainIDIntegerYesSender domain ID
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.deletewebhook",
    "SessionID": "your-session-id",
    "WebhookID": 999,
    "DomainID": 123
  }'
json
{
  "Success": true,
  "ErrorCode": 0
}
json
{
  "Success": false,
  "ErrorCode": 4
}
txt
0: Success
1: Missing required parameter (WebhookID)
2: Missing required parameter (DomainID)
3: Domain not found or access denied
4: Webhook not found or access denied

Create Webhook (Public API)

POST /api/v1/webhooks

API Usage Notes

  • Authentication required: Bearer token
  • Rate limit: 100 requests per 60 seconds
  • Legacy endpoint access via /api.php is also supported

Request Body Parameters:

ParameterTypeRequiredDescription
SenderAPIKeyStringYesAPI key for the sender domain (Bearer token)
EventStringYesEvent type: delivered, bounced, opened, clicked, unsubscribed, complained
WebhookURLStringYesWebhook URL to receive event notifications
bash
curl -X POST https://example.com/api/v1/webhooks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eg_live_xxxxxxxxxxxx" \
  -d '{
    "Event": "delivered",
    "WebhookURL": "https://example.com/webhooks/email-events"
  }'
json
{
  "NewWebhookID": 999
}
json
{
  "Errors": [
    {"Code": 3, "Message": "Invalid Event value"}
  ]
}
txt
2: Event is missing
3: Invalid event type or invalid webhook URL
5: WebhookURL is missing
13: Invalid SenderAPIKey
429: Too many requests

Get Webhooks (Public API)

GET /api/v1/webhooks

API Usage Notes

  • Authentication required: Bearer token
  • Rate limit: 100 requests per 60 seconds
  • Legacy endpoint access via /api.php is also supported

Request Body Parameters:

ParameterTypeRequiredDescription
SenderAPIKeyStringYesAPI key for the sender domain (Bearer token)
bash
curl -X GET https://example.com/api/v1/webhooks \
  -H "Authorization: Bearer eg_live_xxxxxxxxxxxx"
json
{
  "Webhooks": [
    {
      "WebhookID": 999,
      "Event": "delivered",
      "WebhookURL": "https://example.com/webhooks/email-events"
    }
  ]
}
json
{
  "Errors": [
    {"Code": 13, "Message": "Invalid SenderAPIKey"}
  ]
}
txt
2: Invalid user account
13: Invalid SenderAPIKey
429: Too many requests

Delete Webhook (Public API)

DELETE /api/v1/webhooks

API Usage Notes

  • Authentication required: Bearer token
  • Rate limit: 100 requests per 60 seconds
  • Legacy endpoint access via /api.php is also supported

Request Body Parameters:

ParameterTypeRequiredDescription
SenderAPIKeyStringYesAPI key for the sender domain (Bearer token)
WebhookIDIntegerYesWebhook ID to delete
bash
curl -X DELETE https://example.com/api/v1/webhooks \
  -H "Authorization: Bearer eg_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "WebhookID": 999
  }'
json
{}
json
{
  "Errors": [
    {"Code": 4, "Message": "Invalid WebhookID"}
  ]
}
txt
1: WebhookID is missing
2: Invalid user account
4: Invalid WebhookID
13: Invalid SenderAPIKey
429: Too many requests

Get Email Events

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.getevents
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
StartFromIntegerYesStarting record index for pagination
RetrieveCountIntegerYesNumber of records to retrieve (max 100)
StartDateStringNoStart date filter (Y-m-d format)
EndDateStringNoEnd date filter (Y-m-d format)
EventStringNoFilter by event type (delivery, bounce, open, click, etc.)
QueryStringNoSearch query string
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.getevents",
    "SessionID": "your-session-id",
    "DomainID": 123,
    "StartFrom": 0,
    "RetrieveCount": 50,
    "Event": "delivery"
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "TotalRecords": 150,
  "Events": [
    {
      "event": "delivery",
      "timestamp": 1640000000,
      "message": {
        "headers": {
          "from": "sender@example.com",
          "to": "recipient@example.com",
          "subject": "Test Email"
        }
      }
    }
  ]
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied
4: Missing required parameter (StartFrom)
5: Missing required parameter (RetrieveCount)

Get Email Events (Public API)

GET /api/v1/events

API Usage Notes

  • Authentication required: Bearer token
  • Rate limit: 100 requests per 60 seconds
  • Legacy endpoint access via /api.php is also supported

Request Body Parameters:

ParameterTypeRequiredDescription
SenderAPIKeyStringYesAPI key for the sender domain (Bearer token)
StartFromIntegerNoStarting record index for pagination (default: 0)
RetrieveCountIntegerNoNumber of records to retrieve (default: 5, max 100)
StartDateIntegerNoStart date filter (Unix timestamp)
EndDateIntegerNoEnd date filter (Unix timestamp)
EventStringNoFilter by event type
MessageIDStringNoFilter by message ID
bash
curl -X GET https://example.com/api/v1/events \
  -H "Authorization: Bearer eg_live_xxxxxxxxxxxx" \
  -d '{
    "StartFrom": 0,
    "RetrieveCount": 50,
    "Event": "delivery"
  }'
json
{
  "TotalRecords": 150,
  "Events": [
    {
      "Event": "delivery",
      "LoggedAt": 1640000000,
      "Message": {
        "Headers": {
          "From": "sender@example.com",
          "To": "recipient@example.com",
          "Subject": "Test Email"
        }
      }
    }
  ]
}
json
{
  "Errors": [
    {"Code": 13, "Message": "Invalid SenderAPIKey"}
  ]
}
txt
1: Missing SenderAPIKey
2: Invalid sender domain
4: Missing StartFrom
5: Missing RetrieveCount
13: Invalid SenderAPIKey
429: Too many requests

Get Aggregated Event Statistics

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.aggrevents
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID
StartDateStringNoStart date filter (Y-m-d format)
EndDateStringNoEnd date filter (Y-m-d format)
AggregatedFieldStringNoField to aggregate by
AggregateSizeIntegerNoNumber of aggregation buckets
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.aggrevents",
    "SessionID": "your-session-id",
    "DomainID": 123,
    "StartDate": "2024-01-01",
    "EndDate": "2024-01-31"
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "AggBuckets": [
    {
      "key": "delivery",
      "doc_count": 1000
    },
    {
      "key": "bounce",
      "doc_count": 50
    }
  ]
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID)
2: Domain not found or access denied

Send Email via API

POST /api/v1/email

API Usage Notes

  • Authentication required: Bearer token
  • Rate limit: 100 requests per 60 seconds
  • Legacy endpoint access via /api.php is also supported

Request Body Parameters:

ParameterTypeRequiredDescription
SenderAPIKeyStringYesAPI key for the sender domain (Bearer token)
SubjectStringYesEmail subject line
ContentTypeStringYesContent type: html or plain
HTMLContentStringConditionalHTML email content (required if ContentType is html)
PlainContentStringConditionalPlain text email content (required if ContentType is plain)
FromObjectYesSender information:
ToArrayConditionalArray of recipients: [{name, email}] (required unless TargetListID is set)
CCArrayNoArray of CC recipients: [{name, email}]
BCCArrayNoArray of BCC recipients: [{name, email}]
ReplyToArrayNoArray of reply-to addresses: [{name, email}]
TagsArrayNoArray of custom tags for tracking
HeadersObjectNoCustom email headers as key-value pairs
TrackLinksStringNoEnable link tracking: true or false
TrackOpensStringNoEnable open tracking: true or false
SendAtIntegerNoSchedule send time (Unix timestamp)
AttachmentsArrayNoArray of attachments: [{filename, content, type, disposition, contentid}]
TemplateIDIntegerNoEmail template ID to use
TargetListIDIntegerNoSend to all subscribers in a list
ListIDIntegerNoList ID for subscriber context
SubscriberIDIntegerNoSubscriber ID for personalization
JourneyIDIntegerNoJourney ID for tracking
ActionIDIntegerNoJourney action ID for tracking
bash
curl -X POST https://example.com/api/v1/email \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eg_live_xxxxxxxxxxxx" \
  -d '{
    "Subject": "Welcome to Our Service",
    "ContentType": "html",
    "HTMLContent": "<h1>Welcome!</h1><p>Thank you for signing up.</p>",
    "From": {
      "name": "John Doe",
      "email": "john@example.com"
    },
    "To": [
      {
        "name": "Jane Smith",
        "email": "jane@example.com"
      }
    ]
  }'
json
{
  "MessageID": "550e8400-e29b-41d4-a716-446655440000"
}
json
{
  "Errors": [
    {"Code": 8, "Message": "Missing Subject"}
  ]
}
txt
1: Missing SenderAPIKey
2: Invalid DomainID or invalid user account
3: From parameter is missing or invalid
8: Missing Subject or To email address
9: Missing ContentType
10: Missing HTMLContent
11: Missing PlainContent
12: Invalid or deactivated user account
13: Invalid SenderAPIKey
14: Email address is in the suppression list
15: Invalid TemplateID
16: Invalid TargetListID
17: Email sending limit reached
18: Recipient name or email address is missing
19: Recipient email address is invalid
20: There is no recipient set or count exceeds limit
21-22: CC email validation errors
23: Invalid from email address format
24-26: BCC email validation errors
27: BCC count exceeds limit
28-30: Reply-To email validation errors
31: Reply-To count exceeds limit
32: Domain is not activated
34: User account is not verified
35: Invalid ListID
36: Invalid SubscriberID
37: Invalid JourneyID
38: Invalid ActionID
429: Email send rate limit exceeded

Send Email via SMTP Relay

POST /api.php

API Usage Notes

  • Authentication required: Admin API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)
  • This is an internal endpoint used by the SMTP relay server

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.smtprelay
AdminAPIKeyStringYesAdmin API key for authentication
SMTPUsernameStringYesSMTP username for authentication
SMTPPasswordStringYesSMTP password for authentication
UUIDStringNoUnique message identifier
MailFromStringNoMAIL FROM envelope address
RcptToStringNoRCPT TO envelope addresses (comma-separated)
SubjectStringNoEmail subject line
RawEmailStringNoRaw email content (RFC 822 format)
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.smtprelay",
    "AdminAPIKey": "your-admin-key",
    "SMTPUsername": "smtp_user_xxx",
    "SMTPPassword": "smtp_password"
  }'
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.smtprelay",
    "AdminAPIKey": "your-admin-key",
    "SMTPUsername": "smtp_user_xxx",
    "SMTPPassword": "smtp_password",
    "UUID": "550e8400-e29b-41d4-a716-446655440000",
    "MailFrom": "sender@example.com",
    "RcptTo": "recipient@example.com",
    "Subject": "Test Email",
    "RawEmail": "From: sender@example.com..."
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "SMTPUsername": "smtp_user_xxx",
  "SMTPPassword": "smtp_password"
}
json
{
  "Success": true,
  "ErrorCode": 0,
  "SMTPResponse": "250 2.0.0 Ok: queued",
  "SMTPUsername": "smtp_user_xxx",
  "SMTPPassword": "smtp_password"
}
json
{
  "Success": false,
  "SMTPResponse": "500 5.0.0 AUTH ERROR",
  "ErrorCode": 3
}
txt
0: Success
1: Missing SMTPUsername
2: Missing SMTPPassword
3: Invalid SMTP credentials
4: Invalid sender domain
5: Sender domain is not active
6: Invalid user account
7: User is not trusted or not enabled
8: Recipient email address is suppressed

Get All Sender Domains for PowerMTA Configuration

POST /api/v1/sender.domains

API Usage Notes

  • Authentication required: Admin API Key
  • Rate limit: 100 requests per 60 seconds
  • Legacy endpoint access via /api.php is also supported

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringNoAPI command: sender.domains (only required for legacy endpoint)
AdminAPIKeyStringNoAdmin API key for authentication (only required for legacy endpoint)
DomainsResponseFormatStringNoResponse format: json, powermta-bounce-domains, powermta-relay-domains (default: json)
bash
curl -X POST https://example.com/api/v1/sender.domains \
  -H "Content-Type: application/json" \
  -d '{
    "DomainsResponseFormat": "json"
  }'
json
{
  "Success": true,
  "Domains": [
    "example.com",
    "another.com",
    "third.com"
  ]
}
json
{
  "Success": false,
  "ErrorCode": 1,
  "ErrorText": "Invalid DomainsResponseFormat"
}
txt
0: Success
1: Invalid DomainsResponseFormat (must be json, powermta-bounce-domains, or powermta-relay-domains)

Check Inbound Relay Domain Authorization

GET /api/v1/inbound-relay-domain-check

API Usage Notes

  • Authentication required: Bearer token (Admin API Key)
  • This endpoint is designed for MX server integration to validate relay domains
  • Returns HTTP status codes to indicate relay authorization
  • Legacy endpoint access via /api.php is also supported

Request Body Parameters:

ParameterTypeRequiredDescription
DomainStringYesDomain name to check for relay authorization (can be full email address)
bash
curl -X GET "https://example.com/api/v1/inbound-relay-domain-check?domain=example.com" \
  -H "Authorization: Bearer your-admin-api-key"
json
{
  "Success": true,
  "RelayDomain": "example.com"
}
json
{
  "Errors": [
    {
      "Code": 1,
      "Message": "Authentication failed. Invalid admin API key."
    }
  ]
}
json
{}
txt
200: Relay allowed - domain is authorized for relay
403: Temporary error - authentication failed
500: Relay access denied - domain is not authorized
txt
1: Authentication failed - Invalid admin API key

Get Recipient Domain Statistics

POST /api.php

API Usage Notes

  • Authentication required: User API Key
  • Required permissions: EmailGateway.ManageDomain
  • Legacy endpoint access via /api.php only (no v1 REST alias configured)

Request Body Parameters:

ParameterTypeRequiredDescription
CommandStringYesAPI command: emailgateway.recipientdomainstats
SessionIDStringNoSession ID obtained from login
APIKeyStringNoAPI key for authentication
DomainIDIntegerYesSender domain ID (used to verify user ownership)
RecipientToDomainStringYesRecipient domain to filter by (e.g., gmail.com)
StartDateStringNoStart date (Y-m-d format, default: 28 days ago)
EndDateStringNoEnd date (Y-m-d format, default: today)
bash
curl -X POST https://example.com/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "Command": "emailgateway.recipientdomainstats",
    "SessionID": "your-session-id",
    "DomainID": 123,
    "RecipientToDomain": "gmail.com",
    "StartDate": "2026-01-01",
    "EndDate": "2026-02-11"
  }'
json
{
  "Success": true,
  "ErrorCode": 0,
  "SummaryStats": [
    {
      "Status": "Sent",
      "TotalEmails": 1523,
      "AvgDeliverySeconds": 4.32,
      "MinDeliverySeconds": 0,
      "MaxDeliverySeconds": 187
    },
    {
      "Status": "Failed",
      "TotalEmails": 42,
      "AvgDeliverySeconds": 12.58,
      "MinDeliverySeconds": 1,
      "MaxDeliverySeconds": 95
    }
  ],
  "DeliverySpeedHistogram": {
    "Sent": [
      { "DeliveryBucket": "< 1s", "EmailCount": 312, "Percentage": 20.49 },
      { "DeliveryBucket": "1-5s", "EmailCount": 845, "Percentage": 55.48 },
      { "DeliveryBucket": "5-10s", "EmailCount": 200, "Percentage": 13.13 },
      { "DeliveryBucket": "10-30s", "EmailCount": 100, "Percentage": 6.57 },
      { "DeliveryBucket": "30-60s", "EmailCount": 40, "Percentage": 2.63 },
      { "DeliveryBucket": "1-5m", "EmailCount": 20, "Percentage": 1.31 },
      { "DeliveryBucket": "5-10m", "EmailCount": 4, "Percentage": 0.26 },
      { "DeliveryBucket": "> 10m", "EmailCount": 2, "Percentage": 0.13 }
    ],
    "Failed": [
      { "DeliveryBucket": "1-5s", "EmailCount": 30, "Percentage": 71.43 },
      { "DeliveryBucket": "5-10s", "EmailCount": 12, "Percentage": 28.57 }
    ]
  }
}
json
{
  "Success": false,
  "ErrorCode": 2
}
txt
0: Success
1: Missing required parameter (DomainID or RecipientToDomain)
2: Domain not found or access denied

Any questions? Contact us.