These emailgateway.* commands manage the setup behind Send email, SMTP and Webhooks. They take your account API key as APIKey and are sent to POST https://app.emailmarketer.io/api.php with Command. Responses use the legacy format with Success and ErrorCode.
The sender key endpoints at the end of this page take a sender API key instead.
Domains
| Command | Required | Optional | Returns | Errors |
|---|---|---|---|---|
emailgateway.adddomain |
DomainName |
Subdomain, TrackPrefix (letters, digits, hyphens, up to 32), TrackPrefixDisabled |
NewSenderDomainID, Domain with Status: "Approval Pending" |
1 missing name, 2 bad format, 3 domain limit reached, 4 bad subdomain or prefix |
emailgateway.getdomains |
none | WithCounts adds key, SMTP and webhook counts and recent activity |
Domains |
none |
emailgateway.getdomain |
DomainID |
none | Domain |
1 missing, 2 not found |
emailgateway.updatedomain |
DomainID |
LinkTracking, OpenTracking, UnsubscribeLink, Subdomain, TrackPrefix, StrictFlags |
Domain, SubdomainChanged |
1 missing, 5 not found, 6 bad value, 7 bad flag |
emailgateway.verifydomain |
DomainID |
IncludeDiagnostics |
Domain, DNSVerificationResults |
1, 2 |
emailgateway.deletedomain |
DomainID |
none | Success |
1, 2, 3 suspended by our team |
emailgateway.cleardomainqueue |
DomainID |
none | Success. Drops messages still waiting to send |
1, 2 |
Examples:
# emailgateway.adddomain
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.adddomain \
-d APIKey="$EM_API_KEY" \
-d DomainName=acme.com
# emailgateway.getdomains
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.getdomains \
-d APIKey="$EM_API_KEY" \
-d WithCounts=true
# emailgateway.getdomain
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.getdomain \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.updatedomain
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.updatedomain \
-d APIKey="$EM_API_KEY" \
-d DomainID=12 \
-d TrackPrefix=links
# emailgateway.verifydomain
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.verifydomain \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.deletedomain
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.deletedomain \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.cleardomainqueue
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.cleardomainqueue \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
Changing the subdomain or tracking settings sets the domain back to Approval Pending until you verify it again.
Sender API keys
| Command | Required | Returns | Errors |
|---|---|---|---|
emailgateway.addapi |
DomainID, Description |
NewAPIKeyID, APIKey (APIKeyID, APIKey, Description, DomainID) |
1 missing description, 2 missing domain, 3 domain not found |
emailgateway.getapis |
DomainID |
APIKeys. Team members see their own keys in full and others masked |
1, 2 |
emailgateway.replaceapi |
DomainID, Description |
A new key, as in addapi. The old key stops working at once |
1 to 3, 4 nothing changed, safe to retry |
emailgateway.deleteapi |
APIKeyID |
Success |
1 missing, 2 not found |
Examples:
# emailgateway.addapi
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.addapi \
-d APIKey="$EM_API_KEY" \
-d DomainID=12 \
-d Description="Production app"
# emailgateway.getapis
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.getapis \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.replaceapi
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.replaceapi \
-d APIKey="$EM_API_KEY" \
-d DomainID=12 \
-d Description="Production app"
# emailgateway.deleteapi
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.deleteapi \
-d APIKey="$EM_API_KEY" \
-d APIKeyID=34
SMTP credentials
| Command | Required | Returns | Errors |
|---|---|---|---|
emailgateway.addsmtp |
DomainID |
NewSMTPID, SMTP (SMTPID, SMTPUsername, SMTPPassword, SMTPHost, SMTPPorts) |
1, 2 |
emailgateway.getsmtps |
DomainID |
SMTPs, without passwords |
1, 2 |
emailgateway.resetsmtppassword |
SMTPID |
SMTP with a new SMTPPassword |
1, 2, 3 retry |
emailgateway.deletesmtp |
SMTPID |
Success |
1, 2 |
Examples:
# emailgateway.addsmtp
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.addsmtp \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.getsmtps
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.getsmtps \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.resetsmtppassword
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.resetsmtppassword \
-d APIKey="$EM_API_KEY" \
-d SMTPID=56
# emailgateway.deletesmtp
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.deletesmtp \
-d APIKey="$EM_API_KEY" \
-d SMTPID=56
Store the password when you create or reset it. It is not shown again.
Webhooks
| Command | Required | Returns | Errors |
|---|---|---|---|
emailgateway.addwebhook |
DomainID, Event (delivery, bounce, open, click, unsubscribe or complaint), WebhookURL |
NewWebhookID |
1 missing domain, 2 missing event, 3 bad event, 4 domain not found, 5 missing URL, 6 not http or https, 7 address not allowed |
emailgateway.getwebhooks |
DomainID |
SigningKey, Webhooks (WebhookID, Event, WebhookURL) |
1, 2 |
emailgateway.testwebhook |
DomainID, WebhookID |
Delivered, ResponseCode, Error |
1 to 4, 5 too many tests (HTTP 429) |
emailgateway.deletewebhook |
WebhookID, DomainID |
Success |
1 to 4 |
emailgateway.regeneratesigningkey |
DomainID |
New SigningKey. The old one stops working |
1, 2, 3 retry |
Examples:
# emailgateway.addwebhook
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.addwebhook \
-d APIKey="$EM_API_KEY" \
-d DomainID=12 \
-d Event=delivery \
-d WebhookURL=https://example.com/hooks/email
# emailgateway.getwebhooks
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.getwebhooks \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.testwebhook
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.testwebhook \
-d APIKey="$EM_API_KEY" \
-d DomainID=12 \
-d WebhookID=999
# emailgateway.deletewebhook
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.deletewebhook \
-d APIKey="$EM_API_KEY" \
-d WebhookID=999 \
-d DomainID=12
# emailgateway.regeneratesigningkey
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.regeneratesigningkey \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
Webhooks shows the payload and how to check the signature.
Event log
emailgateway.getevents
| Parameter | Required | Description |
|---|---|---|
StartFrom |
Yes | Offset |
RetrieveCount |
Yes | Up to 100 |
DomainID |
No | Omit for all your domains |
StartDate, EndDate |
No | YYYY-MM-DD |
Event |
No | Event type |
MessageID |
No | One message |
Query |
No | Search |
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.getevents \
-d APIKey="$EM_API_KEY" \
-d StartFrom=0 \
-d RetrieveCount=100 \
-d DomainID=12
Returns TotalRecords and Events. Errors: 2 domain not found, 4 invalid StartFrom, 5 invalid RetrieveCount.
Other log commands
| Command | Required | Returns |
|---|---|---|
emailgateway.exportevents |
none. Optional DomainID, Event, MessageID, Query, StartDate, EndDate |
CSV with Time, Event, MessageID, From, To, Subject, Domain, SMTPCode, up to 10,000 rows |
emailgateway.getmessagecontent |
MessageID |
ContentStatus (Stored, Expired or NotStored), Subject, HTMLBody, TextBody, attachment details |
Examples:
# emailgateway.exportevents
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.exportevents \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.getmessagecontent
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.getmessagecontent \
-d APIKey="$EM_API_KEY" \
-d MessageID=550e8400-e29b-41d4-a716-446655440000
Stats
| Command | Required | Optional | Returns |
|---|---|---|---|
emailgateway.domainstats |
DomainID |
StartDate, EndDate |
Stats, ComparisonStats, TagStats |
emailgateway.accountstats |
none | StartDate, EndDate, DomainIDs |
Totals, ComparisonTotals, PerDomain |
emailgateway.dailyseries |
none | DomainID, StartDate, EndDate |
Daily sent, bounced, opened and clicked |
emailgateway.aggrevents |
DomainID |
StartDate, EndDate, AggregatedField, AggregateSize |
AggBuckets (key, doc_count) |
emailgateway.listrecipientdomains |
DomainID |
StartDate, EndDate, Limit (1 to 1000, default 50) |
RecipientDomains |
emailgateway.recipientdomainstats |
DomainID, RecipientToDomain |
StartDate, EndDate |
SummaryStats, DeliverySpeedHistogram |
Examples:
# emailgateway.domainstats
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.domainstats \
-d APIKey="$EM_API_KEY" \
-d DomainID=12 \
-d StartDate=2026-11-01
# emailgateway.accountstats
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.accountstats \
-d APIKey="$EM_API_KEY" \
-d StartDate=2026-11-01
# emailgateway.dailyseries
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.dailyseries \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.aggrevents
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.aggrevents \
-d APIKey="$EM_API_KEY" \
-d DomainID=12
# emailgateway.listrecipientdomains
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.listrecipientdomains \
-d APIKey="$EM_API_KEY" \
-d DomainID=12 \
-d Limit=100
# emailgateway.recipientdomainstats
curl https://app.emailmarketer.io/api.php \
-d Command=emailgateway.recipientdomainstats \
-d APIKey="$EM_API_KEY" \
-d DomainID=12 \
-d RecipientToDomain=gmail.com
Sender key endpoints
These take a sender API key as Authorization: Bearer <key> and work on that key’s domain. Errors use the Errors array format.
| Endpoint | Purpose | Parameters | Errors |
|---|---|---|---|
POST /api/v1/email |
Send email | See that page | See that page |
POST /api/v1/webhooks |
Add a webhook | Event, WebhookURL |
2, 3, 5 to 7, 13 invalid key, 14, 429 |
GET /api/v1/webhooks |
List webhooks | none | 2, 13, 429 |
DELETE /api/v1/webhooks |
Delete a webhook | WebhookID |
1, 2, 4, 13, 429 |
GET /api/v1/events |
Read the event log | StartFrom (default 0), RetrieveCount (default 5, up to 100), StartDate, EndDate (Unix seconds), Event, MessageID |
1, 2, 4, 5, 13, 14, 429 |
Examples (the send itself is on Send email):
# Add a webhook
curl -X POST https://app.emailmarketer.io/api/v1/webhooks \
-H "Authorization: Bearer $EM_SENDER_KEY" \
-H "Content-Type: application/json" \
-d '{ "Event": "delivery", "WebhookURL": "https://example.com/hooks/email" }'
# List webhooks
curl -G https://app.emailmarketer.io/api/v1/webhooks \
-H "Authorization: Bearer $EM_SENDER_KEY"
# Delete a webhook
curl -X DELETE -G https://app.emailmarketer.io/api/v1/webhooks \
-H "Authorization: Bearer $EM_SENDER_KEY" \
-d WebhookID=999
# Read the event log
curl -G https://app.emailmarketer.io/api/v1/events \
-H "Authorization: Bearer $EM_SENDER_KEY" \
-d StartFrom=0 \
-d RetrieveCount=100
GET /api/v1/events returns TotalRecords and Events. Each event has Event, LoggedAt, Tags, Reason and Message (Headers with MessageId, From, To, Subject, plus Size, ToDomain). Event values include accepted, rejected, delivered, failed, opened, clicked, unsubscribed and complained.