API Reference

DSMTP provides a WordPress REST API under the dsmtp/v1 namespace. All endpoints require WordPress nonce authentication and the manage_options capability.

Authentication

Include a WordPress nonce in the X-WP-Nonce header of every request. The nonce is generated via wp_create_nonce('wp_rest') on the WordPress side.

SMTP

GET  /smtp              — Retrieve SMTP configuration (password excluded)
POST /smtp              — Save SMTP settings
POST /smtp/test         — Test SMTP connection

Templates

GET    /templates       — List all email templates
POST   /templates       — Create a template
GET    /templates/:id   — Get a single template
PUT    /templates/:id   — Update a template
DELETE /templates/:id   — Delete a template
POST   /templates/:id/activate — Set template as active

Forms

GET /forms                        — List all detected forms
GET /forms/:plugin/:id            — Get a specific form
GET /forms/:plugin/:id/fields     — Get form fields

Assignments

GET    /assignments       — List form-to-template assignments
POST   /assignments       — Create an assignment
PUT    /assignments/:id   — Update an assignment
DELETE /assignments/:id   — Delete an assignment

Submissions

GET    /submissions                              — List submissions
       ?search=&form=&start_date=&end_date=&page=&per_page=
GET    /submissions/count                        — Count submissions
GET    /submissions/:id                          — Get a single submission
DELETE /submissions/:id                          — Move to trash
POST   /submissions/bulk-delete                  — Bulk move to trash
POST   /submissions/clear-all                    — Clear all submissions
GET    /submissions/trash                        — List trashed submissions
POST   /submissions/:id/trash                    — Move to trash
POST   /submissions/trash/:id/restore            — Restore from trash
DELETE /submissions/trash/:id/purge              — Permanently delete
POST   /submissions/trash/purge-all              — Purge all trash

Newsletter

GET    /newsletter/lists                         — List newsletter lists
POST   /newsletter/lists                         — Create a list
GET    /newsletter/lists/:id                     — Get a single list
PUT    /newsletter/lists/:id                     — Update a list
DELETE /newsletter/lists/:id                     — Delete a list
GET    /newsletter/lists/:id/subscribers         — List subscribers
GET    /newsletter/lists/:id/subscribers/count   — Count subscribers
GET    /newsletter/lists/:id/export              — Export subscribers as CSV

Dashboard & System

GET /dashboard/stats    — Get dashboard statistics
GET /system/status      — Get system status and diagnostics

Settings

GET  /settings/export    — Export all settings as JSON
POST /settings/import    — Import settings from JSON

License (Plugin-Local)

These endpoints are managed within the plugin itself (not the remote license server):

GET  /license                   — Get license info, is_active, should_disable, should_warn
POST /license/activate          — Activate a license key
POST /license/deactivate        — Deactivate license

Remote License API

The WordPress plugin communicates with the DSMTP license server (dsmtp.damiandzik.com) for license validation:

Validate

POST https://dsmtp.damiandzik.com/api/license/validate

Request:

{
  "license_key": "dsmtp_xxxx_xxxx_xxxx",
  "site_url": "https://example.com",
  "site_name": "My WordPress Site",
  "plugin_version": "0.1.28"
}

Success (200):

{
  "valid": true,
  "license_key": "dsmtp_xxxx_xxxx_xxxx",
  "max_sites": 1,
  "addon_sites": 0,
  "sites_used": 1,
  "sites_total": 1,
  "expires_at": "2026-06-24T00:00:00.000Z",
  "status": "active"
}

Errors:

StatusError
400Missing license_key or site_url
404License key not found
403License is revoked / expired
403No active subscription
403Seat limit reached

Deactivate

POST https://dsmtp.damiandzik.com/api/license/deactivate

Request:

{
  "license_key": "dsmtp_xxxx_xxxx_xxxx",
  "site_url": "https://example.com"
}

Success (200): { "deactivated": true }