The Stacko Mail admin screens are a single-page app that talks to WordPress through REST routes in the stacko-mail/v1 namespace.
- Every route requires the Stacko Mail capability:
manage_options, or manage_network_options on multisite.
- From the browser, use WordPress cookie authentication with a REST nonce (the
X-WP-Nonce header), as the admin app does.
- Responses never contain passwords, API keys or webhook URLs. Secret fields come back as
{ "set": true|false, "source": "db"|"constant" }.
Base URL: /wp-json/stacko-mail/v1.
POST routes marked “editable” also accept PUT and PATCH.
| Method |
Route |
Description |
GET |
/status |
Plugin version, database version and the mailers of the primary and backup connections. |
GET |
/stats |
Dashboard numbers: today’s counts, a per-day series, recent emails and the latest failure. |
GET |
/diagnostics/report |
Plain-text diagnostic report (addresses masked, no secrets). Optional log_id (integer) to focus on one email. |
| Method |
Route |
Parameters |
Description |
GET |
/mailers |
|
Available mailers with their settings schema. |
GET |
/connections |
|
The primary and backup connections (or null), with secrets replaced and locked (wp-config.php) fields listed. |
POST |
/connections/{slot} |
mailer (string, required), settings (object) |
Validates and saves a connection. {slot} is primary or backup. Empty secret fields keep the saved value. Fires stacko_mail_connection_saved. |
DELETE |
/connections/{slot} |
|
Removes a connection and its saved secrets. |
POST |
/connections/swap |
|
Swaps primary and backup. Fails when a mailer is fixed in wp-config.php. |
| Method |
Route |
Parameters |
Description |
POST |
/test/connection |
slot (primary default, or backup), mailer (string), settings (object) |
Step-by-step connection test without sending. With mailer and settings, tests unsaved form values; without them, tests the saved connection. |
POST |
/test/email |
slot (primary default, or backup), to (string, required), html (boolean, default true) |
Sends a real test email and returns the result, error code and redacted transcript. |
| Method |
Route |
Parameters |
Description |
GET |
/logs |
status, source, search, from, to (ISO 8601 date-time), before / after (integer cursors), limit (1–100, default 25) |
Paginated list of emails. |
GET |
/logs/{id} |
|
One email with its events and error explanation. |
POST |
/logs/resend |
ids (integer array, 1–500 items) |
Resends emails whose content was logged. Each resend is logged as a new entry linked to the original. |
POST |
/logs/delete |
ids (integer array, 1–500 items) |
Deletes emails from the log. |
GET |
/logs/export |
Same filters as /logs |
Emails for CSV export, up to 10,000 per request. |
status is one of sent, failed, blocked, redirected, sending, or empty for all.
| Method |
Route |
Parameters |
Description |
GET |
/settings |
|
General settings. |
POST (editable) |
/settings |
Any of the keys below |
Saves only the keys sent. |
GET |
/preferences |
|
The current user’s admin theme. |
POST (editable) |
/preferences |
theme: auto, light or dark |
Saves the current user’s admin theme. |
Settings keys:
| Key |
Type |
Default |
log_enabled |
boolean |
true |
log_body |
boolean |
false |
retention_days |
integer, 1–3650 |
30 |
from_email |
string (email or empty) |
'' |
from_name |
string, max 100 characters |
'' |
force_from_email |
boolean |
false |
force_from_name |
boolean |
false |
return_path |
boolean |
false |
control_mode |
off, pause or redirect |
off |
control_redirect_to |
string (email or empty) |
'' |
dns_over_https |
boolean |
false |
uninstall_delete_data |
boolean |
false |
| Method |
Route |
Parameters |
Description |
GET |
/alerts |
|
Channels (email, slack, discord, teams, webhook) and rules (on_failure, on_fallback). Webhook URLs come back as { "set": bool }. |
POST |
/alerts |
channels (object, required), rules (object, required) |
Validates and saves. An empty webhook URL keeps the saved one. |
POST |
/alerts/test |
channel (one of the channels, required), target (string, default: the saved one) |
Sends a test alert. |
| Method |
Route |
Parameters |
Description |
GET |
/domain-health |
domain (default: sending domain), selector (DKIM selector, [A-Za-z0-9._-], max 63), refresh (boolean, default false) |
SPF, DKIM, DMARC and MX checks plus the Email Health Score. Results are cached for an hour unless refresh is true. |
| Method |
Route |
Parameters |
Description |
GET |
/import/sources |
|
Other SMTP plugins whose settings were found, with a preview (no secrets). |
POST |
/import |
source (required): wp-mail-smtp, easy-wp-smtp, fluent-smtp, post-smtp or suremails |
Imports that plugin’s settings into the primary connection. Returns the mailer and which secret fields must be re-entered. |
GET |
/export |
|
Settings export (JSON) without secrets, alert targets or webhook URLs. |
POST |
/import/json |
data (object, required) |
Restores an export file. Every value is validated. Returns which secret fields must be entered per connection. |
Routes that send email or make outside requests are rate limited. Over the limit, they return HTTP 429.
| Action |
Limit |
Test email (/test/email) |
6 per minute |
Connection test (/test/connection) |
20 per minute |
Test alert (/alerts/test) |
10 per minute |
Domain check (/domain-health, uncached) |
10 per minute |
Resend (/logs/resend) |
100 emails per hour |
Errors use the standard WordPress REST format, with codes prefixed stacko_mail_, for example stacko_mail_not_found (404), stacko_mail_no_connection (404), stacko_mail_unknown_mailer (400), stacko_mail_import_failed (400), stacko_mail_bad_file (400) and stacko_mail_rate_limited (429). Delivery failures are reported in the response body with a mail error code, not as REST errors.